blob: 3accce77ca3a84155d05f6c18de5ccf7751b3dc3 [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# -----------------------------------------------------------------------
6# [TODO]
7# - pre-commit yaml config exists individually within repositories.
8# - Generally lint config and benavior is consistent for all repos.
9# - Exclusions and bulk cleanup necessitate per-repo custom configs.
10# - Dynamically generate this config file from common and custom
11# -----------------------------------------------------------------------
12
13# -----------------------------------------------------------------------
14# Copyright 2024 Open Networking Foundation Contributors
15#
16# Licensed under the Apache License, Version 2.0 (the "License");
17# you may not use this file except in compliance with the License.
18# You may obtain a copy of the License at
19#
20# http://www.apache.org/licenses/LICENSE-2.0
21#
22# Unless required by applicable law or agreed to in writing, software
23# distributed under the License is distributed on an "AS IS" BASIS,
24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25# See the License for the specific language governing permissions and
26# limitations under the License.
27# -----------------------------------------------------------------------
28# SPDX-FileCopyrightText: 2024 Open Networking Foundation Contributors
29# SPDX-License-Identifier: Apache-2.0
30# -----------------------------------------------------------------------
31# See https://pre-commit.com for more information
32# See https://pre-commit.com/hooks.html for more hooks
33# -----------------------------------------------------------------------
Eric Ballf1055a92024-09-05 11:01:28 -070034# .pre-commit-config-yaml 2024-04-19 v0.4
Joey Armstrong6a6c6292024-04-30 16:07:38 -040035# -----------------------------------------------------------------------
36
Eric Ballf1055a92024-09-05 11:01:28 -070037#ci:
Joey Armstrong6a6c6292024-04-30 16:07:38 -040038# autofix_commit_msg: "Chore: pre-commit autoupdate"
39## skip: [sync]
40# skip:
41# # pre-commit.ci does not have actionlint installed
42# - actionlint
43#
44# exclude: '^docs/conf.py'
45
46repos:
47 - repo: https://github.com/pre-commit/pre-commit-hooks
Eric Ballf1055a92024-09-05 11:01:28 -070048# rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
Joey Armstrong6a6c6292024-04-30 16:07:38 -040049 rev: v4.5.0
50 hooks:
51 - id: trailing-whitespace
52 - id: check-added-large-files
53 - id: check-ast
54 - id: check-json
55 - id: check-merge-conflict
56 - id: check-xml
57 - id: check-yaml
Eric Ballf1055a92024-09-05 11:01:28 -070058# - id: debug-statements
Joey Armstrong6a6c6292024-04-30 16:07:38 -040059 - id: end-of-file-fixer
60 - id: fix-encoding-pragma
Eric Ballf1055a92024-09-05 11:01:28 -070061# - id: double-quote-string-fixer
Joey Armstrong6a6c6292024-04-30 16:07:38 -040062 - id: requirements-txt-fixer
63 - id: mixed-line-ending
64 args: ['--fix=lf']
65
66 - repo: https://github.com/jorisroovers/gitlint
67 rev: acc9d9de6369b76d22cb4167029d2035e8730b98 # frozen: v0.19.1
68 hooks:
69 - id: gitlint
70
71 - repo: https://github.com/koalaman/shellcheck-precommit
72 rev: v0.10.0
73 hooks:
74 - id: shellcheck
75
76 - repo: https://github.com/adrienverge/yamllint.git
77 rev: v1.35.1
78 hooks:
79 - id: yamllint
80
Eric Ballf1055a92024-09-05 11:01:28 -070081## -----------------------------------------------------------------------
82## [SOURCE] Documentation
83## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -040084 - repo: https://github.com/rstcheck/rstcheck
85 rev: v6.2.1
86 hooks:
87 - id: rstcheck
88
89 - repo: https://github.com/markdownlint/markdownlint
90 rev: v0.13.0
91 hooks:
92 - id: markdownlint
Eric Ballf1055a92024-09-05 11:01:28 -070093# - id: markdownlint_docker
Joey Armstrong6a6c6292024-04-30 16:07:38 -040094
Eric Ballf1055a92024-09-05 11:01:28 -070095## -----------------------------------------------------------------------
96## [SOURCE] Docker
97## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -040098 - repo: https://github.com/hadolint/hadolint
99 rev: v2.12.0
100 hooks:
Eric Ballf1055a92024-09-05 11:01:28 -0700101 - id: hadolint
102# - id: hadolint-docker
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400103
Eric Ballf1055a92024-09-05 11:01:28 -0700104## -----------------------------------------------------------------------
105## [SOURCE] Golang
106## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400107 - repo: https://github.com/golangci/golangci-lint
108 rev: v1.41.1
109 hooks:
110 - id: golangci-lint
111
Eric Ballf1055a92024-09-05 11:01:28 -0700112## -----------------------------------------------------------------------
113## [SOURCE] REUSE License Checking
114## -----------------------------------------------------------------------
115# - repo: https://github.com/fsfe/reuse-tool
116# rev: v3.0.2
117# hooks:
118# - id: reuse
119# - id: add-license-headers
120#
121# - repo: https://github.com/ansys/pre-commit-hooks
122# rev: v0.2.9
123# hooks:
124# - id: add-license-headers
125# args:
126# - --custom_copyright=custom copyright phrase
127# - --custom_template=template_name
128# - --custom_license=license_name
129# - --ignore_license_check
130# - --start_year=2023
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400131
Eric Ballf1055a92024-09-05 11:01:28 -0700132## -----------------------------------------------------------------------
133## [SOURCE] Python
134## -----------------------------------------------------------------------
135# - repo: https://github.com/psf/black
136# rev: 22.10.0
137# hooks:
138# - id: black
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400139
140# - repo: https://github.com/PyCQA/doc8
Eric Ballf1055a92024-09-05 11:01:28 -0700141# rev: v1.1.1
142# hooks:
143# - id: doc8
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400144
Eric Ballf1055a92024-09-05 11:01:28 -0700145## -----------------------------------------------------------------------
146## [SOURCE] Testing
147## -----------------------------------------------------------------------
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400148 - repo: https://github.com/MarketSquare/robotframework-tidy
149 rev: 4.11.0
150 hooks:
151 - id: robotidy
152
153# -------------------------------------------------------------------
154# https://docs.python.org/3/library/re.html#regular-expression-syntax
155# -------------------------------------------------------------------
156exclude: |
157 (?x)^(
Eric Ballf1055a92024-09-05 11:01:28 -0700158 ^makefiles/.* |
159 ^lf/.* |
160 ^.venv/.* |
Joey Armstrong6a6c6292024-04-30 16:07:38 -0400161 ^ignore-end-of-exclude-marker
162 )$
163
164# [SEE ALSO]
165# -----------------------------------------------------------------------
166# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
167# https://pre-commit.com/hooks.html
168# https://github.com/floatingpurr/sync_with_poetry/blob/main/.pre-commit-config.yaml
169# https://github.com/the-common/pre-commit-config-template/blob/master/.pre-commit-config.yaml
170# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
171# -----------------------------------------------------------------------
172# https://www.hatica.io/blog/pre-commit-git-hooks/
173# -----------------------------------------------------------------------
174
175# [EOF]