Skip to content

Commit

Permalink
Upgrade pylint, re-enable bad-builtins check (apache#28239)
Browse files Browse the repository at this point in the history
* Re-enable bad-builtins check

* Bump pylint version

* New bounds on astroid compatible w/ new pylint

* Add to disabled check list

* More disables + start marking ones to re-enable later

* Add issue links, remove an unused import
  • Loading branch information
jrmccluskey authored Aug 31, 2023
1 parent 205083d commit 262a2da
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
- repo: https://github.com/pycqa/pylint
# this rev is a release tag in the repo above and corresponds with a pylint
# version. make sure this matches the version of pylint in tox.ini.
rev: v2.11.1
rev: v2.17.5
hooks:
- id: pylint
args: ["--rcfile=sdks/python/.pylintrc"]
Expand Down
23 changes: 21 additions & 2 deletions sdks/python/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[MASTER]
# Ignore auto-generated files.
ignore=clients
load-plugins=pylint.extensions.no_self_use,pylint.extensions.bad_builtin

[BASIC]
# Regular expression which should only match the name
Expand Down Expand Up @@ -69,7 +70,6 @@ variable-rgx=^[a-z][a-z0-9_]*$
inlinevar-rgx=^[a-z][a-z0-9_]*$

# List of builtins function names that should not be used, separated by a comma
# TODO(https://github.com/apache/beam/issues/27473) Remove or re-enable
bad-functions=input,apply,reduce

# Good variable names which should always be accepted, separated by a comma
Expand All @@ -85,18 +85,24 @@ disable =
arguments-differ,
arguments-renamed,
attribute-defined-outside-init,
bad-builtin, # TODO(https://github.com/apache/beam/issues/27473) Remove or re-enable
bad-builtin,
broad-except,
broad-exception-raised,
c-extension-no-member,
comparison-with-callable,
consider-iterating-dictionary,
consider-using-dict-items,
consider-using-enumerate,
consider-using-f-string,
consider-using-generator,
consider-using-in,
consider-using-sys-exit,
consider-using-with,
cyclic-import,
design,
fixme,
global-statement,
global-variable-undefined,
import-error,
import-outside-toplevel,
import-self,
Expand All @@ -108,7 +114,9 @@ disable =
locally-disabled,
logging-not-lazy,
missing-docstring,
modified-iterating-list,
multiple-statements,
missing-timeout, #TODO(https://github.com/apache/beam/issues/28240) Enable and fix warnings
no-self-use,
no-else-break,
no-else-continue,
Expand All @@ -126,23 +134,34 @@ disable =
redefined-builtin,
redefined-outer-name,
redundant-keyword-arg,
self-cls-assignment,
similarities,
simplifiable-if-statement,
stop-iteration-return,
super-init-not-called,
superfluous-parens,
typevar-name-mismatch, #TODO(https://github.com/apache/beam/issues/28241) Enable and fix warnings
try-except-raise,
undefined-variable,
unexpected-keyword-arg,
unidiomatic-typecheck,
unnecessary-comprehension,
unnecessary-direct-lambda-call,
unnecessary-dunder-call,
unnecessary-lambda,
unnecessary-lambda-assignment,
unnecessary-pass,
unneeded-not,
use-implicit-booleaness-not-comparison, #TODO(https://github.com/apache/beam/issues/28244) Enable and fix warnings
used-before-assignment,
unsubscriptable-object,
unsupported-binary-operation,
unspecified-encoding, #TODO(https://github.com/apache/beam/issues/21236) Enable explicit encoding
unused-argument,
use-dict-literal,
unused-wildcard-import,
useless-object-inheritance,
useless-with-lock, #TODO(https://github.com/apache/beam/issues/28242) Enable and fix warnings
wildcard-import,
wrong-import-order,

Expand Down
1 change: 0 additions & 1 deletion sdks/python/apache_beam/ml/inference/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from typing import Any
from typing import Dict
from typing import Iterable
from typing import List
from typing import Mapping
from typing import Optional
from typing import Sequence
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ setenv =
# keep the version of pylint in sync with the 'rev' in .pre-commit-config.yaml
deps =
-r build-requirements.txt
astroid<2.9,>=2.8.0
astroid<2.17.0,>=2.15.6
pycodestyle==2.8.0
pylint==2.11.1
pylint==2.17.5
isort==4.2.15
flake8==4.0.1
commands =
Expand Down

0 comments on commit 262a2da

Please sign in to comment.