Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 533 Bytes

README.md

File metadata and controls

13 lines (11 loc) · 533 Bytes

Pre-commit hooks for PyCharm

  1. Settings -> Plugins -> Pre Commit Hook Plugin - install
  2. Create a file named pre-commit-hook.sh or pre-commit-hook.bat for Windows, in your project root, exit with non-zero code to 'fail' the commit.
  3. chmod a+x pre-commit-hook.sh
  4. Settings -> Tools -> Pre Commit Hook
  5. Put a path to your script

pre-commit-hook.sh

cd ~/PycharmProjects/your-project-folder
docker exec container-name flake8 `git diff HEAD --name-only|grep ".py" || echo "path-to-folder-where-git-init"` || exit 1