-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
136 lines (122 loc) · 3.75 KB
/
.pre-commit-config.yaml
File metadata and controls
136 lines (122 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# SPDX-FileCopyrightText: Copyright (C) 2022 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
exclude: |
(?x)(
^(
\.vscode/launch\.json
|manage\.py
|opal/static/thirdparty/.*/.*
)
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-json
- id: check-toml
- id: check-yaml
args: ['--unsafe']
- id: name-tests-test
args: ['--django']
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.7
hooks:
- id: uv-lock
# https://docs.astral.sh/ruff/integrations/#pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.10
hooks:
# Run the linter with fixes
- id: ruff
args: [--fix]
# Run the formatter
- id: ruff-format
- repo: https://github.com/executablebooks/mdformat
rev: 1.0.0
hooks:
- id: mdformat
args: [--number]
language: python
additional_dependencies:
- mdformat-mkdocs==5.1.4
- mdformat-front-matters==2.0.0
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.22.0
hooks:
- id: markdownlint-cli2
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.30.0
hooks:
- id: django-upgrade
- repo: https://github.com/fsfe/reuse-tool
rev: v6.2.0
hooks:
- id: reuse-lint-file
- repo: https://github.com/crate-ci/typos
rev: v1.45.1
hooks:
- id: typos
# use local virtual env for flake8 and mypy to reuse the same configuration (and dependencies)
- repo: local
hooks:
- id: no-auto-migrations
name: no auto-named migrations
entry: please provide a descriptive name for migrations
language: fail
files: .*/migrations/.*_auto_.*\.py$
- id: check-form-novalidate
name: check form for novalidate attribute
description: 'Enforce that HTML forms have the novalidate attribute to disable browser validation and force Django form validation'
language: pygrep
types: [html]
exclude: |
(?x)(
opal/questionnaires/templates/questionnaires/export_reports/reports-filter.html
)
# derived from this answer: https://stackoverflow.com/a/17204198
entry: |
<form(?=\s|>)(?!(?:[^>=]|=(['"])(?:(?!\1).)*\1)*?\snovalidate)[^>]*>
- id: mypy
name: mypy
description: static type checking
entry: mypy
language: python
types: [python]
# zizmor detects security vulnerabilities in GitHub Actions workflows.
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.24.1
hooks:
- id: zizmor
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.1
hooks:
- id: check-github-workflows
args: ["--verbose"]
- id: check-compose-spec
args: ["--verbose"]
- id: check-renovate
args: ["--verbose"]
additional_dependencies: ['json5']
# `actionlint` hook, for verifying correct syntax in GitHub Actions workflows.
# Some additional configuration for `actionlint` can be found in `.github/actionlint.yaml`.
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
language: golang
additional_dependencies:
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions
# and checks these with shellcheck.
# see also: https://github.com/rhysd/actionlint/pull/482
- "github.com/wasilibs/go-shellcheck/cmd/[email protected]"