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.
pip install grain-lint
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
| Rule | What |
|---|---|
| OBVIOUS_COMMENT | Comment restates the following line |
| NAKED_EXCEPT | Broad except with no re-raise |
| RESTATED_DOCSTRING | Docstring just expands the function name |
| VAGUE_TODO | TODO without specific approach |
| GENERIC_VARNAME | AI filler names (process_data, handle_response) |
| HEDGE_WORD | AI prose ("robust", "seamless", "leverage") |
| OBVIOUS_HEADER | Header content restated in following paragraph |
| VAGUE_COMMIT | Generic commit message (update, fix bug, wip) |
| AND_COMMIT | Commit does two things -- split it |
except Exception as e: # grain: ignore NAKED_EXCEPT
pass # intentional top-level catch