Skip to content

Commit

Permalink
pre-commit: run prospector from inside pre-commit (#166)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
humitos committed Mar 8, 2023
1 parent be9b131 commit d1ba049
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 68 deletions.
43 changes: 21 additions & 22 deletions pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,27 @@ repos:
# - id: docformatter
# args: ['--in-place', '--wrap-summaries=80', '--wrap-descriptions=80', '--pre-summary-newline']

# TODO: re-enable when we can make it behave in the same way than in CircleCI
# - repo: https://github.com/PyCQA/prospector
# rev: 1.3.1
# hooks:
# - id: prospector
# args: ['--profile=/home/humitos/rtfd/code/readthedocs.org/prospector.yml']
# additional_dependencies: [
# # TODO: use an environment variable to decide this PATH here?
# '-r/home/humitos/rtfd/code/readthedocs.org/requirements/lint.txt',
# ]
# # NOTE: copied from prospector YAML configuration because pre-commit does
# # not load them from there and runs prospector over these files
# exclude: |
# (?x)^(
# docs/.*|
# readthedocs/settings/.*|
# common/.*|
# readthedocs/rtd_tests/.*|
# readthedocs/.*tests.*/.*|
# .*/migrations/.*|
# .*conftest.py
# )$
- repo: https://github.com/PyCQA/prospector
rev: 1.3.1
hooks:
- id: prospector
args:
- --profile=prospector.yml
- --die-on-tool-error
exclude: |
(?x)^(
.*/docs/.*|
.*/settings/.*|
.*/common/.*|
.*/rtd_tests/.*|
.*/tests/.*|
.*/migrations/.*
)$
# 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/pip.txt
- flake8==3.8.4

- repo: https://github.com/akaihola/darker
rev: 1.3.2
Expand Down
41 changes: 0 additions & 41 deletions prospector-more.yml

This file was deleted.

12 changes: 7 additions & 5 deletions prospector.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
strictness: low
strictness: medium

test-warnings: false
doc-warnings: true
Expand All @@ -11,12 +11,12 @@ ignore-paths:
- docs/
- settings/
- common/
- readthedocs/rtd_tests/
- readthedocs/templates/

ignore-patterns:
- rtd_tests/
- /migrations/
- local_settings.py
- settings/
- ^.*/migrations/.*\.py$
- ^.*/tests/.*\.py$
- conftest.py

pep8:
Expand All @@ -39,6 +39,8 @@ pylint:
- imported-auth-user
# Too many to update for now.
- consider-using-f-string
- logging-format-interpolation
- too-many-arguments

mccabe:
run: false
Expand Down

0 comments on commit d1ba049

Please sign in to comment.