forked from aristanetworks/avd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
172 lines (154 loc) · 6.35 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
exclude: ansible_collections/arista/avd/molecule
- id: end-of-file-fixer
exclude_types: [svg, json]
exclude: ansible_collections/arista/avd/molecule
- id: check-added-large-files
exclude: (ansible_collections/arista/avd/molecule|pickle$)
- id: check-merge-conflict
exclude: ansible_collections/arista/avd/molecule
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- name: Check and insert license on Python files
id: insert-license
exclude: ansible_collections/arista/avd/(plugins/module_utils|tests/unit(/module_utils|/modules|))/__init__.py
files: .*\.py$
args:
- --license-filepath
- development/license-short.txt
- --use-current-year
- --allow-past-years
- --fuzzy-match-generates-todo
- --no-extra-eol
- name: Check and insert license on select YAML files
id: insert-license
files: ansible_collections/arista/avd/roles/.*/(handlers|schemas|tasks)/.*\.yml$
args:
- --license-filepath
- development/license-short.txt
- --use-current-year
- --allow-past-years
- --fuzzy-match-generates-todo
- --no-extra-eol
- name: Check and insert license on Jinja2 files
id: insert-license
files: .*\.j2$
exclude: ansible_collections/arista/avd/molecule.*
args:
- --license-filepath
- development/license-short.txt
- --use-current-year
- --allow-past-years
- --fuzzy-match-generates-todo
- --comment-style
- '{#||#}'
- --no-extra-eol
- name: Check and insert license on Markdown files
id: insert-license
files: .*\.md$
exclude: (ansible_collections/arista/avd/molecule|.github|ansible_collections/arista/avd/examples/.+/documentation/).*
args:
- --license-filepath
- development/license-short.txt
- --use-current-year
- --allow-past-years
- --fuzzy-match-generates-todo
- --comment-style
- '<!--| ~| -->'
# - repo: https://github.com/pre-commit/mirrors-autopep8
# rev: 'v1.5.6' # Use the sha / tag you want to point at
# hooks:
# - id: autopep8
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: Check for changes when running isort on all python files
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
name: Check for changes when running Black on all python files
- repo: https://github.com/pycqa/flake8
rev: 4.0.1 # Note ansible-test uses pycodestyle 2.8.0 which is part of this tagged release of flake8
hooks:
- id: flake8
name: Check for Flake8 errors on Python files
# ignoring errors and selecting line length as per
# https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/_util/controller/sanity/pep8/current-ignore.txt
types: [python]
# The cv_client api is generated from proto files, so it should not be linted.
exclude: ^ansible_collections/arista/avd/plugins/plugin_utils/cv_client/api/
- repo: https://github.com/pycqa/pylint
rev: "v2.16.1"
hooks:
- id: pylint # Use pylintrc file in repository
name: Check for Linting errors on Python files
description: This hook runs pylint.
types: [python]
args:
# Suppress duplicate code for modules header
- -d duplicate-code
- repo: https://github.com/adrienverge/yamllint.git
rev: "v1.23.0"
hooks:
- id: yamllint
name: Check for Linting errors on YAML files
description: This hook runs yamllint.
entry: yamllint
language: python
types: [file, yaml]
args: [--strict, -c=.github/yamllintrc]
- repo: https://github.com/aristanetworks/j2lint.git
rev: "742a25e"
hooks:
- id: j2lint
name: Check for Linting errors on Jinja2 files
- repo: local
hooks:
- id: docs-plugin-modules
name: Build documentation for collection modules and action plugins
entry: ansible-doc-extractor --template ansible_collections/arista/avd/docs/templates/plugin-docs.j2 --markdown "ansible_collections/arista/avd/docs/plugins/Modules_and_action_plugins/"
language: system
types: [python]
files: ansible_collections/arista/avd/plugins/modules/
- id: docs-plugin-filter
name: Build documentation for collection filter plugins
entry: ansible-doc-extractor --template ansible_collections/arista/avd/docs/templates/plugin-docs.j2 --markdown "ansible_collections/arista/avd/docs/plugins/Filter_plugins/"
language: system
types: [python]
files: ansible_collections/arista/avd/plugins/filter/
- id: docs-plugin-test
name: Build documentation for collection test plugins
entry: ansible-doc-extractor --template ansible_collections/arista/avd/docs/templates/plugin-docs.j2 --markdown "ansible_collections/arista/avd/docs/plugins/Test_plugins/"
language: system
types: [python]
files: ansible_collections/arista/avd/plugins/test/
- id: docs-plugin-vars
name: Build documentation for collection var plugins
entry: ansible-doc-extractor --template ansible_collections/arista/avd/docs/templates/plugin-docs.j2 --markdown "ansible_collections/arista/avd/docs/plugins/Vars_plugins/"
language: system
types: [python]
files: ansible_collections/arista/avd/plugins/vars/
- id: schemas
name: Build AVD Schemas and Docs
entry: sh -c 'exec python-avd/scripts/build-schemas.py'
language: system
files: ansible_collections/arista/avd/roles/[a-z_]+/schemas
pass_filenames: false
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.32.1
hooks:
- id: markdownlint
name: Check for Linting errors on MarkDown files
args:
- --config=.github/.markdownlint.yaml
- --ignore-path=.github/.markdownlintignore
- --fix