Skip to content

Commit a6a9a3f

Browse files
Chore: Update linting configuration from osc-github-devops
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
1 parent 448c860 commit a6a9a3f

1 file changed

Lines changed: 68 additions & 32 deletions

File tree

.pre-commit-config.yaml

Lines changed: 68 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2+
# SPDX-License-Identifier: Apache-2.0
3+
# SPDX-FileCopyrightText: 2024 The Linux Foundation
4+
25
ci:
3-
autofix_commit_msg: "Chore: pre-commit autoupdate"
4-
skip:
5-
# pre-commit.ci cannot install WGET, so tomlint must be disabled
6-
- tomllint
6+
autofix_commit_msg: "Chore: pre-commit.ci automated update"
77

88
exclude: |
99
(?x)^(
@@ -12,56 +12,64 @@ exclude: |
1212
)$
1313
1414
repos:
15-
16-
- repo: local
17-
hooks:
18-
- id: tomllint
19-
name: "Script: scripts/tomllint.sh"
20-
language: script
21-
# pass_filenames: false
22-
files: \^*.toml
23-
types: [file]
24-
entry: scripts/tomllint.sh .
25-
2615
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v4.6.0
16+
rev: v5.0.0
2817
hooks:
2918
- id: check-added-large-files
19+
- id: check-ast
20+
- id: check-builtin-literals
3021
- id: check-case-conflict
22+
- id: check-docstring-first
3123
- id: check-executables-have-shebangs
24+
- id: check-illegal-windows-names
3225
- id: check-json
3326
- id: check-merge-conflict
3427
- id: check-shebang-scripts-are-executable
3528
- id: check-symlinks
3629
- id: check-toml
37-
# - id: detect-aws-credentials
30+
- id: check-vcs-permalinks
3831
- id: check-xml
3932
- id: check-yaml
4033
- id: debug-statements
34+
- id: destroyed-symlinks
35+
- id: detect-aws-credentials
36+
args: ["--allow-missing-credentials"]
37+
# - id: double-quote-string-fixer
4138
- id: detect-private-key
4239
- id: end-of-file-fixer
40+
- id: file-contents-sorter
41+
- id: fix-byte-order-marker
42+
- id: forbid-new-submodules
43+
- id: forbid-submodules
4344
- id: mixed-line-ending
4445
args: ["--fix=lf"]
4546
- id: name-tests-test
4647
args: ["--pytest-test-first"]
4748
- id: no-commit-to-branch
4849
# - id: pretty-format-json
4950
- id: requirements-txt-fixer
51+
- id: sort-simple-yaml
52+
# Without specifying files, the above is inactive
53+
# files: ^config/simple/
5054
- id: trailing-whitespace
5155

52-
# yamllint disable rule:comments-indentation
53-
## Commenting until issue #94 is fixed
54-
# - repo: https://github.com/igorshubovych/markdownlint-cli
55-
# rev: v0.41.0
56-
# hooks:
57-
# - id: markdownlint
58-
# args: ["--fix"]
59-
# yamllint enable rule:comments-indentation
56+
- repo: https://github.com/pre-commit/mirrors-prettier
57+
rev: v4.0.0-alpha.8
58+
hooks:
59+
- id: prettier
60+
args: ["--no-error-on-unmatched-pattern", "--ignore-unknown"]
61+
62+
- repo: https://github.com/igorshubovych/markdownlint-cli
63+
rev: v0.44.0
64+
hooks:
65+
- id: markdownlint
66+
args: ["--fix"]
6067

6168
- repo: https://github.com/jorisroovers/gitlint
6269
rev: v0.19.1
6370
hooks:
6471
- id: gitlint
72+
args: ["-c body-max-line-length=120", "-c title-max-length=120"]
6573

6674
- repo: https://github.com/openstack/bashate
6775
rev: 2.1.1
@@ -73,36 +81,65 @@ repos:
7381
rev: v0.10.0.1
7482
hooks:
7583
- id: shellcheck
84+
args: ["-x"] # Check external files
7685

7786
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
78-
rev: v1.7.1.15
87+
rev: v1.7.7.23
7988
hooks:
8089
- id: actionlint
8190

8291
- repo: https://github.com/adrienverge/yamllint.git
8392
rev: v1.35.1
8493
hooks:
8594
- id: yamllint
95+
types: [yaml]
8696
args:
87-
["-d", "{rules: {line-length: {max: 120}},
88-
ignore-from-file: [.gitignore],}"]
97+
[
98+
"-d",
99+
"{rules: {line-length: {max: 100}}, ignore-from-file: [.gitignore],}",
100+
]
89101

90102
- repo: https://github.com/astral-sh/ruff-pre-commit
91-
rev: v0.6.1
103+
rev: v0.9.9
92104
hooks:
93105
- id: ruff
94106
args: [--fix, --exit-non-zero-on-fix, --config=pyproject.toml]
95107
- id: ruff-format
96108

109+
- repo: local
110+
hooks:
111+
- id: mypy-cache
112+
name: "create mypy cache"
113+
language: system
114+
pass_filenames: false
115+
entry: bash -c 'if [ ! -d .mypy_cache ]; then /bin/mkdir .mypy_cache; fi; exit 0'
116+
117+
- repo: https://github.com/abravalheri/validate-pyproject
118+
rev: v0.23
119+
hooks:
120+
- id: validate-pyproject
121+
# Optional extra validations from SchemaStore:
122+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
123+
97124
- repo: https://github.com/pre-commit/mirrors-mypy
98-
rev: "v1.11.1"
125+
rev: "v1.15.0"
99126
hooks:
100127
- id: mypy
101128
verbose: true
102129
args: ["--show-error-codes", "--install-types", "--non-interactive"]
103130
additional_dependencies: ["pytest", "types-requests"]
104131

105-
# yamllint disable rule:comments-indentation
132+
# - repo: https://github.com/fsfe/reuse-tool
133+
# rev: v5.0.2
134+
# hooks:
135+
# - id: reuse
136+
137+
# - repo: https://github.com/btford/write-good
138+
# rev: ab66ce10136dfad5146e69e70f82a3efac8842c1 # frozen: v1.0.8
139+
# hooks:
140+
# - id: write-good
141+
# files: "\\.(rst|md|markdown|mdown|mkdn)$"
142+
106143
# Check for misspellings in documentation files
107144
# - repo: https://github.com/codespell-project/codespell
108145
# rev: v2.2.2
@@ -115,4 +152,3 @@ repos:
115152
# hooks:
116153
# - id: pyupgrade
117154
# args: ['--py37-plus']
118-
# yamllint enable rule:comments-indentation

0 commit comments

Comments
 (0)