-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
142 lines (141 loc) · 4.4 KB
/
.pre-commit-config.yaml
File metadata and controls
142 lines (141 loc) · 4.4 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
140
141
142
---
default_install_hook_types:
- commit-msg
- pre-commit
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://gitlab.wikimedia.org/repos/ci-tools/commit-message-validator
rev: v2.2.0
hooks:
- id: commit-message-validator
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
args:
- --maxkb=200
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: fix-byte-order-marker
exclude: ^tests/data/
- id: forbid-new-submodules
- id: mixed-line-ending
- id: pretty-format-json
# list required for tab
args: [--autofix, --indent, "\t", --no-ensure-ascii]
- id: trailing-whitespace
exclude: ^tests/data/
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-no-log-warn
- id: python-use-type-annotations
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: local
hooks:
- id: copyright
name: check and fix copyright notice
entry: tests/hooks/copyright_fixer.py
files: .+\.py$
language: python
require_serial: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.9
hooks:
- id: ruff-check
alias: ruff
args:
- --fix
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
args:
- --py39-plus
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.3
hooks:
- id: autoflake
args:
- --expand-star-imports
- --in-place
- --remove-all-unused-imports
- --remove-duplicate-keys
- --remove-unused-variables
exclude: ^pywikibot/backports\.py$
- repo: https://github.com/PyCQA/isort
rev: 8.0.1
hooks:
- id: isort
name: isort
args:
- -a from __future__ import annotations
exclude: ^pwb\.py$
- id: isort
name: isort (skip future annotations)
files: ^pwb\.py$
- repo: https://github.com/jshwi/docsig
rev: v0.82.0
hooks:
- id: docsig
exclude: ^(tests|scripts)
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
args:
- --doctests
- --config=tox.ini
additional_dependencies:
# Due to incompatibilities between packages the order matters.
- flake8-bugbear>=25.11.29
- flake8-print>=5.0.0
- pep8-naming>=0.15.1
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.20.0
hooks:
- id: mypy
args:
- --config-file=pyproject.toml
- --follow-imports=silent
additional_dependencies:
- types-PyMySQL
- types-requests
# Test for files which already passed in past.
# They should be also used in conftest.py to exclude them from non-voting mypy test.
files: |
(?x)^pywikibot/(
(__metadata__|backports|config|cosmetic_changes|daemonize|diff|echo|exceptions|fixes|logging|plural|time|titletranslate)|
(comms|data|families|specialbots)/__init__|
comms/eventstreams|
data/(api/(__init__|_optionset)|citoid|memento|wikistats)|
families/[a-z][a-z\d]+_family|
page/(__init__|_decorators|_page|_revision|_user)|
pagegenerators/(__init__|_filters)|
scripts/(?:i18n/)?__init__|
site/(__init__|_basesite|_decorators|_interwikimap|_tokenwallet|_upload)|
tools/(_deprecate|_logging|_unidata|chars|formatter|itertools)|
userinterfaces/(__init__|_interface_base|buffer_interface|terminal_interface|transliteration)
)\.py$