Calling pylint from the pre-commit hooks, rather than individual GitHub workflow steps. Allows it to be called on a contributor's computer before being pushed to GitHub and failing a test build
The changes are relatively simple. It only requires adding two (2) new hooks against a placeholder local repo. The two separate calls in the included file have to do with the different calls and parameters currently in the workflow. The separate calls are as follows, and match the current process within the .github/workflows/build.yml configuration:
-
The
pylintexecution with the configuration values within the.pylintrcfile, without exception. This is for all files and/or directories (and their contents) which start withadafruit_and end in.py. Following the default naming patterns, particularly when using Cookiecutter and the Adafruit Cookiecutter template, should catch and lint all library-only files, and not the examples or other files. -
The
pylintexecution with with the configuration from the.pylingrcfile, but with some rules or checkes disabled for the example scripts. That means that linting is only performed on*.pyfiles within the/examples/directory, if there is such a directory. The difference with the library rules are that the following rules/checks are disabled:
- missing-docstring
- invalid-name
- bad-whitespace