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

Fix disabled warning not ignored #4268

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pylint/__pkginfo__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 8 additions & 4 deletions pylint/message/message_handler_mix_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ def get_by_id_managed_msgs(cls):
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"""
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/d/disabled_msgid_in_pylintrc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""https://github.com/PyCQA/pylint/issues/4265"""

try:
f = open('test')
except Exception:
pass
4 changes: 4 additions & 0 deletions tests/functional/d/disabled_msgid_in_pylintrc.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[MESSAGES CONTROL]

disable=
C0111,C0326,W0703