blob: a4c8ef039b872e38264066be4875c82d35effd37 [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
Joey Armstrong9f7c57c2024-05-03 18:29:30 -04007# - https://gerrit.opencord.org/plugins/gitiles/
8# onf-make/+/refs/heads/master/.pre-commit-config.yaml
Joey Armstrong252f7122024-04-26 12:38:13 -04009# -----------------------------------------------------------------------
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 Armstrong9f7c57c2024-05-03 18:29:30 -040038# .pre-commit-config-yaml v0.5
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 Armstrong9886cc82024-04-04 11:34:51 -040052 rev: v4.5.0
53 hooks:
54 - id: trailing-whitespace
Joey Armstrong9886cc82024-04-04 11:34:51 -040055 - id: check-added-large-files
Joey Armstrong252f7122024-04-26 12:38:13 -040056 - id: check-ast
57 - id: check-json
58 - id: check-merge-conflict
59 - id: check-xml
60 - id: check-yaml
Joey Armstrong9f7c57c2024-05-03 18:29:30 -040061 # - id: debug-statements
Joey Armstrong252f7122024-04-26 12:38:13 -040062 - id: end-of-file-fixer
63 - id: fix-encoding-pragma
Joey Armstrong9f7c57c2024-05-03 18:29:30 -040064 # - id: double-quote-string-fixer
Joey Armstrong252f7122024-04-26 12:38:13 -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
Joey Armstrong342430f2024-04-10 10:36:34 -040073
74 - repo: https://github.com/koalaman/shellcheck-precommit
Joey Armstrong9886cc82024-04-04 11:34:51 -040075 rev: v0.10.0
76 hooks:
77 - id: shellcheck
Joey Armstrong342430f2024-04-10 10:36:34 -040078
79 - repo: https://github.com/adrienverge/yamllint.git
Joey Armstrong9886cc82024-04-04 11:34:51 -040080 rev: v1.35.1
81 hooks:
82 - id: yamllint
83
Joey Armstrong9f7c57c2024-05-03 18:29:30 -040084 ## -----------------------------------------------------------------------
85 ## [SOURCE] Documentation
86 ## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -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 Armstrong9f7c57c2024-05-03 18:29:30 -040096 # - id: markdownlint_docker
Joey Armstrong252f7122024-04-26 12:38:13 -040097
Joey Armstrong9f7c57c2024-05-03 18:29:30 -040098 ## -----------------------------------------------------------------------
99 ## [SOURCE] Docker
100 ## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400101 - repo: https://github.com/hadolint/hadolint
102 rev: v2.12.0
103 hooks:
Joey Armstrong9f7c57c2024-05-03 18:29:30 -0400104 # - id: hadolint # local tool install
105 - id: hadolint-docker
Joey Armstrong252f7122024-04-26 12:38:13 -0400106
Joey Armstrong9f7c57c2024-05-03 18:29:30 -0400107 ## -----------------------------------------------------------------------
108 ## [SOURCE] Golang
109 ## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400110 - repo: https://github.com/golangci/golangci-lint
111 rev: v1.41.1
112 hooks:
113 - id: golangci-lint
114
Joey Armstrong9f7c57c2024-05-03 18:29:30 -0400115 ## -----------------------------------------------------------------------
116 ## [SOURCE] REUSE License Checking
117 ## -----------------------------------------------------------------------
118 # - repo: https://github.com/fsfe/reuse-tool
119 # rev: v3.0.2
120 # hooks:
121 # - id: reuse
122 # - id: add-license-headers
Joey Armstrong342430f2024-04-10 10:36:34 -0400123
Joey Armstrong9f7c57c2024-05-03 18:29:30 -0400124# - repo: https://github.com/ansys/pre-commit-hooks
125 # rev: v0.2.9
126 # hooks:
127 # - id: add-license-headers
128 # args:
129 # - --custom_copyright=custom copyright phrase
130 # - --custom_template=template_name
131 # - --custom_license=license_name
132 # - --ignore_license_check
133 # - --start_year=2023
134
135 ## -----------------------------------------------------------------------
136 ## [SOURCE] Python
137 ## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400138 - repo: https://github.com/psf/black
139 rev: 22.10.0
140 hooks:
141 - id: black
Joey Armstrong9886cc82024-04-04 11:34:51 -0400142
Joey Armstrong9f7c57c2024-05-03 18:29:30 -0400143# - repo: https://github.com/PyCQA/doc8
144 # rev: v1.1.1
145 # hooks:
146 # - id: doc8
Joey Armstrong42c2a642024-04-18 15:44:43 -0400147
Joey Armstrong9f7c57c2024-05-03 18:29:30 -0400148 ## -----------------------------------------------------------------------
149 ## [SOURCE] Spelling
150 ## -----------------------------------------------------------------------
151 - repo: https://github.com/codespell-project/codespell
152 rev: v2.2.4
153 hooks:
154 - id: codespell
155
156 ## -----------------------------------------------------------------------
157 ## [SOURCE] Testing
158 ## -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400159 - repo: https://github.com/MarketSquare/robotframework-tidy
160 rev: 4.11.0
Joey Armstrong42c2a642024-04-18 15:44:43 -0400161 hooks:
Joey Armstrong252f7122024-04-26 12:38:13 -0400162 - id: robotidy
Joey Armstrong342430f2024-04-10 10:36:34 -0400163
Joey Armstrong9886cc82024-04-04 11:34:51 -0400164# -------------------------------------------------------------------
165# https://docs.python.org/3/library/re.html#regular-expression-syntax
166# -------------------------------------------------------------------
167exclude: |
168 (?x)^(
Joey Armstrong9886cc82024-04-04 11:34:51 -0400169 ^makefiles/.* |
170 ^lf/.* |
171 ^.venv/.* |
Joey Armstrong252f7122024-04-26 12:38:13 -0400172 ^\[END-OF-EXCLUDE\]
Joey Armstrong9886cc82024-04-04 11:34:51 -0400173 )$
174
175# [SEE ALSO]
176# -----------------------------------------------------------------------
Joey Armstrong252f7122024-04-26 12:38:13 -0400177# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
178# https://pre-commit.com/hooks.html
179# https://github.com/floatingpurr/sync_with_poetry/blob/main/.pre-commit-config.yaml
180# https://github.com/the-common/pre-commit-config-template/blob/master/.pre-commit-config.yaml
181# https://github.com/memfault/interrupt/blob/master/example/pre-commit/.pre-commit-config.yaml
182# -----------------------------------------------------------------------
183# https://www.hatica.io/blog/pre-commit-git-hooks/
184# -----------------------------------------------------------------------
Joey Armstrong9886cc82024-04-04 11:34:51 -0400185
186# [EOF]