Method: pylint.lint.message_state_handler._MessageStateHandler.is_message_enabled
Calls: 582174, Exceptions: 541898, Paths: 3Back
Path 1: 581106 calls (1.0)
'cell-var-from-loop' (11535) 'non-ascii-name' (9108) 'not-an-iterable' (8136) 'I0020' (7577) 'disallowed-name' (6012) 'redefined-outer-name' (5577) 't...
None (554588) 1 (1962) 2 (1235) 3 (1093) 4 (1060) 5 (850) 6 (786) 0 (634) 7 (616) 8 (602)
None (557269) Confidence (23837)
True (540840) False (40266)
GeneratorExit (540840)
1def is_message_enabled(
2 self,
3 msg_descr: str,
4 line: int | None = None,
5 confidence: interfaces.Confidence | None = None,
6 ) -> bool:
7 """Return whether this message is enabled for the current file, line and
8 confidence level.
9
10 This function can't be cached right now as the line is the line of
11 the currently analysed file (self.file_state), if it changes, then the
12 result for the same msg_descr/line might need to change.
13
14 :param msg_descr: Either the msgid or the symbol for a MessageDefinition
15 :param line: The line of the currently analysed file
16 :param confidence: The confidence of the message
17 """
18 if confidence and confidence.name not in self.linter.config.confidence:
19 return False
20 try:
21 msgids = self.linter.msgs_store.message_id_store.get_active_msgids(
22 msg_descr
23 )
24 except exceptions.UnknownMessageError:
25 # The linter checks for messages that are not registered
26 # due to version mismatch, just treat them as message IDs
27 # for now.
28 msgids = [msg_descr]
29 return any(self._is_one_message_enabled(msgid, line) for msgid in msgids)
Path 2: 1058 calls (0.0)
'dict-items-missing-iter' (1017) 'logging-fstring-formatting' (29) 'unbalanced_dict_unpacking' (6) 'magic-comparison' (4) 'W0113' (2)
None (1029) 16 (3) 17 (3) 18 (2) 19 (2) 20 (2) 5 (2) 8 (2) 11 (2) 13 (2)
None (1058)
True (1058)
GeneratorExit (1058)
1def is_message_enabled(
2 self,
3 msg_descr: str,
4 line: int | None = None,
5 confidence: interfaces.Confidence | None = None,
6 ) -> bool:
7 """Return whether this message is enabled for the current file, line and
8 confidence level.
9
10 This function can't be cached right now as the line is the line of
11 the currently analysed file (self.file_state), if it changes, then the
12 result for the same msg_descr/line might need to change.
13
14 :param msg_descr: Either the msgid or the symbol for a MessageDefinition
15 :param line: The line of the currently analysed file
16 :param confidence: The confidence of the message
17 """
18 if confidence and confidence.name not in self.linter.config.confidence:
19 return False
20 try:
21 msgids = self.linter.msgs_store.message_id_store.get_active_msgids(
22 msg_descr
23 )
24 except exceptions.UnknownMessageError:
25 # The linter checks for messages that are not registered
26 # due to version mismatch, just treat them as message IDs
27 # for now.
28 msgids = [msg_descr]
29 return any(self._is_one_message_enabled(msgid, line) for msgid in msgids)
Path 3: 10 calls (0.0)
'I0011' (5) 'I0021' (3) 'I0020' (2)
1 (6) 2 (2) 0 (1) 3 (1)
Confidence (10)
False (10)
1def is_message_enabled(
2 self,
3 msg_descr: str,
4 line: int | None = None,
5 confidence: interfaces.Confidence | None = None,
6 ) -> bool:
7 """Return whether this message is enabled for the current file, line and
8 confidence level.
9
10 This function can't be cached right now as the line is the line of
11 the currently analysed file (self.file_state), if it changes, then the
12 result for the same msg_descr/line might need to change.
13
14 :param msg_descr: Either the msgid or the symbol for a MessageDefinition
15 :param line: The line of the currently analysed file
16 :param confidence: The confidence of the message
17 """
18 if confidence and confidence.name not in self.linter.config.confidence:
19 return False
20 try:
21 msgids = self.linter.msgs_store.message_id_store.get_active_msgids(
22 msg_descr
23 )
24 except exceptions.UnknownMessageError:
25 # The linter checks for messages that are not registered
26 # due to version mismatch, just treat them as message IDs
27 # for now.
28 msgids = [msg_descr]
29 return any(self._is_one_message_enabled(msgid, line) for msgid in msgids)