pre_commit_check.py - Formatting, Lint, and Unittests
This script runs a series of checks that should all pass before submitting a pull request. In a perfect world, these would also pass before every commit. The checks are detailed in Pull requests.
Imports
These are listed in the order prescribed by PEP 8.
Standard library
None.
Third-party imports
None.
Local application imports
Checks
Run this first, since it’s quick and should always succeed.
Do this next – it should be easy to fix most of these.
Next, check the docs. Again, these only require fixes to comments, and should still be relatively easy to correct.
Force a full build:
- -E
Don’t use a saved environment (the structure caching all cross-references), but rebuild it completely.
- -a
If given, always write all output files.
Finally, unit tests – the hardest to get right.
Attention
Coverage Reports
The command coverage html
will generate a test coverage report showing
the lines of code that were executed (or not) by the tests. This is a great
report to help figure out what new tests should be written to keep our coverage
near 100% You can view the report by opening test/htmlcov/index.html
in
your browser.