Skip to content

Commit 7eba634

Browse files
committed
Add pre-commit configuration
'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: I7c39d9ff9f735483b1ae9c351e2b945b9f534910
1 parent f4769ef commit 7eba634

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
default_language_version:
3+
# force all unspecified python hooks to run python3
4+
python: python3
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.5.0
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: mixed-line-ending
11+
args: ['--fix', 'lf']
12+
exclude: '.*\.(svg)$'
13+
- id: check-byte-order-marker
14+
- id: check-executables-have-shebangs
15+
- id: check-merge-conflict
16+
- id: debug-statements
17+
- id: check-yaml
18+
- repo: https://github.com/lucas-c/pre-commit-hooks
19+
rev: v1.5.4
20+
hooks:
21+
- id: remove-tabs
22+
exclude: '.*\.(svg)$'
23+
- repo: local
24+
hooks:
25+
- id: flake8
26+
name: flake8
27+
additional_dependencies:
28+
- hacking>=6.1.0,<6.2.0
29+
language: python
30+
entry: flake8
31+
files: '^.*\.py$'
32+
exclude: '^(doc|releasenotes|tools)/.*$'
33+
# todo(slaweq): enable pylint check once all issues in the current code will
34+
# be solved
35+
# - id: pylint
36+
# name: pylint
37+
# entry: pylint
38+
# files: ^ovn_octavia_provider/
39+
# language: system
40+
# types: [python]
41+
# args: ['--rcfile=.pylintrc', '--output-format=colorized']

0 commit comments

Comments
 (0)