Skip to content

Commit

Permalink
[deprecation] Remove 'do_exit' from the 'Run' constructor (#8472)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas authored Mar 21, 2023
1 parent 77a392d commit d659575
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/8472.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Following a deprecation period, the ``do_exit`` argument of the ``Run`` class (and of the ``_Run``
class in testutils) were removed.

Refs #8472
16 changes: 1 addition & 15 deletions pylint/lint/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import warnings
from collections.abc import Sequence
from pathlib import Path
from typing import Any, ClassVar
from typing import ClassVar

from pylint import config
from pylint.checkers.utils import clear_lru_caches
Expand Down Expand Up @@ -97,9 +97,6 @@ def _cpu_count() -> int:
return cpu_count


UNUSED_PARAM_SENTINEL = object()


class Run:
"""Helper class to use as main for pylint with 'run(*sys.argv[1:])'."""

Expand All @@ -123,7 +120,6 @@ def __init__(
args: Sequence[str],
reporter: BaseReporter | None = None,
exit: bool = True, # pylint: disable=redefined-builtin
do_exit: Any = UNUSED_PARAM_SENTINEL,
) -> None:
# Immediately exit if user asks for version
if "--version" in args:
Expand Down Expand Up @@ -215,16 +211,6 @@ def __init__(
else:
linter.check(args)
score_value = linter.generate_reports()

if do_exit is not UNUSED_PARAM_SENTINEL:
# TODO: 3.0
warnings.warn(
"do_exit is deprecated and it is going to be removed in a future version.",
DeprecationWarning,
stacklevel=2,
)
exit = do_exit

if linter.config.clear_cache_post_run:
clear_lru_caches()
MANAGER.clear_cache()
Expand Down
5 changes: 1 addition & 4 deletions pylint/testutils/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
from __future__ import annotations

from collections.abc import Sequence
from typing import Any

from pylint.lint import Run as LintRun
from pylint.lint.run import UNUSED_PARAM_SENTINEL
from pylint.reporters.base_reporter import BaseReporter
from pylint.testutils.lint_module_test import PYLINTRC

Expand All @@ -39,7 +37,6 @@ def __init__(
args: Sequence[str],
reporter: BaseReporter | None = None,
exit: bool = True, # pylint: disable=redefined-builtin
do_exit: Any = UNUSED_PARAM_SENTINEL,
) -> None:
args = _add_rcfile_default_pylintrc(list(args))
super().__init__(args, reporter, exit, do_exit)
super().__init__(args, reporter, exit)

0 comments on commit d659575

Please sign in to comment.