Chore: Update workflows and linting
[releng/python-one-password.git] / .pre-commit-config.yaml
1 ---
2 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
7     # - pre-commit-update
8
9 exclude: |
10   (?x)^(
11       docs\/conf.py|
12       dco-signoffs/$
13   )$
14
15 repos:
16
17   # - repo: https://gitlab.com/vojko.pribudic/pre-commit-update
18   #   rev: v0.1.0
19   #   hooks:
20   #     - id: pre-commit-update
21   #       args: [--dry-run]
22
23   - repo: local
24     hooks:
25       - id: tomllint
26         name: "Script: scripts/tomllint.sh"
27         language: script
28         # pass_filenames: false
29         files: \^*.toml
30         types: [file]
31         entry: scripts/tomllint.sh .
32
33   - repo: https://github.com/pre-commit/pre-commit-hooks
34     rev: v4.5.0
35     hooks:
36       - id: check-added-large-files
37       - id: check-ast
38       - id: check-case-conflict
39       - id: check-executables-have-shebangs
40       - id: check-json
41       - id: check-merge-conflict
42       - id: check-shebang-scripts-are-executable
43       - id: check-symlinks
44       - id: check-toml
45       # - id: detect-aws-credentials
46       - id: check-xml
47       - id: check-yaml
48       - id: debug-statements
49       - id: detect-private-key
50       - id: end-of-file-fixer
51       - id: mixed-line-ending
52         args: ["--fix=lf"]
53       - id: name-tests-test
54       # Do not allow direct push to main/master branches
55       - id: no-commit-to-branch
56       # - id: pretty-format-json
57       - id: requirements-txt-fixer
58       - id: trailing-whitespace
59
60   # Autoformat: YAML, JSON, Markdown, etc.
61   - repo: https://github.com/pre-commit/mirrors-prettier
62     rev: v4.0.0-alpha.8
63     hooks:
64       - id: prettier
65         args:
66           ["--ignore-unknown", "--no-error-on-unmatched-pattern",
67            --log-level=debug]
68
69   # Lint: Markdown
70   - repo: https://github.com/igorshubovych/markdownlint-cli
71     rev: v0.38.0
72     hooks:
73       - id: markdownlint
74         args: ["--fix"]
75
76   # - repo: https://github.com/asottile/pyupgrade
77   #   rev: v3.15.0
78   #   hooks:
79   #     - id: pyupgrade
80   #       args: ['--py37-plus']
81
82   - repo: https://github.com/psf/black-pre-commit-mirror
83     rev: 23.12.0
84     hooks:
85       - id: black
86
87   - repo: https://github.com/psf/black-pre-commit-mirror
88     rev: 23.12.0
89     hooks:
90       - id: black-jupyter
91
92   - repo: https://github.com/jorisroovers/gitlint
93     rev: v0.19.1
94     hooks:
95       - id: gitlint
96
97   - repo: https://github.com/openstack/bashate
98     rev: 2.1.1
99     hooks:
100       - id: bashate
101         args: ["--ignore=E006"]
102
103   - repo: https://github.com/shellcheck-py/shellcheck-py
104     rev: v0.9.0.6
105     hooks:
106       - id: shellcheck
107       # Optionally only show errors and warnings
108       # args: ["--severity=warning"]
109
110   # If you want to avoid flake8 errors due to unused vars or imports:
111   # - repo: https://github.com/PyCQA/autoflake
112   #   rev: v2.0.0
113   #   hooks:
114   #   - id: autoflake
115   #     args: [
116   #       --in-place,
117   #       --remove-all-unused-imports,
118   #       --remove-unused-variables,
119   #     ]
120
121   - repo: https://github.com/PyCQA/isort
122     rev: 5.13.2
123     hooks:
124       - id: isort
125
126   - repo: https://github.com/adrienverge/yamllint.git
127     rev: v1.33.0
128     hooks:
129       - id: yamllint
130         args: [--strict]
131
132   - repo: https://github.com/Mateusz-Grzelinski/actionlint-py
133     rev: v1.6.26.11
134     hooks:
135       - id: actionlint
136
137   # If like to embrace black styles even in the docs:
138   # - repo: https://github.com/asottile/blacken-docs
139   #   rev: v1.13.0
140   #   hooks:
141   #   - id: blacken-docs
142   #     additional_dependencies: [black]
143
144   - repo: https://github.com/pycqa/flake8
145     rev: "6.1.0"
146     hooks:
147       - id: flake8
148         entry: pflake8
149         additional_dependencies: [pyproject-flake8]
150
151   # Check for misspells in documentation files:
152   # - repo: https://github.com/codespell-project/codespell
153   #   rev: v2.2.2
154   #   hooks:
155   #   - id: codespell
156
157   - repo: local
158     hooks:
159       - id: mypy-with-deps
160         name: "mypy-with-dependecies"
161         language: script
162         pass_filenames: false
163         types: [file]
164         entry: scripts/mypy-deps.sh
165
166   # - repo: https://github.com/pre-commit/mirrors-mypy
167   #   rev: "v1.7.1"
168   #   hooks:
169   #     - id: mypy
170   #       verbose: true
171   #       args: [--show-error-codes]
172   #       additional_dependencies: ["types-requests"]