Skip to content

Commit 5d07894

Browse files
DanielNoordPierre-Sassoulas
authored andcommitted
Fix parsing of unknown message IDs
1 parent a693ea7 commit 5d07894

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

pylint/config/callback_actions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,13 @@ def __call__(
378378
) -> None:
379379
assert isinstance(values, (tuple, list))
380380
msgids = utils._check_csv(values[0])
381-
try:
382-
for msgid in msgids:
381+
for msgid in msgids:
382+
try:
383383
self.linter.disable(msgid)
384-
except exceptions.UnknownMessageError:
385-
# pylint: disable-next=fixme
386-
# TODO: Optparse: Raise an informational warning here
387-
pass
384+
except exceptions.UnknownMessageError:
385+
# pylint: disable-next=fixme
386+
# TODO: Optparse: Raise an informational warning here
387+
pass
388388

389389

390390
class _EnableAction(_AccessLinterObjectAction):
@@ -399,13 +399,13 @@ def __call__(
399399
) -> None:
400400
assert isinstance(values, (tuple, list))
401401
msgids = utils._check_csv(values[0])
402-
try:
403-
for msgid in msgids:
402+
for msgid in msgids:
403+
try:
404404
self.linter.enable(msgid)
405-
except exceptions.UnknownMessageError:
406-
# pylint: disable-next=fixme
407-
# TODO: Optparse: Raise an informational warning here
408-
pass
405+
except exceptions.UnknownMessageError:
406+
# pylint: disable-next=fixme
407+
# TODO: Optparse: Raise an informational warning here
408+
pass
409409

410410

411411
class _OutputFormatAction(_AccessLinterObjectAction):

tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.result.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"functional_append": {
3-
"enable": ["locally-disabled"]
3+
"enable": ["locally-disabled"],
4+
"disable": ["logging-format-interpolation"]
45
},
56
"functional_remove": {
67
"disable": ["locally-disabled"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Check the behavior for unkonwn symbol/msgid
2+
# (Originally) reported in https://github.com/PyCQA/pylint/pull/6293
3+
24
[tool.pylint."messages control"]
35
disable = "logging-not-layzy,logging-format-interpolation"
46
enable = "locally-disabled,C00000"

0 commit comments

Comments
 (0)