-
Notifications
You must be signed in to change notification settings - Fork 38
/
pre-commit-config.yaml
118 lines (109 loc) · 3.38 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
exclude: '^$|settings|scripts|vendor|\.(min\.js|svg)$|static/.*\.js$'
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# Disabled because yapf is better for our purpose
# - id: autopep8-wrapper
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-vcs-permalinks
- id: debug-statements
- id: fix-byte-order-marker
- id: end-of-file-fixer
- id: fix-encoding-pragma
exclude: |
(?x)^(
readthedocs/rtd_tests/files/conf.py|
)$
args: ['--remove']
- id: check-merge-conflict
- id: check-symlinks
- id: trailing-whitespace
exclude: |
(?x)^(
docs/.+/locale/.*\.po|
.+\.svg|
.+\.js|
.+\.css|
.*/migrations/.*|
)$
- id: mixed-line-ending
args: ['--fix=lf']
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
# TODO: re-enable it and use `--range` to select the modified lines
# - repo: https://github.com/myint/docformatter.git
# rev: v1.4
# hooks:
# - id: docformatter
# args: ['--in-place', '--wrap-summaries=80', '--wrap-descriptions=80', '--pre-summary-newline']
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.14.1"
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10
exclude: |
(?x)^(
readthedocs/rtd_tests/files/conf.py|
.*/migrations/.*
)$
# NOTE: run `isort` after `black` to keep the format of isort finally
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
exclude: |
(?x)^(
.*/migrations/.*
)
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7.0]
- repo: https://github.com/PyCQA/prospector
rev: 1.10.2
hooks:
- id: prospector
args:
- --profile=prospector.yml
- --die-on-tool-error
exclude: |
(?x)^(
docs/.*|
common/.*|
.*/settings/.*|
.*/rtd_tests/.*|
.*/tests/.*|
.*/migrations/.*
)$
# This PYTHONPATH environment variable is required for readthedocs-corporate when running `tox -e pre-commit`
entry: env PYTHONPATH=readthedocs:../readthedocs.org:./ DJANGO_SETTINGS_MODULE=readthedocs.settings.test prospector
# We have to install the dependencies from an URL since we don't have access to this file easily from pre-commit
additional_dependencies:
- -r
- https://raw.githubusercontent.com/readthedocs/readthedocs.org/main/requirements/testing.txt
- repo: https://github.com/aspiredu/django-safemigrate
rev: "4.2"
hooks:
- id: check