blob: 6e55a3c676b78f16ccb703f36850707e2259eb5a [file] [log] [blame]
Joey Armstrong9886cc82024-04-04 11:34:51 -04001---
2
3# -----------------------------------------------------------------------
Joey Armstrong342430f2024-04-10 10:36:34 -04004# [NOTE] - Propogate .pre-commit-config.yaml edits to all repositories!
5# -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -04006# [NOTE] - Common config file source lives in repo:onf-make
7# - https://gerrit.opencord.org/plugins/gitiles/onf-make/
8# +/refs/heads/master/.pre-commit-config.yaml
9# -----------------------------------------------------------------------
Joey Armstrong342430f2024-04-10 10:36:34 -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# -----------------------------------------------------------------------
Joey Armstrong9886cc82024-04-04 11:34:51 -040018# 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#
Joey Armstrong342430f2024-04-10 10:36:34 -040024# http://www.apache.org/licenses/LICENSE-2.0
Joey Armstrong9886cc82024-04-04 11:34:51 -040025#
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 Armstrong252f7122024-04-26 12:38:13 -040038# .pre-commit-config-yaml 2024-04-19 v0.4
Joey Armstrong9886cc82024-04-04 11:34:51 -040039# -----------------------------------------------------------------------
40
Joey Armstrong342430f2024-04-10 10:36:34 -040041# ci:
Joey Armstrong252f7122024-04-26 12:38:13 -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'
Joey Armstrong342430f2024-04-10 10:36:34 -040049
Joey Armstrong9886cc82024-04-04 11:34:51 -040050repos:
Joey Armstrong342430f2024-04-10 10:36:34 -040051 - repo: https://github.com/pre-commit/pre-commit-hooks
Joey Armstrong252f7122024-04-26 12:38:13 -040052# rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
Joey Armstrong9886cc82024-04-04 11:34:51 -040053 rev: v4.5.0
54 hooks:
55 - id: trailing-whitespace
Joey Armstrong9886cc82024-04-04 11:34:51 -040056 - id: check-added-large-files
Joey Armstrong252f7122024-04-26 12:38:13 -040057 - id: check-ast
58 - id: check-json
59 - id: check-merge-conflict
60 - id: check-xml
61 - id: check-yaml
62# - id: debug-statements
63 - id: end-of-file-fixer
64 - id: fix-encoding-pragma
65# - id: double-quote-string-fixer
66 - id: requirements-txt-fixer
67 - id: mixed-line-ending
68 args: ['--fix=lf']
69
70 - repo: https://github.com/jorisroovers/gitlint
71 rev: acc9d9de6369b76d22cb4167029d2035e8730b98 # frozen: v0.19.1
72 hooks:
73 - id: gitlint
Joey Armstrong342430f2024-04-10 10:36:34 -040074
75 - repo: https://github.com/koalaman/shellcheck-precommit
Joey Armstrong9886cc82024-04-04 11:34:51 -040076 rev: v0.10.0
77 hooks:
78 - id: shellcheck
Joey Armstrong342430f2024-04-10 10:36:34 -040079
80 - repo: https://github.com/adrienverge/yamllint.git
Joey Armstrong9886cc82024-04-04 11:34:51 -040081 rev: v1.35.1
82 hooks:
83 - id: yamllint
84
85## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -040086## [SOURCE] Documentation
87## -----------------------------------------------------------------------
88 - repo: https://github.com/rstcheck/rstcheck
89 rev: v6.2.1
90 hooks:
91 - id: rstcheck
92
93 - repo: https://github.com/markdownlint/markdownlint
94 rev: v0.13.0
95 hooks:
96 - id: markdownlint
97# - id: markdownlint_docker
98
99## -----------------------------------------------------------------------
100## [SOURCE] Docker
101## -----------------------------------------------------------------------
102 - repo: https://github.com/hadolint/hadolint
103 rev: v2.12.0
104 hooks:
105 - id: hadolint
106# - id: hadolint-docker
107
108## -----------------------------------------------------------------------
109## [SOURCE] Golang
110## -----------------------------------------------------------------------
111 - repo: https://github.com/golangci/golangci-lint
112 rev: v1.41.1
113 hooks:
114 - id: golangci-lint
115
116## -----------------------------------------------------------------------
Joey Armstrong342430f2024-04-10 10:36:34 -0400117## [SOURCE] REUSE License Checking
118## -----------------------------------------------------------------------
Joey Armstrong42c2a642024-04-18 15:44:43 -0400119# - repo: https://github.com/fsfe/reuse-tool
120# rev: v3.0.2
121# hooks:
122# - id: reuse
Joey Armstrong342430f2024-04-10 10:36:34 -0400123# - id: add-license-headers
Joey Armstrong252f7122024-04-26 12:38:13 -0400124#
125# - repo: https://github.com/ansys/pre-commit-hooks
126# rev: v0.2.9
127# hooks:
128# - id: add-license-headers
Joey Armstrong342430f2024-04-10 10:36:34 -0400129# args:
130# - --custom_copyright=custom copyright phrase
131# - --custom_template=template_name
132# - --custom_license=license_name
133# - --ignore_license_check
134# - --start_year=2023
135
136## -----------------------------------------------------------------------
Joey Armstrong9886cc82024-04-04 11:34:51 -0400137## [SOURCE] Python
138## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400139 - repo: https://github.com/psf/black
140 rev: 22.10.0
141 hooks:
142 - id: black
Joey Armstrong9886cc82024-04-04 11:34:51 -0400143
Joey Armstrong42c2a642024-04-18 15:44:43 -0400144 - repo: https://github.com/PyCQA/doc8
145 rev: v1.1.1
146 hooks:
147 - id: doc8
148
Joey Armstrong252f7122024-04-26 12:38:13 -0400149## -----------------------------------------------------------------------
150## [SOURCE] Testing
151## -----------------------------------------------------------------------
152 - repo: https://github.com/MarketSquare/robotframework-tidy
153 rev: 4.11.0
Joey Armstrong42c2a642024-04-18 15:44:43 -0400154 hooks:
Joey Armstrong252f7122024-04-26 12:38:13 -0400155 - id: robotidy
Joey Armstrong342430f2024-04-10 10:36:34 -0400156
Joey Armstrong9886cc82024-04-04 11:34:51 -0400157# -------------------------------------------------------------------
158# https://docs.python.org/3/library/re.html#regular-expression-syntax
159# -------------------------------------------------------------------
160exclude: |
161 (?x)^(
Joey Armstrong9886cc82024-04-04 11:34:51 -0400162 ^makefiles/.* |
163 ^lf/.* |
164 ^.venv/.* |
Joey Armstrong342430f2024-04-10 10:36:34 -0400165 ^test/.* |
Joey Armstrong252f7122024-04-26 12:38:13 -0400166 ^\[END-OF-EXCLUDE\]
Joey Armstrong9886cc82024-04-04 11:34:51 -0400167 )$
168
169# [SEE ALSO]
170# -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400171# 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# -----------------------------------------------------------------------
Joey Armstrong9886cc82024-04-04 11:34:51 -0400179
180# [EOF]