summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhippo91 <guillaume.peillex@gmail.com>2017-12-15 10:32:45 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2017-12-15 10:32:45 +0100
commitb9061a0596457cf89ddd3dcf65c8aae7fb241e69 (patch)
tree29c5874d864b4a3d8f6165c8d92d47770123939e
parentd42e74bb9428f895f36808d30bd8a1fe31e28f63 (diff)
downloadpylint-git-b9061a0596457cf89ddd3dcf65c8aae7fb241e69.tar.gz
Pylint doesn't take anymore the default rcfile if the rcfile specified on the command line doesn't exist (#1768)
-rw-r--r--ChangeLog4
-rw-r--r--doc/whatsnew/1.8.rst3
-rw-r--r--pylint/config.py2
-rw-r--r--pylint/test/test_self.py6
4 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 516add570..7dd741665 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -173,6 +173,10 @@ What's New in Pylint 1.8?
of ``line-too-long`` message for long commented lines.
Close #1741
+ * If the rcfile specified on the command line doesn't exist, then an
+ IOError exception is raised.
+ Close #1747
+
What's New in Pylint 1.7.1?
=========================
diff --git a/doc/whatsnew/1.8.rst b/doc/whatsnew/1.8.rst
index be4740439..6180d5705 100644
--- a/doc/whatsnew/1.8.rst
+++ b/doc/whatsnew/1.8.rst
@@ -364,3 +364,6 @@ Other Changes
* Fix ``line-too-long`` message deactivated by wrong disable directive.
The directive ``disable=fixme`` doesn't deactivate anymore the emission
of ``line-too-long`` message for long commented lines.
+
+* If the rcfile specified on the command line doesn't exist, then an
+ IOError exception is raised.
diff --git a/pylint/config.py b/pylint/config.py
index 2bde09eff..22a6be0de 100644
--- a/pylint/config.py
+++ b/pylint/config.py
@@ -626,6 +626,8 @@ class OptionsManagerMixIn(object):
config_file = self.config_file
if config_file is not None:
config_file = os.path.expanduser(config_file)
+ if not os.path.exists(config_file):
+ raise IOError("The config file {:s} doesn't exist!".format(config_file))
use_config_file = config_file and os.path.exists(config_file)
if use_config_file:
diff --git a/pylint/test/test_self.py b/pylint/test/test_self.py
index 72c28d85d..7db4f962e 100644
--- a/pylint/test/test_self.py
+++ b/pylint/test/test_self.py
@@ -169,6 +169,12 @@ class TestRunTC(object):
output = out.getvalue()
assert "profile" not in output
+ def test_inexisting_rcfile(self):
+ out = six.StringIO()
+ with pytest.raises(IOError) as excinfo:
+ self._run_pylint(["--rcfile=/tmp/norcfile.txt"], out=out)
+ assert "The config file /tmp/norcfile.txt doesn't exist!" == str(excinfo.value)
+
def test_help_message_option(self):
self._runtest(['--help-msg', 'W0101'], code=0)