blob: ee6a665baf3985f8394986a8c82eb529372d6a47 [file] [log] [blame]
Joey Armstrong6a6c6292024-04-30 16:07:38 -04001---
2
3# -----------------------------------------------------------------------
4# [NOTE] - Propogate .pre-commit-config.yaml edits to all repositories!
5# -----------------------------------------------------------------------
Joey Armstrongc8d70632024-06-27 15:25:38 -04006# [NOTE] - Common config file source lives in repo:onf-make
7# - https://gerrit.opencord.org/plugins/gitiles/
8# onf-make/+/refs/heads/master/.pre-commit-config.yaml
9# -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -040010# [TODO]
11# - pre-commit yaml config exists individually within repositories.
12# - Generally lint config and benavior is consistent for all repos.
13# - Exclusions and bulk cleanup necessitate per-repo custom configs.
14# - Dynamically generate this config file from common and custom
15# -----------------------------------------------------------------------
16
17# -----------------------------------------------------------------------
18# Copyright 2024 Open Networking Foundation Contributors
19#
20# Licensed under the Apache License, Version 2.0 (the "License");
21# you may not use this file except in compliance with the License.
22# You may obtain a copy of the License at
23#
24# http://www.apache.org/licenses/LICENSE-2.0
25#
26# Unless required by applicable law or agreed to in writing, software
27# distributed under the License is distributed on an "AS IS" BASIS,
28# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29# See the License for the specific language governing permissions and
30# limitations under the License.
31# -----------------------------------------------------------------------
32# SPDX-FileCopyrightText: 2024 Open Networking Foundation Contributors
33# SPDX-License-Identifier: Apache-2.0
34# -----------------------------------------------------------------------
35# See https://pre-commit.com for more information
36# See https://pre-commit.com/hooks.html for more hooks
37# -----------------------------------------------------------------------
Joey Armstrongc8d70632024-06-27 15:25:38 -040038# .pre-commit-config-yaml v0.7 (2024-06-13)
Joey Armstrong6a6c6292024-04-30 16:07:38 -040039# -----------------------------------------------------------------------
40
Joey Armstrongc8d70632024-06-27 15:25:38 -040041# ci:
Joey Armstrong6a6c6292024-04-30 16:07:38 -040042# autofix_commit_msg: "Chore: pre-commit autoupdate"
43## skip: [sync]
44# skip:
45# # pre-commit.ci does not have actionlint installed
46# - actionlint
47#
48# exclude: '^docs/conf.py'
49
50repos:
51 - repo: https://github.com/pre-commit/pre-commit-hooks
Joey Armstrong6a6c6292024-04-30 16:07:38 -040052 rev: v4.5.0
53 hooks:
54 - id: trailing-whitespace
55 - id: check-added-large-files
56 - id: check-ast
57 - id: check-json
58 - id: check-merge-conflict
59 - id: check-xml
60 - id: check-yaml
Joey Armstrongc8d70632024-06-27 15:25:38 -040061 # - id: debug-statements
Joey Armstrong6a6c6292024-04-30 16:07:38 -040062 - id: end-of-file-fixer
63 - id: fix-encoding-pragma
Joey Armstrongc8d70632024-06-27 15:25:38 -040064 # - id: double-quote-string-fixer
Joey Armstrong6a6c6292024-04-30 16:07:38 -040065 - id: requirements-txt-fixer
66 - id: mixed-line-ending
67 args: ['--fix=lf']
68
69 - repo: https://github.com/jorisroovers/gitlint
70 rev: acc9d9de6369b76d22cb4167029d2035e8730b98 # frozen: v0.19.1
71 hooks:
72 - id: gitlint
73
74 - repo: https://github.com/koalaman/shellcheck-precommit
75 rev: v0.10.0
76 hooks:
77 - id: shellcheck
78
79 - repo: https://github.com/adrienverge/yamllint.git
80 rev: v1.35.1
81 hooks:
82 - id: yamllint
83
Joey Armstrongc8d70632024-06-27 15:25:38 -040084 ## -----------------------------------------------------------------------
85 ## [SOURCE] Documentation
86 ## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -040087 - repo: https://github.com/rstcheck/rstcheck
88 rev: v6.2.1
89 hooks:
90 - id: rstcheck
91
92 - repo: https://github.com/markdownlint/markdownlint
93 rev: v0.13.0
94 hooks:
95 - id: markdownlint
Joey Armstrongc8d70632024-06-27 15:25:38 -040096 # - id: markdownlint_docker
Joey Armstrong6a6c6292024-04-30 16:07:38 -040097
Joey Armstrongc8d70632024-06-27 15:25:38 -040098 ## -----------------------------------------------------------------------
99 ## [SOURCE] Docker
100 ## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400101 - repo: https://github.com/hadolint/hadolint
102 rev: v2.12.0
103 hooks:
Joey Armstrongc8d70632024-06-27 15:25:38 -0400104 # - id: hadolint # local tool install
105 - id: hadolint-docker
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400106
Joey Armstrongc8d70632024-06-27 15:25:38 -0400107 ## -----------------------------------------------------------------------
108 ## [SOURCE] Golang
109 ## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400110 - repo: https://github.com/golangci/golangci-lint
111 rev: v1.41.1
112 hooks:
113 - id: golangci-lint
114
Joey Armstrongc8d70632024-06-27 15:25:38 -0400115 ## -----------------------------------------------------------------------
116 ## [SOURCE] REUSE License Checking
117 ## -----------------------------------------------------------------------
118 ## tox -e [style,py,py-coverage,doc]
119 ## -----------------------------------------------------------------------
120 - repo: https://github.com/fsfe/reuse-tool
121 rev: v3.0.2
122 hooks:
123 - id: reuse
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400124
Joey Armstrongc8d70632024-06-27 15:25:38 -0400125 - repo: https://github.com/ansys/pre-commit-hooks
126 rev: v0.2.9
127 hooks:
128 - id: add-license-headers
129 args:
130 - --custom_copyright=Open Networking Foundation Contributors
131 - --custom_template=open_networking_foundation
132 - --custom_license=Apache-2.0
133 # - --ignore_license_check
134 - --start_year=2019
135
136 ## -----------------------------------------------------------------------
137 ## [SOURCE] Python
138 ## -----------------------------------------------------------------------
139 - repo: https://github.com/psf/black
140 rev: 22.10.0
141 hooks:
142 - id: black
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400143
144# - repo: https://github.com/PyCQA/doc8
Joey Armstrongc8d70632024-06-27 15:25:38 -0400145 # rev: v1.1.1
146 # hooks:
147 # - id: doc8
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400148
Joey Armstrongc8d70632024-06-27 15:25:38 -0400149 ## -----------------------------------------------------------------------
150 ## [SOURCE] Spelling
151 ## -----------------------------------------------------------------------
152 - repo: https://github.com/codespell-project/codespell
153 rev: v2.2.4
154 hooks:
155 - id: codespell
156
157 ## -----------------------------------------------------------------------
158 ## [SOURCE] Testing
159 ## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400160 - repo: https://github.com/MarketSquare/robotframework-tidy
161 rev: 4.11.0
162 hooks:
163 - id: robotidy
164
165# -------------------------------------------------------------------
166# https://docs.python.org/3/library/re.html#regular-expression-syntax
Joey Armstrongc8d70632024-06-27 15:25:38 -0400167# https://pre-commit.com/#top_level-exclude
168# -------------------------------------------------------------------
169# [TODO] add file patterns per-repository:
170# .gitignore: *~ *\#*
171# -------------------------------------------------------------------
172# [TODO]
173# o Remove vendor/ post copyright cleanup
174# o https://pre-commit.com/#filtering-files-with-types
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400175# -------------------------------------------------------------------
176exclude: |
177 (?x)^(
Joey Armstrongc8d70632024-06-27 15:25:38 -0400178 ^VERSION |
179 ^makefiles/.* |
180 ^lf/.* |
181 ^.venv/.* |
182 ^.vendor/.* |
183 ^______FIX_BELOW_______ |
184 ^vendor/ |
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400185 ^ignore-end-of-exclude-marker
186 )$
187
188# [SEE ALSO]
189# -----------------------------------------------------------------------
190# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
191# https://pre-commit.com/hooks.html
192# https://github.com/floatingpurr/sync_with_poetry/blob/main/.pre-commit-config.yaml
193# https://github.com/the-common/pre-commit-config-template/blob/master/.pre-commit-config.yaml
194# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
195# -----------------------------------------------------------------------
196# https://www.hatica.io/blog/pre-commit-git-hooks/
197# -----------------------------------------------------------------------
198
199# [EOF]