forked from nvdaaddons/AddonTemplate
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathprek.toml
More file actions
139 lines (132 loc) · 3.63 KB
/
Copy pathprek.toml
File metadata and controls
139 lines (132 loc) · 3.63 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
137
138
139
# Configuration file for `prek`, a git hook framework written in Rust.
# See https://prek.j178.dev for more information.
#:schema https://www.schemastore.org/prek.json
default_language_version = { python = "python3.13" }
[[repos]]
repo = "meta"
hooks = [
# ensures that exclude directives apply to any file in the repository.
{ id = "check-useless-excludes" },
# ensures that the configured hooks apply to at least one file in the repository.
{ id = "check-hooks-apply" }
]
# Built-in hooks reimplemented in Rust by prek. No repo clone or environment setup required.
[[repos]]
repo = "builtin"
hooks = [
# Prevents commits to certain branches
{
id = "no-commit-to-branch",
args = [
"--branch",
"main",
"--branch",
"master"
]
},
# Checks that large files have not been added. Default cut-off for "large" files is 500kb.
{ id = "check-added-large-files" },
# Checks for filenames that will conflict on case insensitive filesystems (the majority of Windows filesystems, most of the time)
{ id = "check-case-conflict" },
# Checks for artifacts from resolving merge conflicts.
{ id = "check-merge-conflict" },
# Removes trailing whitespace.
{
id = "trailing-whitespace",
types_or = [
"python",
"c",
"c++",
"batch",
"markdown",
"toml",
"yaml",
"powershell"
]
},
# Ensures all files end in 1 (and only 1) newline.
{
id = "end-of-file-fixer",
types_or = [
"python",
"c",
"c++",
"batch",
"markdown",
"toml",
"yaml",
"powershell"
]
},
# Removes the UTF-8 BOM from files that have it.
# See https://github.com/nvaccess/nvda/blob/master/projectDocs/dev/codingStandards.md#encoding
{
id = "fix-byte-order-marker",
types_or = [
"python",
"c",
"c++",
"batch",
"markdown",
"toml",
"yaml",
"powershell"
]
},
# Validates TOML files.
{ id = "check-toml" },
# Validates YAML files.
{ id = "check-yaml" },
# Ensures that links to lines in files under version control point to a particular commit.
{ id = "check-vcs-permalinks" }
]
# These hooks use the upstream repo rather than prek's builtin equivalents:
# - check-ast and debug-statements have no builtin implementation.
# - The builtin check-illegal-windows-names only matches files that already have illegal names,
# so check-hooks-apply reports it as unused on a clean repo; the upstream hook checks all files.
[[repos]]
repo = "https://github.com/pre-commit/pre-commit-hooks"
rev = "v5.0.0"
hooks = [
# Checks python syntax
{ id = "check-ast" },
# Checks Python files for debug statements, such as python's breakpoint function, or those inserted by some IDEs.
{ id = "debug-statements" },
# Avoids using reserved Windows filenames.
{ id = "check-illegal-windows-names" }
]
[[repos]]
repo = "https://github.com/asottile/add-trailing-comma"
rev = "v3.2.0"
hooks = [
# Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables,
# if a trailing comma is added.
# This adds a trailing comma to args/iterable items in case it was missed.
{ id = "add-trailing-comma" }
]
[[repos]]
# Keep in sync with the pinned Ruff version in pyproject.toml.
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.14.5"
hooks = [
{
id = "ruff",
name = "lint with ruff",
args = ["--fix"]
},
{
id = "ruff-format",
name = "format with ruff"
}
]
[[repos]]
repo = "local"
hooks = [
{
id = "pyright",
name = "type check with pyright",
entry = "uv run pyright",
language = "system",
types = ["python"]
}
]