Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 1 | --- |
| 2 | |
| 3 | # ----------------------------------------------------------------------- |
| 4 | # [NOTE] - Propogate .pre-commit-config.yaml edits to all repositories! |
| 5 | # ----------------------------------------------------------------------- |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 6 | # [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 Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 10 | # [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 Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 38 | # .pre-commit-config-yaml v0.7 (2024-06-13) |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 39 | # ----------------------------------------------------------------------- |
| 40 | |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 41 | # ci: |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 42 | # 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 | |
| 50 | repos: |
| 51 | - repo: https://github.com/pre-commit/pre-commit-hooks |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 52 | 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 Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 61 | # - id: debug-statements |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 62 | - id: end-of-file-fixer |
| 63 | - id: fix-encoding-pragma |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 64 | # - id: double-quote-string-fixer |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 65 | - 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 Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 84 | ## ----------------------------------------------------------------------- |
| 85 | ## [SOURCE] Documentation |
| 86 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 87 | - 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 Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 96 | # - id: markdownlint_docker |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 97 | |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 98 | ## ----------------------------------------------------------------------- |
| 99 | ## [SOURCE] Docker |
| 100 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 101 | - repo: https://github.com/hadolint/hadolint |
| 102 | rev: v2.12.0 |
| 103 | hooks: |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 104 | # - id: hadolint # local tool install |
| 105 | - id: hadolint-docker |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 106 | |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 107 | ## ----------------------------------------------------------------------- |
| 108 | ## [SOURCE] Golang |
| 109 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 110 | - repo: https://github.com/golangci/golangci-lint |
| 111 | rev: v1.41.1 |
| 112 | hooks: |
| 113 | - id: golangci-lint |
| 114 | |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 115 | ## ----------------------------------------------------------------------- |
| 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 Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 124 | |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 125 | - 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 Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 143 | |
| 144 | # - repo: https://github.com/PyCQA/doc8 |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 145 | # rev: v1.1.1 |
| 146 | # hooks: |
| 147 | # - id: doc8 |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 148 | |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 149 | ## ----------------------------------------------------------------------- |
| 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 Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 160 | - 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 Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 167 | # 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 Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 175 | # ------------------------------------------------------------------- |
| 176 | exclude: | |
| 177 | (?x)^( |
Joey Armstrong | c8d7063 | 2024-06-27 15:25:38 -0400 | [diff] [blame] | 178 | ^VERSION | |
| 179 | ^makefiles/.* | |
| 180 | ^lf/.* | |
| 181 | ^.venv/.* | |
| 182 | ^.vendor/.* | |
| 183 | ^______FIX_BELOW_______ | |
| 184 | ^vendor/ | |
Joey Armstrong | 6a6c629 | 2024-04-30 16:07:38 -0400 | [diff] [blame] | 185 | ^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] |