Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deprecation] Remove 'do_exit' from the 'Run' constructor #8472

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the sentinel as well right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

) -> 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)