Skip to content

Add setup.cfg for flake8, pycodestyle, YAPF

Andre Sailer requested to merge sailer/ILCDIRAC:flakeStyle into Rel-v27r0

Add configuration for various python code formatters. Install flake8, and its commit hook:

pip install flake8
flake8 --install-hook git
git config flake8.strict true

This doesn't allow commit if something is wrong. Use git commit -m"message" --no-verify to overrule, but only if the messages are about lines not touched in the current commit, which can be checked with the aliases defined in the next lines. Add git alias to run flake on the changed lines only and modify by hand

git config alias.flakeS = "!git diff --staged | flake8 --diff"
git config alias.flake = "!git diff | flake8 --diff"

YAPF can also be installed with pip, but can't be run only on the diff as easily, same for autopep8

Merge request reports