Skip to content

Commit

Permalink
pylint.Run accepts do_exit as a deprecated parameter
Browse files Browse the repository at this point in the history
We need to allow various third party libraries that depend on `pylint` to still use
`do_exit` until they can move over to `exit`.

Close #3590
  • Loading branch information
PCManticore committed May 5, 2020
1 parent cfa61e9 commit 25223a9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Pylint's ChangeLog
------------------

What's New in Pylint 2.5.2?
===========================

Release date: TBA

* ``pylint.Run`` accepts ``do_exit`` as a deprecated parameter

Close #3590

What's New in Pylint 2.5.1?
===========================

Expand Down
14 changes: 13 additions & 1 deletion pylint/lint/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import sys
import warnings

from pylint import __pkginfo__, config, extensions, interfaces
from pylint.lint.pylinter import PyLinter
Expand Down Expand Up @@ -47,6 +48,9 @@ def cb_init_hook(optname, value):
exec(value) # pylint: disable=exec-used


UNUSED_PARAM_SENTINEL = object()


class Run:
"""helper class to use as main for pylint :
Expand All @@ -67,7 +71,7 @@ def _return_one(*args): # pylint: disable=unused-argument
return 1

def __init__(
self, args, reporter=None, exit=True
self, args, reporter=None, exit=True, do_exit=UNUSED_PARAM_SENTINEL,
): # pylint: disable=redefined-builtin
self._rcfile = None
self._plugins = []
Expand Down Expand Up @@ -339,6 +343,14 @@ def __init__(

linter.check(args)
score_value = linter.generate_reports()

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

if exit:
if linter.config.exit_zero:
sys.exit(0)
Expand Down

0 comments on commit 25223a9

Please sign in to comment.