feat: add DOCSTRING_HEDGE_WORD rule to check for slop in docstrings#4
Open
amaurigmartins wants to merge 1 commit into
Open
feat: add DOCSTRING_HEDGE_WORD rule to check for slop in docstrings#4amaurigmartins wants to merge 1 commit into
amaurigmartins wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is my poor man's attempt to push back on AI slop based on some recent experiments of my own.
This PR adds an opt-in Python docstring hedge-word check while keeping the existing Markdown hedge-word rule unchanged.
HEDGE_WORDcontinues to control Markdown prose. A new rule,DOCSTRING_HEDGE_WORD, controls Python module, class, function, and async function docstrings. Both rules read from the same[grain.markdown].hedge_wordslist, so projects maintain one shared policy vocabulary while deciding independently where it applies.Why
Previously, Grain could flag hedge words in Markdown, but Python docstrings were not covered by the same policy. That made it easy for AI-generated bullshit to remain in API documentation embedded in code.
A specific
DOCSTRING_HEDGE_WORDis introduced so Markdown and Python can be configured independently, while preserving the shared hedge-word list. The--fixsemantics is retained, i.e. it will remove garbage filler both from docstrings and MD files.Changes
DocstringHedgeWordingrain/checks/python_checks.py.OPT_IN_PYTHON_CHECKS.HEDGE_WORDand PythonDOCSTRING_HEDGE_WORDindependently configurable viafail_on,warn_only, andignore.[grain.markdown].hedge_wordsfor both checks.--fixsupport for bothHEDGE_WORDandDOCSTRING_HEDGE_WORD.DOCSTRING_HEDGE_WORDas opt-in.Testing
python -m grain checkon modified Python files: passed with no violations.108tests.AI slop is the first sign of Skynet emergence. It will rot our codes and corrupt our brains. Fight back, brother!