blob: 41f616732374d7c7a64b9f774e65325016652d61 [file] [log] [blame]
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -04001---
2
3# -----------------------------------------------------------------------
Joey Armstrongbd667e32024-04-10 16:54:11 -04004# [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# -----------------------------------------------------------------------
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040014# 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#
Joey Armstrongbd667e32024-04-10 16:54:11 -040020# http://www.apache.org/licenses/LICENSE-2.0
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040021#
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# -----------------------------------------------------------------------
Joey Armstrong6f046d02024-04-22 13:29:56 -040034# .pre-commit-config-yaml 2024-04-19 v0.4
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040035# -----------------------------------------------------------------------
36
Joey Armstrong6f046d02024-04-22 13:29:56 -040037#ci:
38# 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'
Joey Armstrongbd667e32024-04-10 16:54:11 -040045
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040046repos:
Joey Armstrongbd667e32024-04-10 16:54:11 -040047 - repo: https://github.com/pre-commit/pre-commit-hooks
Joey Armstrong6f046d02024-04-22 13:29:56 -040048# rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040049 rev: v4.5.0
50 hooks:
51 - id: trailing-whitespace
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040052 - id: check-added-large-files
Joey Armstrong6f046d02024-04-22 13:29:56 -040053 - id: check-ast
54 - id: check-json
55 - id: check-merge-conflict
56 - id: check-xml
57 - id: check-yaml
58# - id: debug-statements
59 - id: end-of-file-fixer
60 - id: fix-encoding-pragma
Joey Armstrongbd667e32024-04-10 16:54:11 -040061# - id: double-quote-string-fixer
Joey Armstrong6f046d02024-04-22 13:29:56 -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
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040070
Joey Armstrongbd667e32024-04-10 16:54:11 -040071 - repo: https://github.com/koalaman/shellcheck-precommit
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040072 rev: v0.10.0
73 hooks:
74 - id: shellcheck
75
Joey Armstrongbd667e32024-04-10 16:54:11 -040076 - repo: https://github.com/adrienverge/yamllint.git
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -040077 rev: v1.35.1
78 hooks:
79 - id: yamllint
80
81## -----------------------------------------------------------------------
Joey Armstrongbd667e32024-04-10 16:54:11 -040082## [SOURCE] Documentation
83## -----------------------------------------------------------------------
84 - 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
93# - id: markdownlint_docker
94
Joey Armstrongbd667e32024-04-10 16:54:11 -040095## -----------------------------------------------------------------------
96## [SOURCE] Docker
97## -----------------------------------------------------------------------
98 - repo: https://github.com/hadolint/hadolint
99 rev: v2.12.0
100 hooks:
101 - id: hadolint
102# - id: hadolint-docker
103
104## -----------------------------------------------------------------------
Joey Armstrong6f046d02024-04-22 13:29:56 -0400105## [SOURCE] Golang
106## -----------------------------------------------------------------------
107 - repo: https://github.com/golangci/golangci-lint
108 rev: v1.41.1
109 hooks:
110 - id: golangci-lint
111
112## -----------------------------------------------------------------------
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -0400113## [SOURCE] REUSE License Checking
114## -----------------------------------------------------------------------
Joey Armstrong6f046d02024-04-22 13:29:56 -0400115# - repo: https://github.com/fsfe/reuse-tool
116# rev: v3.0.2
117# hooks:
118# - id: reuse
119# - id: add-license-headers
120#
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -0400121# - repo: https://github.com/ansys/pre-commit-hooks
Joey Armstrongbd667e32024-04-10 16:54:11 -0400122# rev: v0.2.9
123# hooks:
124# - id: add-license-headers
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -0400125# args:
126# - --custom_copyright=custom copyright phrase
127# - --custom_template=template_name
128# - --custom_license=license_name
129# - --ignore_license_check
Joey Armstrongbd667e32024-04-10 16:54:11 -0400130# - --start_year=2023
131
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -0400132## -----------------------------------------------------------------------
133## [SOURCE] Python
134## -----------------------------------------------------------------------
Joey Armstrongbd667e32024-04-10 16:54:11 -0400135# - repo: https://github.com/psf/black
136# rev: 22.10.0
137# hooks:
138# - id: black
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -0400139
Joey Armstrongbd667e32024-04-10 16:54:11 -0400140# - repo: https://github.com/PyCQA/doc8
141# rev: v1.1.1
142# hooks:
143# - id: doc8
144
145## -----------------------------------------------------------------------
146## [SOURCE] Testing
147## -----------------------------------------------------------------------
148 - repo: https://github.com/MarketSquare/robotframework-tidy
149 rev: 4.11.0
150 hooks:
151 - id: robotidy
Joey Armstrongf2f0a3f2024-04-04 15:50:09 -0400152
153# -------------------------------------------------------------------
154# https://docs.python.org/3/library/re.html#regular-expression-syntax
155# -------------------------------------------------------------------
156exclude: |
157 (?x)^(
158 ^jjb/.* |
159 ^makefiles/.* |
160 ^lf/.* |
161 ^.venv/.* |
162 ^jenkins-scripts/.* |
163 ^lf-ansible/.* |
164 ^packer/.* |
165 ^test/.* |
166 ^jjb/pipeline/voltha/voltha-physical-soak-dt-tests.groovy
167 )$
168
169# [SEE ALSO]
170# -----------------------------------------------------------------------
171# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
172# https://pre-commit.com/hooks.html
173# https://github.com/floatingpurr/sync_with_poetry/blob/main/.pre-commit-config.yaml
174# https://github.com/the-common/pre-commit-config-template/blob/master/.pre-commit-config.yaml
175# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
176# -----------------------------------------------------------------------
177# https://www.hatica.io/blog/pre-commit-git-hooks/
178# -----------------------------------------------------------------------
179
180# [EOF]