summaryrefslogtreecommitdiff
path: root/.pre-commit-config.yaml
Commit message (Collapse)AuthorAgeFilesLines
* pre-commit: Sync hacking version, bump pluginsStephen Finucane2022-04-051-5/+4
| | | | | | | | Sync the hacking version used with 'test-requirements.txt'. While we're at it, bump the various plugins to their latest versions. Change-Id: I851f67bd04950a30e88f9a737462f98559412cd9 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* Add autopep8 to tox and pre-commitSean Mooney2021-11-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | autopep8 is a code formating tool that makes python code pep8 compliant without changing everything. Unlike black it will not radically change all code and the primary change to the existing codebase is adding a new line after class level doc strings. This change adds a new tox autopep8 env to manually run it on your code before you submit a patch, it also adds autopep8 to pre-commit so if you use pre-commit it will do it for you automatically. This change runs autopep8 in diff mode with --exit-code in the pep8 tox env so it will fail if autopep8 would modify your code if run in in-place mode. This allows use to gate on autopep8 not modifying patches that are submited. This will ensure authorship of patches is maintianed. The intent of this change is to save the large amount of time we spend on ensuring style guidlines are followed automatically to make it simpler for both new and old contibutors to work on nova and save time and effort for all involved. Change-Id: Idd618d634cc70ae8d58fab32f322e75bfabefb9d
* Switch to hacking 2.xStephen Finucane2020-01-171-1/+1
| | | | | | | | | This bumps the version of flake8 and pycodestyle to something much newer, which resolves a long-standing warning about nested sets and allows us to use new fangled features like f-strings if we so choose. Change-Id: I0bb9077f1cea2243b7945e87cfa140f9cf89d558 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* pre-commit: Use Python 3 to run checksStephen Finucane2020-01-141-0/+3
| | | | | | | | We need this otherwise flake8 will run in Python 2 mode, which results in syntax errors for Python 3-only syntax like kwarg-only functions. Change-Id: Id55dbce1d9a19ccaa4fe605985fb165e9b3ab48c Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Keep pre-commit inline with hacking and fix whitespaceMonty Taylor2019-12-121-3/+14
| | | | | | | | | | | | | | | | | | The flake8 hook for pre-commit installs its own flake8 which is not what hacking is pinned to. This results in a bunch of errors. By doing a local hook we can cause these to be the same. There are flake8 exclusions in tox.ini that need to be used in pre-commit. Also we should exclude svg files from the whitespace modifications, because who cares. Once those are fixed, running pre-commit -a fixes some whitespace issues. While the normal use isn't to run -a - if someone does make a patch that touches any of these they'll get erroneous unrelated errors compared to their lower work - so fix all of the existing issues, which are mostly space-at-end-of-line issues it seems. Change-Id: I78e753492e99c03b30a0a691db3bd75ee3d289c9
* Integrate 'pre-commit'Stephen Finucane2019-11-281-0/+21
This nifty tool provides a extensible way to configure pre-commit hooks to do everything from running linters to spellchecking [1] and has already been adopted by a few OpenStack projects [2]. Let's start using it as a faster, more automatic alternative to the 'fast8' tox target and iterate on it as we find more things to use it for. The 'fast8' target is not deprecated though a note is included for end-users to alert them to this great new tool. Note that the 'check-executables-have-shebangs' actually failed and highlighted that the 'contributor/development-environment.rst' document was marked as executable when it shouldn't have been. This is corrected. [1] https://pre-commit.com/ [2] https://review.opendev.org/#/q/file:.pre-commit-config.yaml Change-Id: I256e75eceeb3495dce04885ca42d16adb4160cf3 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>