If I want to write a pre-commit hook to check that, e.g., the string "I love pre-commit" isn't anywhere in my source code, I could do
- repo: local
hooks:
- id: love_statement
name: Check that I love pre-commit isn't in source code
types: [python]
entry: 'I love pre-commit'
language: pygrep
However, what if I want to do this opposite - that is, check that "I love pre-commit" is in every source code file? How could I modify my hook so that, instead of failing if "I love pre-commit" is found, it would fail if "I love pre-commit" isn't found?
this can now be done with
args: [--negate]