summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-30 09:26:02 +0200
committerGitHub <noreply@github.com>2021-03-30 09:26:02 +0200
commitc92e3ab78778aa1afcf4ddca4829245d37fbc095 (patch)
tree4776f4c73f73f3b278d7db207f585799c2b23d3b
parentc1c41b849ce070447f3efe4ed1a91068d4c85362 (diff)
downloadpylint-git-c92e3ab78778aa1afcf4ddca4829245d37fbc095.tar.gz
Fix disabled warning not ignored (#4268)pylint-2.7.4
* Fix ignores all disabled warnings #4265 * Update changelog and prepare 2.7.4
-rw-r--r--ChangeLog7
-rw-r--r--pylint/__pkginfo__.py4
-rw-r--r--pylint/message/message_handler_mix_in.py12
-rw-r--r--tests/functional/d/disabled_msgid_in_pylintrc.py6
-rw-r--r--tests/functional/d/disabled_msgid_in_pylintrc.rc4
5 files changed, 26 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index f079cfe1a..37cedad05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,11 +13,16 @@ Release date: Undefined
What's New in Pylint 2.7.4?
===========================
-Release date: Undefined
+Release date: 2021-03-30
..
Put bug fixes that will be cherry-picked to latest major version here
+
+* Fix a problem with disabled msgid not being ignored
+
+ Closes #4265
+
* Fix issue with annotated class constants
* Closes #4264
diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py
index cdf872871..1ba79927e 100644
--- a/pylint/__pkginfo__.py
+++ b/pylint/__pkginfo__.py
@@ -31,8 +31,8 @@
from os.path import join
# For an official release, use dev_version = None
-numversion = (2, 8, 0)
-dev_version = 1
+numversion = (2, 7, 4)
+dev_version = None
version = ".".join(str(num) for num in numversion)
if dev_version is not None:
diff --git a/pylint/message/message_handler_mix_in.py b/pylint/message/message_handler_mix_in.py
index 8667c84f8..2a15a76bb 100644
--- a/pylint/message/message_handler_mix_in.py
+++ b/pylint/message/message_handler_mix_in.py
@@ -45,10 +45,14 @@ class MessagesHandlerMixIn:
def _register_by_id_managed_msg(self, msgid_or_symbol: str, line, is_disabled=True):
"""If the msgid is a numeric one, then register it to inform the user
it could furnish instead a symbolic msgid."""
- if msgid_or_symbol[1:].isdigit():
- symbol = self.msgs_store.message_id_store.get_symbol(msgid=msgid_or_symbol) # type: ignore
- managed = (self.current_name, msgid_or_symbol, symbol, line, is_disabled) # type: ignore
- MessagesHandlerMixIn.__by_id_managed_msgs.append(managed)
+ try:
+ if msgid_or_symbol[1:].isdigit():
+ symbol = self.msgs_store.message_id_store.get_symbol(msgid=msgid_or_symbol) # type: ignore
+ msgid = msgid_or_symbol
+ managed = (self.current_name, msgid, symbol, line, is_disabled) # type: ignore
+ MessagesHandlerMixIn.__by_id_managed_msgs.append(managed)
+ except KeyError:
+ pass
def disable(self, msgid, scope="package", line=None, ignore_unknown=False):
"""Don't output message of the given id"""
diff --git a/tests/functional/d/disabled_msgid_in_pylintrc.py b/tests/functional/d/disabled_msgid_in_pylintrc.py
new file mode 100644
index 000000000..09ddf1147
--- /dev/null
+++ b/tests/functional/d/disabled_msgid_in_pylintrc.py
@@ -0,0 +1,6 @@
+"""https://github.com/PyCQA/pylint/issues/4265"""
+
+try:
+ f = open('test')
+except Exception:
+ pass
diff --git a/tests/functional/d/disabled_msgid_in_pylintrc.rc b/tests/functional/d/disabled_msgid_in_pylintrc.rc
new file mode 100644
index 000000000..2964930df
--- /dev/null
+++ b/tests/functional/d/disabled_msgid_in_pylintrc.rc
@@ -0,0 +1,4 @@
+[MESSAGES CONTROL]
+
+disable=
+ C0111,C0326,W0703