6 Commits

Author SHA1 Message Date
Takashi Kajinami
9c7dbf8fd0 Run pyupgrade to clean up Python 2 syntaxes
Update all .py source files by
 $ pyupgrade --py3-only $(git ls-files | grep ".py$")
to modernize the code according to Python 3 syntaxes.

pep8 errors are fixed by
 $ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
    --in-place tooz

Also add the pyupgrade hook to pre-commit to avoid merging additional
Python 2 syntaxes.

Change-Id: I18b9e51964afe739ddabd3d074431c27a09a8508
2024-10-22 16:43:10 +09:00
Stephen Finucane
0e2010d930 pre-commit: Bump version, add doc8
Change-Id: I2319edaf17589e22567c352d3d79cb925febbd8d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-03-28 10:21:40 +00:00
Takashi Kajinami
058e1a11c7 Bump hacking
hacking 4.0.x is too old.

Change-Id: I19b8f35dd5801f7606856a54d19b926b351014e8
2024-01-26 01:03:15 +09:00
Daniel Bengtsson
714e77e71f Move flake8 as a pre-commit local target.
The goal here is to avoid conflicts between flake8 and hacking version each
2 days.

Inspired from nova's approach[1].

The flake8 version to install will be determined by hacking and
requirements[2] will stay aligned instead of relying on different versions.

[1] https://opendev.org/openstack/nova/src/branch/master/.pre-commit-config.yaml#L26-L35
[2] https://opendev.org/openstack/hacking/src/branch/master/requirements.txt#L1

Change-Id: Ic3f3d05ce7bb10a7d29815444dac00dea4f9c9d1
2021-04-06 11:01:50 +02:00
manchandavishal
a381d71423 Bump hacking and flake8 version to fix pep8 job
This patch update hacking and flake8 version to
fix pep8 job.

Change-Id: Id6999d06fb2e15b5c80bc27b995bde065b342eec
2021-02-08 08:43:26 +00:00
Hervé Beraud
c3d8c2ed96 Adding pre-commit
Introduced changes:
- pre-commit config and rules.
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.

Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.

pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker
  (check-byte-order-marker);
- Checks that non-binary executables have a proper
  shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings
  (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
  calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)

For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks

Change-Id: I7a2386a823fdd43b138956894bd915c0e11289a9
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-10-09 15:35:34 +00:00