4 Commits

Author SHA1 Message Date
Sean Mooney
cde68026eb update hacking pin to support flake8 3.8.3
this change updates the max version of hacking
to 4.1.0 to allow pre-commit to work with the
flake 3.8.3 release and correct one new error that was
raised as a result.

Change-Id: I3a0242208f411b430db0e7429e2c773f45b3d301
2022-05-23 14:39:56 +00:00
wu.shiming
c1f9fbeadf Upgrade the pre-commit-hooks version
[1] 9136088a24

Change-Id: Ifbea6ef06e230127bfa16fc3dc0ddd9f236cfbed
2021-05-18 11:14:35 +08:00
Kenneth Giusti
f43a70687c 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

Co-authored-by: Daniel Bengtsson <dbengt@redhat.com>

Change-Id: I3d2e95c783cb0ca88ea8657acd9f262ea9244e9d
2021-04-13 12:23:56 +02:00
Hervé Beraud
a997f09e5b 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: Ibd0c3d64fdc5c293d9d676d33eab828d9fde971f
Co-authored-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-09-22 12:35:37 +02:00