-
-
Notifications
You must be signed in to change notification settings - Fork 638
/
.pre-commit-config.yaml
136 lines (128 loc) · 4.82 KB
/
.pre-commit-config.yaml
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
exclude: ^user_docs/(?!en/).+/.+\.md$
# https://pre-commit.ci/
# Configuration for Continuous Integration service
ci:
# Can't run Windows scons scripts on Linux.
# unit testing requires our python environment,
# which cannot be configured with pre-commit.ci:
# https://stackoverflow.com/questions/70778806/pre-commit-not-using-virtual-environment .
# Can't run licenseCheck as it relies on telemetry,
# which CI blocks.
skip: [scons-source, checkPot, unitTest, licenseCheck]
autoupdate_schedule: monthly
autoupdate_commit_msg: "Pre-commit auto-update"
autofix_commit_msg: "Pre-commit auto-fix"
default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
- id: check-pre-commit-ci-config
- 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
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Prevents commits to certain branches
- id: no-commit-to-branch
args: ["--branch", "master", "--branch", "beta", "--branch", "rc"]
# Checks that large files have not been added. Default cut-off for "large" files is 500kb.
- id: check-added-large-files
# POFiles and TTF fonts can't be made smaller
exclude_types: ["pofile", "ttf"]
# Same applies for NVDA dictionary (.dic) files and Spline Font Database (.SFD) files, but these aren't recognised by the Identify library.
exclude: "\\.(dic|sfd)$"
# Checks python syntax
- id: check-ast
# 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
# Checks Python files for debug statements, such as python's breakpoint function, or those inserted by some IDEs.
- id: debug-statements
# Removes trailing whitespace.
- id: trailing-whitespace
types_or: [python, c, c++, batch, markdown]
# Ensures all files end in 1 (and only 1) newline.
- id: end-of-file-fixer
types_or: [python, c, c++, batch, markdown]
# 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]
# Validates TOML files.
- id: check-toml
# Validates YAML files.
- id: check-yaml
# Validates XML files.
- id: check-xml
# Ensures that links to lines in files under version control point to a particular commit.
- id: check-vcs-permalinks
# Avoids using reserved Windows filenames.
- id: check-illegal-windows-names
# Checks that tests are named test_*.py.
- id: name-tests-test
args: ["--unittest"]
# Exclude Python files under `tests/` that aren't unittest files.
# This is a Python verbose regular expression.
# See https://docs.python.org/3/library/re.html#re.VERBOSE
exclude: |
(?x)^tests/(
checkPot.py | # Doesn't use unittest
system | # Uses robot
unit/ (
# Test helpers
textProvider.py |
extensionPointTestHelpers.py |
objectProvider.py |
test_speechManager/speechManagerTestHarness.py
)
)
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.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
- repo: https://github.com/astral-sh/ruff-pre-commit
# Matches Ruff version in requirements.
rev: v0.7.2
hooks:
- id: ruff
name: lint with ruff
args: [ --fix ]
- id: ruff-format
name: format with ruff
- repo: local
hooks:
- id: scons-source
name: build c/c++ files
entry: cmd.exe /c "scons source --all-cores"
language: system
pass_filenames: false
types_or: [c, c++]
- id: checkPot
name: translation string check
entry: cmd.exe /c "scons checkPot --all-cores"
language: system
pass_filenames: false
types: [python]
files: ^source/.*$
- id: unitTest
name: unit tests
entry: ./rununittests.bat
language: script
pass_filenames: false
types_or: [python, c, c++, batch]
- id: licenseCheck
name: Check license compatibility of pip dependencies
files: ^(requirements\.txt|runlicensecheck\.bat)$
entry: ./runlicensecheck.bat
language: script
pass_filenames: false