Skip to content

If strict mode and git pre-commit fails, suggest no-verify

username-removed-1282016 requested to merge pjacock/flake8:git_hook_msg into master

This is a small usability enhancement for people using the git hook in strict mode.

Example output:

$ git commit -m test src/flake8/main/git.py
src/flake8/main/git.py:4:1: RST399 Unknown directive type "autofunction".
src/flake8/main/git.py:5:1: RST399 Unknown directive type "autofunction".
src/flake8/main/git.py:21:1: E302 expected 2 blank lines, found 1
src/flake8/main/git.py:38:1: RST206 Field list ends without a blank line; unexpected unindent.
src/flake8/main/git.py:78:1: RST206 Field list ends without a blank line; unexpected unindent.
src/flake8/main/git.py:88:52: C812 missing trailing comma
src/flake8/main/git.py:157:41: C812 missing trailing comma
src/flake8/main/git.py:223:46: C812 missing trailing comma
flake8 checks failed. Please fix, or force with 'git commit --no-verify'

In this case the "failures" are from optional plugins https://pypi.python.org/pypi/flake8-rst-docstrings and https://pypi.python.org/pypi/flake8-commas - but the point here is to show the new message:

flake8 checks failed. Please fix, or force with 'git commit --no-verify'

For this example, adding --no-verify skips the pre-commit hook and allows the commit:

$ git commit -m test src/flake8/main/git.py --no-verify
[git_hook_msg 240df14] test
 1 file changed, 1 deletion(-)

Merge request reports