Merge "Add pre-commit configuration"
This commit is contained in:
commit
678a1713ea
51
.pre-commit-config.yaml
Normal file
51
.pre-commit-config.yaml
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
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']
|
@ -45,6 +45,7 @@ disable=
|
||||
unused-variable,
|
||||
useless-super-delegation,
|
||||
using-constant-test,
|
||||
redundant-u-string-prefix,
|
||||
# "C" Coding convention violations
|
||||
consider-iterating-dictionary,
|
||||
consider-using-enumerate,
|
||||
@ -75,6 +76,8 @@ disable=
|
||||
too-many-public-methods,
|
||||
too-many-return-statements,
|
||||
too-many-statements,
|
||||
use-dict-literal,
|
||||
super-with-arguments,
|
||||
# new for python3 version of pylint
|
||||
consider-using-set-comprehension,
|
||||
unnecessary-pass,
|
||||
|
@ -39,6 +39,12 @@ run_pylint () {
|
||||
|
||||
echo "Running pylint..."
|
||||
echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~1, this change only)..."
|
||||
echo ""
|
||||
echo "Consider using the 'pre-commit' tool instead."
|
||||
echo ""
|
||||
echo " pip install --user pre-commit"
|
||||
echo " pre-commit install --allow-missing-config"
|
||||
echo ""
|
||||
if [ -n "${files}" ]; then
|
||||
pylint --rcfile=.pylintrc --output-format=colorized ${files}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user