summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-05-05 14:05:26 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2020-05-05 14:24:05 +0200
commit25223a9e2b84e3f8977ed70f34ee90bb99d4071f (patch)
treef57c1f0dbc8552c20c9d4358c6015857ff8a0e6b
parentcfa61e9c8525098f51801f5fc101953e41492ef9 (diff)
downloadpylint-git-25223a9e2b84e3f8977ed70f34ee90bb99d4071f.tar.gz
``pylint.Run`` accepts ``do_exit`` as a deprecated parameter
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
-rw-r--r--ChangeLog9
-rw-r--r--pylint/lint/run.py14
2 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bb3e6b20..cbeb70816 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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?
===========================
diff --git a/pylint/lint/run.py b/pylint/lint/run.py
index 1f92e68af..b5b1624fd 100644
--- a/pylint/lint/run.py
+++ b/pylint/lint/run.py
@@ -3,6 +3,7 @@
import os
import sys
+import warnings
from pylint import __pkginfo__, config, extensions, interfaces
from pylint.lint.pylinter import PyLinter
@@ -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 :
@@ -67,7 +71,7 @@ group are mutually exclusive.",
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 = []
@@ -339,6 +343,14 @@ group are mutually exclusive.",
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)