Skip to content

Commit d1ba049

Browse files
authored
pre-commit: run prospector from inside pre-commit (#166)
* pre-commit: run `prospector` from inside `pre-commit` - merge both pospector YAML file - run prospector from inside pre-commit * prospector: exclude some known paths * Do not ignore linting files * prospector: ignore test files * prospector: ignore directories from tests * Use `medium` for prospector strictness * Define regex properly
1 parent be9b131 commit d1ba049

File tree

3 files changed

+28
-68
lines changed

3 files changed

+28
-68
lines changed

pre-commit-config.yaml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,27 @@ repos:
4040
# - id: docformatter
4141
# args: ['--in-place', '--wrap-summaries=80', '--wrap-descriptions=80', '--pre-summary-newline']
4242

43-
# TODO: re-enable when we can make it behave in the same way than in CircleCI
44-
# - repo: https://github.com/PyCQA/prospector
45-
# rev: 1.3.1
46-
# hooks:
47-
# - id: prospector
48-
# args: ['--profile=/home/humitos/rtfd/code/readthedocs.org/prospector.yml']
49-
# additional_dependencies: [
50-
# # TODO: use an environment variable to decide this PATH here?
51-
# '-r/home/humitos/rtfd/code/readthedocs.org/requirements/lint.txt',
52-
# ]
53-
# # NOTE: copied from prospector YAML configuration because pre-commit does
54-
# # not load them from there and runs prospector over these files
55-
# exclude: |
56-
# (?x)^(
57-
# docs/.*|
58-
# readthedocs/settings/.*|
59-
# common/.*|
60-
# readthedocs/rtd_tests/.*|
61-
# readthedocs/.*tests.*/.*|
62-
# .*/migrations/.*|
63-
# .*conftest.py
64-
# )$
43+
- repo: https://github.com/PyCQA/prospector
44+
rev: 1.3.1
45+
hooks:
46+
- id: prospector
47+
args:
48+
- --profile=prospector.yml
49+
- --die-on-tool-error
50+
exclude: |
51+
(?x)^(
52+
.*/docs/.*|
53+
.*/settings/.*|
54+
.*/common/.*|
55+
.*/rtd_tests/.*|
56+
.*/tests/.*|
57+
.*/migrations/.*
58+
)$
59+
# We have to install the dependencies from an URL since we don't have access to this file easily from pre-commit
60+
additional_dependencies:
61+
- -r
62+
- https://raw.githubusercontent.com/readthedocs/readthedocs.org/main/requirements/pip.txt
63+
- flake8==3.8.4
6564

6665
- repo: https://github.com/akaihola/darker
6766
rev: 1.3.2

prospector-more.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

prospector.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
strictness: low
1+
strictness: medium
22

33
test-warnings: false
44
doc-warnings: true
@@ -11,12 +11,12 @@ ignore-paths:
1111
- docs/
1212
- settings/
1313
- common/
14+
- readthedocs/rtd_tests/
15+
- readthedocs/templates/
1416

1517
ignore-patterns:
16-
- rtd_tests/
17-
- /migrations/
18-
- local_settings.py
19-
- settings/
18+
- ^.*/migrations/.*\.py$
19+
- ^.*/tests/.*\.py$
2020
- conftest.py
2121

2222
pep8:
@@ -39,6 +39,8 @@ pylint:
3939
- imported-auth-user
4040
# Too many to update for now.
4141
- consider-using-f-string
42+
- logging-format-interpolation
43+
- too-many-arguments
4244

4345
mccabe:
4446
run: false

0 commit comments

Comments
 (0)