source: trunk/docs/developer-guide.rst

Last change on this file was 272d6d0, checked in by Jean-Paul Calderone <exarkun@…>, at 2020-12-01T14:55:17Z

Update developer docs wrt pre-commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1Developer Guide
2===============
3
4
5Pre-commit Checks
6-----------------
7
8This 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.
9These hooks can be configured to run before commits or pushes
10
11For example::
12
13  tahoe-lafs $ pre-commit install --hook-type pre-push
14  pre-commit installed at .git/hooks/pre-push
15  tahoe-lafs $ echo "undefined" > src/allmydata/undefined_name.py
16  tahoe-lafs $ git add src/allmydata/undefined_name.py
17  tahoe-lafs $ git commit -a -m "Add a file that violates flake8"
18  tahoe-lafs $ git push
19  codechecks...............................................................Failed
20  - hook id: codechecks
21  - exit code: 1
22
23  GLOB sdist-make: ./tahoe-lafs/setup.py
24  codechecks inst-nodeps: ...
25  codechecks installed: ...
26  codechecks run-test-pre: PYTHONHASHSEED='...'
27  codechecks run-test: commands[0] | flake8 src/allmydata/undefined_name.py
28  src/allmydata/undefined_name.py:1:1: F821 undefined name 'undefined'
29  ERROR: InvocationError for command ./tahoe-lafs/.tox/codechecks/bin/flake8 src/allmydata/undefined_name.py (exited with code 1)
30  ___________________________________ summary ____________________________________
31  ERROR:   codechecks: commands failed
32
33To uninstall::
34
35  tahoe-lafs $ pre-commit uninstall --hook-type pre-push
36  pre-push uninstalled
37
38
39
40.. _`pre-commit`: https://pre-commit.com
41.. _`VCS/git hooks`: `pre-commit`_
42.. _`pre-commit configuration`: ../.pre-commit-config.yaml
Note: See TracBrowser for help on using the repository browser.