2020-09-03 22:59:46 +00:00
Developer Guide
===============
Pre-commit Checks
-----------------
2020-12-01 14:52:38 +00:00
This project is configured for use with `pre-commit`_ to install `VCS/git hooks`_ which perform some static code analysis checks and other code checks to catch common errors.
These hooks can be configured to run before commits or pushes
2020-09-03 22:59:46 +00:00
For example::
2020-12-01 14:52:38 +00:00
tahoe-lafs $ pre-commit install --hook-type pre-push
2020-09-30 14:37:52 +00:00
pre-commit installed at .git/hooks/pre-push
2020-12-01 14:52:38 +00:00
tahoe-lafs $ echo "undefined" > src/allmydata/undefined_name.py
tahoe-lafs $ git add src/allmydata/undefined_name.py
2020-09-30 13:58:10 +00:00
tahoe-lafs $ git commit -a -m "Add a file that violates flake8"
2020-12-01 14:52:38 +00:00
tahoe-lafs $ git push
2020-09-30 14:37:52 +00:00
codechecks...............................................................Failed
- hook id: codechecks
2020-09-30 13:58:10 +00:00
- exit code: 1
2020-09-03 22:59:46 +00:00
2020-09-30 14:37:52 +00:00
GLOB sdist-make: ./tahoe-lafs/setup.py
codechecks inst-nodeps: ...
codechecks installed: ...
codechecks run-test-pre: PYTHONHASHSEED='...'
2020-12-01 14:52:38 +00:00
codechecks run-test: commands[0] | flake8 src/allmydata/undefined_name.py
src/allmydata/undefined_name.py:1:1: F821 undefined name 'undefined'
ERROR: InvocationError for command ./tahoe-lafs/.tox/codechecks/bin/flake8 src/allmydata/undefined_name.py (exited with code 1)
2020-09-30 14:37:52 +00:00
___________________________________ summary ____________________________________
ERROR: codechecks: commands failed
2020-09-03 22:59:46 +00:00
To uninstall::
2020-12-01 14:52:38 +00:00
tahoe-lafs $ pre-commit uninstall --hook-type pre-push
2020-09-30 14:37:52 +00:00
pre-push uninstalled
2020-09-03 22:59:46 +00:00
2020-09-30 14:37:52 +00:00
.. _`pre-commit`: https://pre-commit.com
.. _`VCS/git hooks`: `pre-commit`_
.. _`pre-commit configuration`: ../.pre-commit-config.yaml