Skip to content

Commit

Permalink
Update .pre-commit-config.yaml to optimise developer experience (#2661)
Browse files Browse the repository at this point in the history
  • Loading branch information
noklam authored Jun 8, 2023
1 parent 92c6764 commit 20f7eec
Showing 1 changed file with 58 additions and 53 deletions.
111 changes: 58 additions & 53 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,6 @@ repos:
exclude: "^kedro/templates/|^features/steps/test_starter/"
- id: requirements-txt-fixer # Sorts entries in requirements.txt
exclude: "^kedro/templates/|^features/steps/test_starter/"
- id: flake8
args:
- "--max-line-length=88"
- "--max-complexity=18"
- "--max-complexity=18"
- "--select=B,C,E,F,W,T4,B9"
- "--ignore=E203,E266,E501,W503"
exclude: "^kedro/templates/|^features/steps/test_starter/"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
hooks:
- id: mypy
args: [--allow-redefinition, --ignore-missing-imports]
exclude: |
(?x)(
^kedro/templates/|
^docs/|
^features/steps/test_starter/
)
additional_dependencies:
- types-cachetools
- types-filelock
- types-PyYAML
- types-redis
- types-requests
- types-setuptools
- types-toml
- attrs

- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
Expand Down Expand Up @@ -82,18 +52,7 @@ repos:
language: system
pass_filenames: false
entry: lint-imports
- id: secret_scan
name: "Secret scan"
language: system
exclude: ^features/steps/test_starter
pass_filenames: false
entry: make secret-scan
- id: bandit
name: "Bandit security check"
language: system
types: [file, python]
exclude: ^kedro/templates/|^tests/|^features/steps/test_starter
entry: bandit -ll


# It's impossible to specify per-directory configuration, so we just run it many times.
# https://github.com/PyCQA/pylint/issues/618
Expand All @@ -106,6 +65,13 @@ repos:
exclude: ^kedro/templates/
entry: pylint -j 4 --disable=unnecessary-pass
stages: [commit]
- id: pylint-quick-tests
name: "Quick Pylint on tests/*"
language: system
types: [file, python]
files: ^tests/
entry: pylint -j 4 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name,protected-access,too-many-arguments,too-many-public-methods
stages: [commit]
- id: pylint-quick-features
name: "Quick Pylint on features/*"
language: system
Expand All @@ -114,13 +80,6 @@ repos:
exclude: ^features/steps/test_starter
entry: pylint -j 4 --disable=missing-docstring,no-name-in-module
stages: [commit]
- id: pylint-quick-tests
name: "Quick Pylint on tests/*"
language: system
types: [file, python]
files: ^tests/
entry: pylint -j 4 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name,protected-access,too-many-arguments,too-many-public-methods
stages: [commit]

# The same pylint checks, but running on all files. It's for manual run with `make lint`
- id: pylint-kedro
Expand All @@ -129,16 +88,62 @@ repos:
pass_filenames: false
stages: [manual]
entry: pylint -j 4 --disable=unnecessary-pass --init-hook="import sys; sys.setrecursionlimit(2000)" kedro
- id: pylint-tests
name: "Pylint on tests/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j 4 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name,protected-access,too-many-arguments,too-many-public-methods,use-implicit-booleaness-not-comparison tests
- id: pylint-features
name: "Pylint on features/*"
language: system
pass_filenames: false
stages: [manual]
exclude: ^features/steps/test_starter
entry: pylint -j 4 --disable=missing-docstring,no-name-in-module features
- id: pylint-tests
name: "Pylint on tests/*"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: flake8
args:
- "--max-line-length=88"
- "--max-complexity=18"
- "--max-complexity=18"
- "--select=B,C,E,F,W,T4,B9"
- "--ignore=E203,E266,E501,W503"
exclude: "^kedro/templates/|^features/steps/test_starter/"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
hooks:
- id: mypy
args: [--allow-redefinition, --ignore-missing-imports]
exclude: |
(?x)(
^kedro/templates/|
^docs/|
^features/steps/test_starter/
)
additional_dependencies:
- types-cachetools
- types-filelock
- types-PyYAML
- types-redis
- types-requests
- types-setuptools
- types-toml
- attrs
- repo: local
hooks:
# Slow lintint
- id: secret_scan
name: "Secret scan"
language: system
exclude: ^features/steps/test_starter
pass_filenames: false
stages: [manual]
entry: pylint -j 4 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name,protected-access,too-many-arguments,too-many-public-methods,use-implicit-booleaness-not-comparison tests
entry: make secret-scan
- id: bandit
name: "Bandit security check"
language: system
types: [file, python]
exclude: ^kedro/templates/|^tests/|^features/steps/test_starter
entry: bandit -ll

0 comments on commit 20f7eec

Please sign in to comment.