summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-11-23 20:10:29 +0100
committerGitHub <noreply@github.com>2021-11-23 20:10:29 +0100
commitd58a7c019df0bde1ae5edde35a628b861715c758 (patch)
treea5479c14dfab21689a8b538f510fdde7ae1ad664
parent2c687133e4fcdd73ae3afa2e79be2160b150bb82 (diff)
downloadpylint-git-d58a7c019df0bde1ae5edde35a628b861715c758.tar.gz
Fix typo in pylintrc for useless-suppression (#5303)
* Fix typo in pylintrc for useless-suppression * Fix CI for information messages * Remove useless disables * Update CI and docs for 3.8+ Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r--.github/workflows/ci.yaml2
-rw-r--r--.pre-commit-config.yaml1
-rw-r--r--ChangeLog6
-rw-r--r--doc/development_guide/contribute.rst3
-rw-r--r--doc/whatsnew/2.12.rst6
-rw-r--r--pylint/checkers/exceptions.py2
-rw-r--r--pylint/checkers/format.py2
-rw-r--r--pylint/checkers/similar.py1
-rw-r--r--pylint/checkers/utils.py1
-rw-r--r--pylint/checkers/variables.py1
-rw-r--r--pylint/config/option.py1
-rw-r--r--pylint/extensions/overlapping_exceptions.py1
-rw-r--r--pylint/lint/pylinter.py4
-rw-r--r--pylint/lint/run.py2
-rw-r--r--pylint/reporters/text.py2
-rw-r--r--pylint/testutils/lint_module_test.py2
-rw-r--r--pylint/testutils/reporter_for_tests.py1
-rw-r--r--pylint/testutils/unittest_linter.py2
-rw-r--r--pylint/utils/file_state.py4
-rw-r--r--pylint/utils/utils.py2
-rw-r--r--pylintrc2
-rw-r--r--tests/benchmark/test_baseline_benchmarks.py2
-rw-r--r--tests/checkers/unittest_design.py1
-rw-r--r--tests/checkers/unittest_format.py4
-rw-r--r--tests/config/unittest_config.py1
-rw-r--r--tests/conftest.py1
-rw-r--r--tests/lint/unittest_lint.py3
-rw-r--r--tests/profile/test_profile_against_externals.py2
-rw-r--r--tests/pyreverse/test_diagrams.py1
-rw-r--r--tests/regrtest_data/unused_variable.py2
-rw-r--r--tests/test_func.py1
-rw-r--r--tests/unittest_reporting.py2
32 files changed, 31 insertions, 37 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index ad376dbc4..41e9642bc 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -9,7 +9,7 @@ on:
env:
CACHE_VERSION: 3
- DEFAULT_PYTHON: 3.6
+ DEFAULT_PYTHON: 3.8
PRE_COMMIT_CACHE: ~/.cache/pre-commit
jobs:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2ff8c6024..93b5b2cca 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -57,6 +57,7 @@ repos:
"-rn",
"-sn",
"--rcfile=pylintrc",
+ "--fail-on=I",
"--load-plugins=pylint.extensions.docparams",
]
# disabled plugins: pylint.extensions.mccabe
diff --git a/ChangeLog b/ChangeLog
index 10adc3379..6c81c2e6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -275,6 +275,12 @@ Release date: TBA
Closes #3507
Closes #5087
+* It is now recommended to do ``pylint`` development on ``Python`` 3.8 or higher. This
+ allows using the latest ``ast`` parser.
+
+* All standard jobs in the ``pylint`` CI now run on ``Python`` 3.8 by default. We still
+ support python 3.6 and 3.7 and run tests for those interpreters.
+
* ``TypingChecker``
* Fix false-negative for ``deprecated-typing-alias`` and ``consider-using-alias``
diff --git a/doc/development_guide/contribute.rst b/doc/development_guide/contribute.rst
index f6d7e9556..8e484a514 100644
--- a/doc/development_guide/contribute.rst
+++ b/doc/development_guide/contribute.rst
@@ -64,7 +64,8 @@ You can clone Pylint and its dependencies from ::
.. _git: https://git-scm.com/
Got a change for Pylint? Below are a few steps you should take to make sure
-your patch gets accepted.
+your patch gets accepted. We recommend using Python 3.8 or higher for development
+of Pylint as it gives you access to the latest ``ast`` parser.
- Test your code
diff --git a/doc/whatsnew/2.12.rst b/doc/whatsnew/2.12.rst
index 9e8bfbb30..eb0e7a9a7 100644
--- a/doc/whatsnew/2.12.rst
+++ b/doc/whatsnew/2.12.rst
@@ -195,6 +195,12 @@ Other Changes
* Added the ``--enable-all-extensions`` command line option. It will load all available extensions
which can be listed by running ``--list-extensions``
+* It is now recommended to do ``pylint`` development on ``Python`` 3.8 or higher. This
+ allows using the latest ``ast`` parser.
+
+* All standard jobs in the ``pylint`` CI now run on ``Python`` 3.8 by default. We still
+ support python 3.6 and 3.7 and run tests for those interpreters.
+
* Fix crash on ``open()`` calls when the ``mode`` argument is not a simple string.
Partially closes #5321
diff --git a/pylint/checkers/exceptions.py b/pylint/checkers/exceptions.py
index c12657809..b3027d234 100644
--- a/pylint/checkers/exceptions.py
+++ b/pylint/checkers/exceptions.py
@@ -232,7 +232,6 @@ class ExceptionRaiseLeafVisitor(BaseVisitor):
)
def visit_instance(self, instance: objects.ExceptionInstance) -> None:
- # pylint: disable=protected-access
cls = instance._proxied
self.visit_classdef(cls)
@@ -535,7 +534,6 @@ class ExceptionsChecker(checkers.BaseChecker):
if isinstance(exc, astroid.Instance) and utils.inherit_from_std_ex(
exc
):
- # pylint: disable=protected-access
exc = exc._proxied
self._check_catching_non_exception(handler, exc, part)
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py
index d0e4b9914..22e41622f 100644
--- a/pylint/checkers/format.py
+++ b/pylint/checkers/format.py
@@ -52,7 +52,7 @@ Some parts of the process_token method is based from The Tab Nanny std module.
"""
import tokenize
-from functools import reduce # pylint: disable=redefined-builtin
+from functools import reduce
from typing import List
from astroid import nodes
diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py
index 4293d5306..1fa08f577 100644
--- a/pylint/checkers/similar.py
+++ b/pylint/checkers/similar.py
@@ -26,7 +26,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# pylint: disable=redefined-builtin
"""a similarities / code duplication command line tool and pylint checker
The algorithm is based on comparing the hash value of n successive lines of a file.
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index 62fd35347..7e4725ba8 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -1338,7 +1338,6 @@ def is_registered_in_singledispatch_function(node: nodes.FunctionDef) -> bool:
continue
if isinstance(func_def, nodes.FunctionDef):
- # pylint: disable=redundant-keyword-arg; some flow inference goes wrong here
return decorated_with(func_def, singledispatch_qnames)
return False
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index cf11e213c..5e8b83cd6 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -1783,7 +1783,6 @@ class VariablesChecker(BaseChecker):
self.add_message("undefined-loop-variable", args=node.name, node=node)
def _check_is_unused(self, name, node, stmt, global_names, nonlocal_names):
- # pylint: disable=too-many-branches
# Ignore some special names specified by user configuration.
if self._is_name_ignored(stmt, name):
return
diff --git a/pylint/config/option.py b/pylint/config/option.py
index 7093fefe1..684c7e894 100644
--- a/pylint/config/option.py
+++ b/pylint/config/option.py
@@ -181,7 +181,6 @@ class Option(optparse.Option):
f"must not supply choices for type {self.type!r}", self
)
- # pylint: disable=unsupported-assignment-operation
optparse.Option.CHECK_METHODS[2] = _check_choice # type: ignore[index]
def process(self, opt, value, values, parser):
diff --git a/pylint/extensions/overlapping_exceptions.py b/pylint/extensions/overlapping_exceptions.py
index 2ed9038e3..470582b68 100644
--- a/pylint/extensions/overlapping_exceptions.py
+++ b/pylint/extensions/overlapping_exceptions.py
@@ -49,7 +49,6 @@ class OverlappingExceptionsChecker(checkers.BaseChecker):
if exc is astroid.Uninferable:
continue
if isinstance(exc, astroid.Instance) and utils.inherit_from_std_ex(exc):
- # pylint: disable=protected-access
exc = exc._proxied
if not isinstance(exc, astroid.ClassDef):
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py
index 53453af40..b9bea1bb2 100644
--- a/pylint/lint/pylinter.py
+++ b/pylint/lint/pylinter.py
@@ -623,7 +623,6 @@ class PyLinter(
sub_reporters.append(reporter)
if reporter_output:
(reporter_output,) = reporter_output
- # pylint: disable=consider-using-with
output_file = stack.enter_context(
open(reporter_output, "w", encoding="utf-8")
)
@@ -1066,7 +1065,7 @@ class PyLinter(
self.file_state = FileState(file.modpath)
# fix the current file (if the source file was not available or
# if it's actually a c extension)
- self.current_file = ast_node.file # pylint: disable=maybe-no-member
+ self.current_file = ast_node.file
check_astroid_module(ast_node)
# warn about spurious inline messages handling
spurious_messages = self.file_state.iter_spurious_suppression_messages(
@@ -1312,6 +1311,7 @@ class PyLinter(
"refactor": self.stats.refactor,
"convention": self.stats.convention,
"statement": self.stats.statement,
+ "info": self.stats.info,
}
note = eval(evaluation, {}, stats_dict) # pylint: disable=eval-used
except Exception as ex: # pylint: disable=broad-except
diff --git a/pylint/lint/run.py b/pylint/lint/run.py
index 7a87d5759..91111ed4a 100644
--- a/pylint/lint/run.py
+++ b/pylint/lint/run.py
@@ -21,7 +21,7 @@ except ImportError:
def _cpu_count() -> int:
"""Use sched_affinity if available for virtualized or containerized environments."""
sched_getaffinity = getattr(os, "sched_getaffinity", None)
- # pylint: disable=not-callable,using-constant-test
+ # pylint: disable=not-callable,using-constant-test,useless-suppression
if sched_getaffinity:
return len(sched_getaffinity(0))
if multiprocessing:
diff --git a/pylint/reporters/text.py b/pylint/reporters/text.py
index 42bd6b2ea..d4e7cf70c 100644
--- a/pylint/reporters/text.py
+++ b/pylint/reporters/text.py
@@ -292,7 +292,7 @@ class ColorizedTextReporter(TextReporter):
ansi_terms = ["xterm-16color", "xterm-256color"]
if os.environ.get("TERM") not in ansi_terms:
if sys.platform == "win32":
- # pylint: disable=import-error,import-outside-toplevel
+ # pylint: disable=import-outside-toplevel
import colorama
self.out = colorama.AnsiToWin32(self.out)
diff --git a/pylint/testutils/lint_module_test.py b/pylint/testutils/lint_module_test.py
index b67d2fd2c..4ac239768 100644
--- a/pylint/testutils/lint_module_test.py
+++ b/pylint/testutils/lint_module_test.py
@@ -146,14 +146,12 @@ class LintModuleTest:
unexpected[key] = -value
return missing, unexpected
- # pylint: disable=consider-using-with
def _open_expected_file(self) -> TextIO:
try:
return open(self._test_file.expected_output, encoding="utf-8")
except FileNotFoundError:
return StringIO("")
- # pylint: disable=consider-using-with
def _open_source_file(self) -> TextIO:
if self._test_file.base == "invalid_encoded_data":
return open(self._test_file.source, encoding="utf-8")
diff --git a/pylint/testutils/reporter_for_tests.py b/pylint/testutils/reporter_for_tests.py
index 264ca9294..148777406 100644
--- a/pylint/testutils/reporter_for_tests.py
+++ b/pylint/testutils/reporter_for_tests.py
@@ -50,7 +50,6 @@ class GenericTestReporter(BaseReporter):
self.reset()
return result
- # pylint: disable=unused-argument
def on_set_current_module(self, module: str, filepath: Optional[str]) -> None:
pass
diff --git a/pylint/testutils/unittest_linter.py b/pylint/testutils/unittest_linter.py
index b8fbb8c91..cb222892e 100644
--- a/pylint/testutils/unittest_linter.py
+++ b/pylint/testutils/unittest_linter.py
@@ -14,7 +14,7 @@ from pylint.utils import LinterStats
class UnittestLinter:
"""A fake linter class to capture checker messages."""
- # pylint: disable=unused-argument, no-self-use
+ # pylint: disable=unused-argument
def __init__(self):
self._messages = []
diff --git a/pylint/utils/file_state.py b/pylint/utils/file_state.py
index ebd51d31a..8527031ea 100644
--- a/pylint/utils/file_state.py
+++ b/pylint/utils/file_state.py
@@ -74,9 +74,9 @@ class FileState:
#
# 1. def meth8(self):
# 2. """test late disabling"""
- # 3. pylint: disable=not-callable
+ # 3. pylint: disable=not-callable, useless-suppression
# 4. print(self.blip)
- # 5. pylint: disable=no-member
+ # 5. pylint: disable=no-member, useless-suppression
# 6. print(self.bla)
#
# E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index 25b0ad3f1..bf37734fd 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -93,7 +93,7 @@ CMPS = ["=", "-", "+"]
# py3k has no more cmp builtin
-def cmp(a, b): # pylint: disable=redefined-builtin
+def cmp(a, b):
return (a > b) - (a < b)
diff --git a/pylintrc b/pylintrc
index 95e796939..299867086 100644
--- a/pylintrc
+++ b/pylintrc
@@ -57,7 +57,7 @@ confidence=
# multiple time. See also the "--disable" option for examples.
enable=
use-symbolic-message-instead,
- useless-supression,
+ useless-suppression,
fixme
# Disable the message, report, category or checker with the given id(s). You
diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py
index 430e8995c..38347f1e7 100644
--- a/tests/benchmark/test_baseline_benchmarks.py
+++ b/tests/benchmark/test_baseline_benchmarks.py
@@ -9,7 +9,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# pylint: disable=protected-access,missing-function-docstring,no-self-use
+# pylint: disable=missing-function-docstring
import os
import pprint
diff --git a/tests/checkers/unittest_design.py b/tests/checkers/unittest_design.py
index 441793a2e..49acfe4e9 100644
--- a/tests/checkers/unittest_design.py
+++ b/tests/checkers/unittest_design.py
@@ -58,5 +58,4 @@ class TestDesignChecker(CheckerTestCase):
Compare against actual list to see if validator works."""
options = get_global_option(self.checker, "exclude-too-few-public-methods")
- # pylint: disable-next=use-implicit-booleaness-not-comparison
assert options == []
diff --git a/tests/checkers/unittest_format.py b/tests/checkers/unittest_format.py
index a9a62c902..d432a96ae 100644
--- a/tests/checkers/unittest_format.py
+++ b/tests/checkers/unittest_format.py
@@ -293,9 +293,7 @@ def test_disable_global_option_end_of_line() -> None:
Test for issue with disabling tokenizer messages
that extend beyond the scope of the ast tokens
"""
- file_ = tempfile.NamedTemporaryFile(
- "w", delete=False
- ) # pylint: disable=consider-using-with
+ file_ = tempfile.NamedTemporaryFile("w", delete=False)
with file_:
file_.write(
"""
diff --git a/tests/config/unittest_config.py b/tests/config/unittest_config.py
index 9979aa41b..b10c686e4 100644
--- a/tests/config/unittest_config.py
+++ b/tests/config/unittest_config.py
@@ -97,5 +97,4 @@ class TestPyLinterOptionSetters(CheckerTestCase):
Compare against actual list to see if validator works."""
options = get_global_option(self.checker, "ignore-paths")
- # pylint: disable-next=use-implicit-booleaness-not-comparison
assert options == []
diff --git a/tests/conftest.py b/tests/conftest.py
index 5c2567d11..7a9c062db 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,5 +1,4 @@
# pylint: disable=redefined-outer-name
-# pylint: disable=no-name-in-module
import os
from pathlib import Path
diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py
index 865d7640b..8c3c12b9b 100644
--- a/tests/lint/unittest_lint.py
+++ b/tests/lint/unittest_lint.py
@@ -70,8 +70,6 @@ from pylint.typing import MessageLocationTuple
from pylint.utils import FileState, print_full_documentation, tokenize_module
if os.name == "java":
- # pylint: disable=no-member
- # os._name is valid see https://www.programcreek.com/python/example/3842/os._name
if os.name == "nt":
HOME = "USERPROFILE"
else:
@@ -799,7 +797,6 @@ class TestPreprocessOptions:
class _CustomPyLinter(PyLinter):
- # pylint: disable=too-many-ancestors
@staticmethod
def should_analyze_file(modname: str, path: str, is_argument: bool = False) -> bool:
if os.path.basename(path) == "wrong.py":
diff --git a/tests/profile/test_profile_against_externals.py b/tests/profile/test_profile_against_externals.py
index 14b6dae71..128a34738 100644
--- a/tests/profile/test_profile_against_externals.py
+++ b/tests/profile/test_profile_against_externals.py
@@ -7,7 +7,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-# pylint: disable=protected-access,missing-function-docstring,no-self-use
+# pylint: disable=missing-function-docstring
import os
import pprint
diff --git a/tests/pyreverse/test_diagrams.py b/tests/pyreverse/test_diagrams.py
index a2da6e27d..6eb797990 100644
--- a/tests/pyreverse/test_diagrams.py
+++ b/tests/pyreverse/test_diagrams.py
@@ -4,7 +4,6 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
"""Unit test for the diagrams modules"""
-# pylint: disable=redefined-outer-name
from typing import Callable
from pylint.pyreverse.diadefslib import DefaultDiadefGenerator, DiadefsHandler
diff --git a/tests/regrtest_data/unused_variable.py b/tests/regrtest_data/unused_variable.py
index eee909d53..88bb0e7a7 100644
--- a/tests/regrtest_data/unused_variable.py
+++ b/tests/regrtest_data/unused_variable.py
@@ -1,4 +1,4 @@
-# pylint: disable=missing-docstring
+# pylint: disable=missing-module-docstring, missing-function-docstring
def test():
variable = ''
diff --git a/tests/test_func.py b/tests/test_func.py
index 914fbbc92..575773bb9 100644
--- a/tests/test_func.py
+++ b/tests/test_func.py
@@ -55,7 +55,6 @@ class LintTestUsingModule:
def _test_functionality(self) -> None:
if self.module:
tocheck = [self.package + "." + self.module]
- # pylint: disable=not-an-iterable; can't handle boolean checks for now
if self.depends:
tocheck += [
self.package + f".{name.replace('.py', '')}" for name, _ in self.depends
diff --git a/tests/unittest_reporting.py b/tests/unittest_reporting.py
index 7400be9e5..22fdc905c 100644
--- a/tests/unittest_reporting.py
+++ b/tests/unittest_reporting.py
@@ -58,7 +58,7 @@ def test_template_option(linter):
def test_deprecation_set_output(recwarn):
- """TODO remove in 3.0""" # pylint: disable=fixme
+ """TODO remove in 3.0"""
reporter = BaseReporter()
# noinspection PyDeprecation
reporter.set_output(sys.stdout)