-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
.pre-commit-config.yaml
100 lines (99 loc) · 3.28 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
default_language_version:
python: python3
default_install_hook_types:
- pre-commit
- pre-push
default_stages:
- pre-commit
repos:
- repo: https://github.com/pycqa/flake8
rev: c6e0d27593a45342ffa96a18bba708a5aab32fdf # 3.9.2 should match major Python version
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==21.11.28
- flake8-comprehensions==3.7.0
- flake8-unused-arguments==0.0.6
- flake8-use-fstring==1.3.0
- repo: https://github.com/psf/black
rev: ae2c0758c9e61a385df9700dc9c231bf54887041 # 22.3.0
hooks:
- id: black
- repo: https://github.com/timothycrosley/isort/
rev: e44834b7b294701f596c9118d6c370f86671a50d # 5.12.0
hooks:
- id: isort
- repo: https://github.com/jendrikseipp/vulture
rev: 44aed44e226ec0e5660851462f764ec5d5da957c # v2.3
hooks:
- id: vulture
args: ["--ignore-decorators", "@task", "--ignore-names", "test_*,Test*", "tasks"]
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 7cc5848088fd8412905ab79feea6c8edc3ac76c6 # 2.1.5
hooks:
- id: shellcheck
args: ["--severity=info", "-e", "SC2059", "-e", "SC2028"]
- repo: https://github.com/tekwizely/pre-commit-golang
rev: bd69b816c43306f28bad4d7b303d981b0ecd2fd5 # v1.0.0-beta.5
hooks:
- id: go-fmt
args: [ "-w", "-s" ]
- repo: local
hooks:
- id: protected-branches
name: protected-branches
description: checks that the commit isn't created on a protected branch
entry: 'python3 tasks/git-hooks/protected-branches.py'
language: system
- id: revive
name: revive
description: revive
entry: 'python3 tasks/git-hooks/revive.py'
language: system
files: \.go$
- id: govet
name: govet
description: go vet
entry: 'python3 tasks/git-hooks/govet.py'
language: system
require_serial: true
files: \.go$
- id: copyright
name: copyright
description: copyright headers
entry: 'python3 tasks/git-hooks/copyright.py'
language: system
require_serial: true
files: \.go$
- id: win-clang-format
name: win-clang-format
description: clang-format
entry: './tasks/git-hooks/wincpplang.py'
language: system
types_or: [c, c++, c#]
- id: clang-format
name: clang-format
description: clang-format
entry: 'python3 tasks/git-hooks/clang-format.py'
language: system
require_serial: true
files: '^pkg/(ebpf|network|security)/.*\.(c|h)$'
exclude: '^pkg/ebpf/(c/bpf_endian|c/bpf_helpers|compiler/clang-stdarg).h$'
- id: go-mod-tidy
name: go-mod-tidy
description: check that all go.mod files are tidy
entry: 'python3 -m tasks.git-hooks.go-mod-tidy'
language: system
require_serial: true
files: (\.go|^go\.mod|^go\.sum)$
# no need to pass filenames, all go.mod have to be tidied anyway
pass_filenames: false
# inv tidy-all takes several seconds so only run it on pre-push
stages: [pre-push]
- id: check-go-modules-in-python
name: check-go-modules-in-python
description: Validate all go modules are declared in Invoke tasks
entry: 'inv modules.validate --fix-format'
language: system
pass_filenames: false
files: (.*go\.mod|modules\.yml|.*gomodules\.py|.*modules\.py)$