'pre-commit' tool [1] provides an extensible way to configure hooks which can be run automatically before each commit. That way we can make sure that code send to review is passing base static analysis checks like e.g. bandit, flake8 or hacking. For now this is optional to use and not integrated in e.g. tox.ini file but we can integrate it there too as next step. [1] https://pre-commit.com/ Change-Id: I49efd39a93103d2e1888c9b641962280622ae60b
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
---
|
|
default_language_version:
|
|
# force all unspecified python hooks to run python3
|
|
python: python3
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.5.0
|
|
hooks:
|
|
- id: trailing-whitespace
|
|
- id: mixed-line-ending
|
|
args: ['--fix', 'lf']
|
|
exclude: '.*\.(svg)$'
|
|
- id: check-byte-order-marker
|
|
- id: check-executables-have-shebangs
|
|
- id: check-merge-conflict
|
|
- id: debug-statements
|
|
- repo: https://github.com/PyCQA/bandit
|
|
rev: 1.7.5
|
|
hooks:
|
|
- id: bandit
|
|
# B104: Possible binding to all interfaces
|
|
# B303: Blacklist use of insecure MD2, MD4, MD5, or SHA1 hash functions
|
|
# B311: Standard pseudo-random generators are not suitable for security/cryptographic purpose
|
|
args: ['-n5', '-sB104,B303,B311']
|
|
files: 'neutron_lib/'
|
|
exclude: 'neutron_lib/tests'
|
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
|
rev: v1.5.4
|
|
hooks:
|
|
- id: remove-tabs
|
|
exclude: '.*\.(svg)$'
|
|
- repo: local
|
|
hooks:
|
|
- id: flake8
|
|
name: flake8
|
|
additional_dependencies:
|
|
- hacking>=6.1.0,<6.2.0
|
|
- neutron
|
|
language: python
|
|
entry: flake8
|
|
files: '^.*\.py$'
|
|
exclude: '^(doc|releasenotes|tools)/.*$'
|
|
# TODO(slaweq): enable pylint check once all issues in the current code will
|
|
# be solved
|
|
# - id: pylint
|
|
# name: pylint
|
|
# entry: .tox/pep8/bin/pylint
|
|
# files: ^neutron_lib/
|
|
# language: system
|
|
# types: [python]
|
|
# args: ['--rcfile=.pylintrc', '--output-format=colorized']
|