Skip to content

Commit

Permalink
Improve black reporting through precommit
Browse files Browse the repository at this point in the history
When running `pre-commit run`, black only shows a failure without
showing *why* which is annoying, especially with #51 allowing running
`pre-commit` via tox. It also makes looking at the pre-commit report
from github more frustrating than necessary.

Enable option for black to also print the diff it wants on failure,
makes handling that much more comfortable.

Also remove duplicate `flake8-docstrings` in the flake8 documentation,
and fix indentation of the list closing bracket.
  • Loading branch information
xmo-odoo authored and peterjc committed Dec 9, 2021
1 parent 63c4c94 commit 35c4bfb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
rev: 21.12b0
hooks:
- id: black
args: [--check]
args: [--check, --diff]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
Expand All @@ -40,10 +40,9 @@ repos:
'flake8-bugbear',
'flake8-sfs',
'flake8-comprehensions',
'flake8-docstrings',
'flake8-implicit-str-concat',
'pydocstyle>=5.0.0',
]
]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ for code in RST??? ; do
echo "======"
for file in $code/*.py ; do
echo "flake8 --select RST $file"
flake8 --select RST $file 2>&1 | grep ": $code "
flake8 --select RST $file 2| grep ": $code "
done
echo "Good, $code violations reported, as expected."
done
Expand Down

0 comments on commit 35c4bfb

Please sign in to comment.