Pre‐Commit and linters - SuQuoc/ft_transcendence GitHub Wiki

Pre-Commit

Files:

  • .pre-commit-config.yaml
  • pyproject.toml

Runs our linters before committing and formats the code for us to check. If everything is fine, the changes from the formatter are staged and then committed. Pre-commit only checks changed files tracked by git.

****We also plan to add some rules to our commit messages!!! ****

Make sure you have installed pre-commit in your venv.
pip install pre-commit

confirm with:
pre-commit --version

after that install the pre-commit hooks
pre-commit install

to run pre-commit for all files
pre-commit run --all-files

to force a commit and skip pre-commit check:
git commit --no-verify -m "Your commit message"

Linters

python linter flake8

Files:

  • .flake8

We ignore the following flags:

  • E501: line too long
  • F401: module imported but unused
  • F841: local variable 'x' is assigned to but never used