Skip to content

Commit

Permalink
Pin Pylint upper version (kedro-org#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
921kiyo committed Sep 25, 2019
1 parent 217170b commit 0735e1c
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 115 deletions.
218 changes: 109 additions & 109 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,116 +4,116 @@
default_stages: [commit, manual]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
stages: [commit, manual]
- id: end-of-file-fixer
stages: [commit, manual]
- id: check-yaml # Checks yaml files for parseable syntax.
exclude: "^kedro/template/"
- id: check-json # Checks json files for parseable syntax.
- id: check-added-large-files
- id: check-case-conflict # Check for files that would conflict in case-insensitive filesystems
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: debug-statements # Check for debugger imports and py37+ `breakpoint()` calls in python source.
exclude: "^kedro/template/"
- id: detect-private-key # Detects the presence of private keys
- id: requirements-txt-fixer # Sorts entries in requirements.txt
- id: flake8
exclude: "^kedro/template/"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
stages: [commit, manual]
- id: end-of-file-fixer
stages: [commit, manual]
- id: check-yaml # Checks yaml files for parseable syntax.
exclude: "^kedro/template/"
- id: check-json # Checks json files for parseable syntax.
- id: check-added-large-files
- id: check-case-conflict # Check for files that would conflict in case-insensitive filesystems
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: debug-statements # Check for debugger imports and py37+ `breakpoint()` calls in python source.
exclude: "^kedro/template/"
- id: detect-private-key # Detects the presence of private keys
- id: requirements-txt-fixer # Sorts entries in requirements.txt
- id: flake8
exclude: "^kedro/template/"

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
exclude: "^kedro/template/"
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
exclude: "^kedro/template/"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
hooks:
- id: mypy
args: [--allow-redefinition, --ignore-missing-imports]
exclude: |
(?x)(
^kedro/template/|
^docs/
)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
hooks:
- id: mypy
args: [--allow-redefinition, --ignore-missing-imports]
exclude: |
(?x)(
^kedro/template/|
^docs/
)
- repo: local
hooks:
# It's impossible to specify per-directory configuration, so we just run it many times.
# https://github.com/PyCQA/pylint/issues/618
# The first set of pylint checks if for local pre-commit, it only runs on the files changed.
- id: pylint-quick-kedro
name: "Quick PyLint on kedro/*"
language: system
types: [file, python]
files: ^kedro/
exclude: ^kedro/template/
entry: pylint -j0 --disable=unnecessary-pass
stages: [commit]
- id: pylint-quick-features
name: "Quick PyLint on features/*"
language: system
types: [file, python]
files: ^features/
entry: pylint -j0 --disable=missing-docstring,no-name-in-module
stages: [commit]
- id: pylint-quick-extras
name: "Quick PyLint on extras/*"
language: system
types: [file, python]
files: ^extras/
entry: pylint -j0
stages: [commit]
- id: pylint-quick-tests
name: "Quick PyLint on tests/*"
language: system
types: [file, python]
files: ^tests/
entry: pylint -j0 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name
stages: [commit]
- repo: local
hooks:
# It's impossible to specify per-directory configuration, so we just run it many times.
# https://github.com/PyCQA/pylint/issues/618
# The first set of pylint checks if for local pre-commit, it only runs on the files changed.
- id: pylint-quick-kedro
name: "Quick PyLint on kedro/*"
language: system
types: [file, python]
files: ^kedro/
exclude: ^kedro/template/
entry: pylint --disable=unnecessary-pass
stages: [commit]
- id: pylint-quick-features
name: "Quick PyLint on features/*"
language: system
types: [file, python]
files: ^features/
entry: pylint --disable=missing-docstring,no-name-in-module
stages: [commit]
- id: pylint-quick-extras
name: "Quick PyLint on extras/*"
language: system
types: [file, python]
files: ^extras/
entry: pylint
stages: [commit]
- id: pylint-quick-tests
name: "Quick PyLint on tests/*"
language: system
types: [file, python]
files: ^tests/
entry: pylint --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name
stages: [commit]

# The same pylint checks, but running on all files. It's for manual run with `make lint`
- id: pylint-kedro
name: "PyLint on kedro/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j0 --disable=unnecessary-pass kedro
- id: pylint-features
name: "PyLint on features/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j0 --disable=missing-docstring,no-name-in-module features
- id: pylint-extras
name: "PyLint on extras/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j0 extras
- id: pylint-tests
name: "PyLint on tests/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint -j0 --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name tests
# We need to make some exceptions for 3.5, that's why it's a custom runner.
- id: black
name: "Black"
language: system
pass_filenames: false
entry: python -m tools.min_version 3.6 "pip install black" "black kedro extras features tests"
- id: legal
name: "Licence check"
language: system
pass_filenames: false
entry: make legal
- id: imports
name: "Import Linter"
language: system
pass_filenames: false
entry: python -m tools.min_version 3.6 "pip install import-linter" lint-imports
# The same pylint checks, but running on all files. It's for manual run with `make lint`
- id: pylint-kedro
name: "PyLint on kedro/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint --disable=unnecessary-pass kedro
- id: pylint-features
name: "PyLint on features/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint --disable=missing-docstring,no-name-in-module features
- id: pylint-extras
name: "PyLint on extras/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint extras
- id: pylint-tests
name: "PyLint on tests/*"
language: system
pass_filenames: false
stages: [manual]
entry: pylint --disable=missing-docstring,redefined-outer-name,no-self-use,invalid-name tests
# We need to make some exceptions for 3.5, that's why it's a custom runner.
- id: black
name: "Black"
language: system
pass_filenames: false
entry: python -m tools.min_version 3.6 "pip install black" "black kedro extras features tests"
- id: legal
name: "Licence check"
language: system
pass_filenames: false
entry: make legal
- id: imports
name: "Import Linter"
language: system
pass_filenames: false
entry: python -m tools.min_version 3.6 "pip install import-linter" lint-imports
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=ungrouped-imports,bad-continuation
disable=ungrouped-imports,bad-continuation,duplicate-code

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
6 changes: 4 additions & 2 deletions features/steps/pipeline_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ def node_tagged_with(context, node_name, tags):
sys.path.append(
str(context.root_project_dir / "src" / context.project_name.replace("-", "_"))
)
import pipeline # pylint: disable=import-error
import pipeline # pylint: disable=import-error,useless-suppression

context.project_pipeline = pipeline.create_pipeline()
context.project_pipeline = (
pipeline.create_pipeline() # pylint: disable=no-member,useless-suppression
)
node_objs = [n for n in context.project_pipeline.nodes if n.name == node_name]
assert node_objs
assert set(tags) == node_objs[0].tags
Expand Down
2 changes: 1 addition & 1 deletion kedro/runner/parallel_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _validate_catalog(cls, catalog: DataCatalog, pipeline: Pipeline):
"MemoryDataSets".format(memory_data_sets)
)

def _run( # pylint: disable=too-many-locals
def _run( # pylint: disable=too-many-locals,useless-suppression
self, pipeline: Pipeline, catalog: DataCatalog
) -> None:
"""The abstract interface for running pipelines.
Expand Down
2 changes: 1 addition & 1 deletion kedro/versioning/journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _git_sha(proj_dir: Union[str, Path] = None) -> Optional[str]:
"""
proj_dir = str(proj_dir or Path.cwd())
try:
res = subprocess.check_output(
res = subprocess.check_output( # pylint: disable=unexpected-keyword-arg
["git", "rev-parse", "--short", "HEAD"], cwd=proj_dir
)
return res.decode().strip()
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nbconvert>=5.3.1, <6.0
nbformat>=4.4.0, <5.0
pre-commit>=1.17.0, <2.0.0
psutil==5.4.7
pylint>=2.3.1, <3.0
pylint>=2.3.1, <2.4.0 # 2.4.1 doesn't work for Python 3.5, and requires investigation.
pyspark>=2.2.0, <3.0
pytest-cov>=2.5, <3.0
pytest-mock>=1.7.1,<2.0
Expand Down

0 comments on commit 0735e1c

Please sign in to comment.