New hooks were added for pre-commit and they will run in CI too. pep8-naming was added as a flake8 plugin to ensure names comply with PEP 8.
Hooks added
A couple of these hooks automatically apply fixes. However, they still report failure and leave any changes they make uncommitted. Therefore, the user has to commit the automatic fixes.
check-merge-conflict - Check for files that contain merge conflict strings.
check-yaml - Attempts to load all yaml files to verify syntax.
end-of-file-fixer - Makes sure files end in a newline and only a newline.
mixed-line-ending - Replaces mixed line endings with LF.
trailing-whitespace - Trims trailing whitespace.
python-check-blanket-noqa - Enforce that noqa annotations always occur with specific codes
Reasoning
Dev dependencies were updated and re-pinned because why not? They were getting old enough. I'm just following along with the other repos.
The pre-commit environment is cached to speed up builds.
To reduce redundancy and overhead in maintain dependencies, flake8 is now invoked through the current active Python environment rather than being installed in pre-commit's isolated environment. This means the hook now assumes the user already has flake8 installed i.e. via pip install -e .[dev].
Additional Details
The pre-commit venv is cached. There should only be a cache miss if the .pre-commit-config.yaml file changes or if the location of the Python interpreter changes (more realistically, if the Python version changes). Maybe Azure wipes the cache sometimes too, but in that case pre-commit will simply re-create the environment.
Relevant Issues
python-discord/organisation#138 python-discord/organisation#153
Description
New hooks were added for pre-commit and they will run in CI too. pep8-naming was added as a flake8 plugin to ensure names comply with PEP 8.
Hooks added
A couple of these hooks automatically apply fixes. However, they still report failure and leave any changes they make uncommitted. Therefore, the user has to commit the automatic fixes.
check-merge-conflict
- Check for files that contain merge conflict strings.check-yaml
- Attempts to load all yaml files to verify syntax.end-of-file-fixer
- Makes sure files end in a newline and only a newline.mixed-line-ending
- Replaces mixed line endings with LF.trailing-whitespace
- Trims trailing whitespace.python-check-blanket-noqa
- Enforce thatnoqa
annotations always occur with specific codesReasoning
pip install -e .[dev]
.Additional Details
The pre-commit venv is cached. There should only be a cache miss if the
.pre-commit-config.yaml
file changes or if the location of the Python interpreter changes (more realistically, if the Python version changes). Maybe Azure wipes the cache sometimes too, but in that case pre-commit will simply re-create the environment.