diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 583619826265c..66bc7cd917b31 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -37,8 +37,8 @@ jobs: - name: Run pre-commit uses: pre-commit/action@v2.0.3 - typing_and_docstring_validation: - name: Docstring and typing validation + docstring_typing_pylint: + name: Docstring validation, typing, and pylint runs-on: ubuntu-latest defaults: run: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fbb2a14be6ea9..6b74dd057e865 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -64,6 +64,25 @@ repos: hooks: - id: pylint stages: [manual] +- repo: https://github.com/pycqa/pylint + rev: v2.15.5 + hooks: + - id: pylint + alias: redefined-outer-name + name: Redefining name from outer scope + files: ^pandas/ + exclude: | + (?x) + ^pandas/tests # keep excluded + |/_testing/ # keep excluded + |^pandas/util/_test_decorators\.py # keep excluded + |^pandas/_version\.py # keep excluded + |^pandas/conftest\.py # keep excluded + |^pandas/core/tools/datetimes\.py + |^pandas/io/formats/format\.py + |^pandas/core/generic\.py + args: [--disable=all, --enable=redefined-outer-name] + stages: [manual] - repo: https://github.com/PyCQA/isort rev: 5.10.1 hooks: @@ -201,7 +220,7 @@ repos: entry: python scripts/sync_flake8_versions.py files: ^(\.pre-commit-config\.yaml|environment\.yml)$ pass_filenames: false - additional_dependencies: [pyyaml] + additional_dependencies: [pyyaml, toml] - id: title-capitalization name: Validate correct capitalization among titles in documentation entry: python scripts/validate_rst_title_capitalization.py diff --git a/pyproject.toml b/pyproject.toml index 8ae2d4abb29ee..73b95743273c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,61 +58,70 @@ exclude = ''' [tool.pylint.messages_control] max-line-length = 88 disable = [ - "abstract-class-instantiated", + # intentionally turned off "c-extension-no-member", + "comparison-with-itself", "import-error", + "import-outside-toplevel", + "invalid-name", "invalid-unary-operand-type", + "line-too-long", + "no-else-continue", + "no-else-raise", + "no-else-return", "no-member", "no-name-in-module", - "no-value-for-parameter", "not-an-iterable", + "pointless-statement", "redundant-keyword-arg", + "singleton-comparison", + "too-many-ancestors", + "too-many-arguments", + "too-many-boolean-expressions", + "too-many-branches", "too-many-function-args", - "undefined-variable", + "too-many-instance-attributes", + "too-many-locals", + "too-many-nested-blocks", + "too-many-public-methods", + "too-many-return-statements", + "too-many-statements", "unexpected-keyword-arg", - "unpacking-non-sequence", + "ungrouped-imports", "unsubscriptable-object", "unsupported-assignment-operation", "unsupported-membership-test", + "unused-import", + "use-implicit-booleaness-not-comparison", + "use-implicit-booleaness-not-len", + "wrong-import-order", + "wrong-import-order", + "wrong-import-position", + + # misc + "abstract-class-instantiated", + "redundant-keyword-arg", + "no-value-for-parameter", + "undefined-variable", + "unpacking-non-sequence", # pylint type "C": convention, for programming standard violation - "import-outside-toplevel", - "invalid-name", - "line-too-long", "missing-class-docstring", "missing-function-docstring", "missing-module-docstring", - "singleton-comparison", "too-many-lines", - "ungrouped-imports", "unidiomatic-typecheck", "unnecessary-dunder-call", "unnecessary-lambda-assignment", - "use-implicit-booleaness-not-comparison", - "use-implicit-booleaness-not-len", - "wrong-import-order", - "wrong-import-position", # pylint type "R": refactor, for bad code smell - "comparison-with-itself", "consider-using-ternary", "consider-using-with", "cyclic-import", "duplicate-code", "inconsistent-return-statements", - "no-else-return", "redefined-argument-from-local", "too-few-public-methods", - "too-many-ancestors", - "too-many-arguments", - "too-many-boolean-expressions", - "too-many-branches", - "too-many-instance-attributes", - "too-many-locals", - "too-many-nested-blocks", - "too-many-public-methods", - "too-many-return-statements", - "too-many-statements", "unnecessary-list-index-lookup", # pylint type "W": warning, for python specific problems @@ -132,7 +141,6 @@ disable = [ "invalid-overridden-method", "keyword-arg-before-vararg", "overridden-final-method", - "pointless-statement", "pointless-string-statement", "possibly-unused-variable", "protected-access", @@ -148,7 +156,6 @@ disable = [ "unnecessary-lambda", "unspecified-encoding", "unused-argument", - "unused-import", "unused-variable", "using-constant-test", "useless-parent-delegation"