From a02b1892bec68b619bf1f5a7786e5e9bc5f34a91 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Fri, 1 May 2020 08:39:18 +0200 Subject: [PATCH 1/2] Revert pylint.Run's `exit` parameter to ``do_exit`` This has been inadvertently changed several releases ago to ``do_exit``. Close #3533 --- ChangeLog | 6 ++++++ pylint/lint/run.py | 6 ++++-- tests/benchmark/test_baseline_benchmarks.py | 2 +- tests/lint/unittest_lint.py | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58df80de37..3b83e46082 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,12 @@ Release date: TBA Close #3527 +* Revert pylint.Run's `exit` parameter to ``do_exit`` + + This has been inadvertently changed several releases ago to ``do_exit``. + + Close #3533 + What's New in Pylint 2.5.0? =========================== diff --git a/pylint/lint/run.py b/pylint/lint/run.py index b3d0b9f769..1f92e68af7 100644 --- a/pylint/lint/run.py +++ b/pylint/lint/run.py @@ -66,7 +66,9 @@ class Run: def _return_one(*args): # pylint: disable=unused-argument return 1 - def __init__(self, args, reporter=None, do_exit=True): + def __init__( + self, args, reporter=None, exit=True + ): # pylint: disable=redefined-builtin self._rcfile = None self._plugins = [] self.verbose = None @@ -337,7 +339,7 @@ def __init__(self, args, reporter=None, do_exit=True): linter.check(args) score_value = linter.generate_reports() - if do_exit: + if exit: if linter.config.exit_zero: sys.exit(0) else: diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py index 5909cbd6b5..d3e09f7163 100644 --- a/tests/benchmark/test_baseline_benchmarks.py +++ b/tests/benchmark/test_baseline_benchmarks.py @@ -286,7 +286,7 @@ def test_baseline_benchmark_j1_all_checks_single_file(self, benchmark): # Just 1 file, but all Checkers/Extensions fileinfos = [self.empty_filepath] - runner = benchmark(Run, fileinfos, reporter=Reporter(), do_exit=False) + runner = benchmark(Run, fileinfos, reporter=Reporter(), exit=False) assert runner.linter.config.jobs == 1 print("len(runner.linter._checkers)", len(runner.linter._checkers)) assert len(runner.linter._checkers) > 1, "Should have more than 'master'" diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py index 0afde2d233..462695169d 100644 --- a/tests/lint/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -518,7 +518,7 @@ def test_load_plugin_command_line(): run = Run( ["--load-plugins", "dummy_plugin", join(REGRTEST_DATA_DIR, "empty.py")], - do_exit=False, + exit=False, ) assert ( len([ch.name for ch in run.linter.get_checkers() if ch.name == "dummy_plugin"]) @@ -534,7 +534,7 @@ def test_load_plugin_config_file(): config_path = join(REGRTEST_DATA_DIR, "dummy_plugin.rc") run = Run( - ["--rcfile", config_path, join(REGRTEST_DATA_DIR, "empty.py")], do_exit=False, + ["--rcfile", config_path, join(REGRTEST_DATA_DIR, "empty.py")], exit=False, ) assert ( len([ch.name for ch in run.linter.get_checkers() if ch.name == "dummy_plugin"]) @@ -556,7 +556,7 @@ def test_load_plugin_configuration(): "foo,bar", join(REGRTEST_DATA_DIR, "empty.py"), ], - do_exit=False, + exit=False, ) assert run.linter.config.black_list == ["foo", "bar", "bin"] From 357922e933a0a4708470ac36fedbc0ecc114a425 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Fri, 1 May 2020 08:40:46 +0200 Subject: [PATCH 2/2] Lint pylint from toxinidir, not the installed one --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 59d9e4f39e..02a862e190 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ deps = isort pytest commands = - pylint -rn --rcfile={toxinidir}/pylintrc --load-plugins=pylint.extensions.docparams, pylint.extensions.mccabe {envsitepackagesdir}/pylint + pylint -rn --rcfile={toxinidir}/pylintrc --load-plugins=pylint.extensions.docparams, pylint.extensions.mccabe {toxinidir}/pylint # This would be greatly simplified by a solution for https://github.com/PyCQA/pylint/issues/352 pylint -rn --rcfile={toxinidir}/tests/.test_pylintrc --load-plugins=pylint.extensions.docparams, pylint.extensions.mccabe \ {toxinidir}/tests/message/ {toxinidir}/tests/extensions/ {toxinidir}/tests/utils/ {toxinidir}/tests/acceptance/ {toxinidir}/tests/conftest.py \