grain

Anti-slop linter for AI-assisted codebases.

AI code has tells. grain flags them so a human can decide whether to keep, rewrite, or suppress. It does not auto-fix -- fixing requires judgment.

Install

pip install grain-lint

Usage

grain check [files...]      # check specific files
grain check --all           # check entire repo
grain install               # install git hooks
grain status                # show config
grain suppress FILE:LINE RULE

What it catches

RuleWhat
OBVIOUS_COMMENTComment restates the following line
NAKED_EXCEPTBroad except with no re-raise
RESTATED_DOCSTRINGDocstring just expands the function name
VAGUE_TODOTODO without specific approach
GENERIC_VARNAMEAI filler names (process_data, handle_response)
HEDGE_WORDAI prose ("robust", "seamless", "leverage")
OBVIOUS_HEADERHeader content restated in following paragraph
VAGUE_COMMITGeneric commit message (update, fix bug, wip)
AND_COMMITCommit does two things -- split it

Suppress when intentional

except Exception as e:  # grain: ignore NAKED_EXCEPT
    pass  # intentional top-level catch