Method: pylint.checkers.unicode.UnicodeChecker._check_bidi_chars
Calls: 41740, Exceptions: 0, Paths: 3Back
Path 1: 41644 calls (1.0)
bytes (41644)
1 (1027) 2 (1005) 3 (984) 4 (961) 5 (926) 6 (847) 7 (801) 8 (754) 9 (741) 10 (680)
'utf-8' (41573) 'utf-16le' (35) 'utf-32le' (35) 'utf' (1)
1def _check_bidi_chars(self, line: bytes, lineno: int, codec: str) -> None:
2 """Look for Bidirectional Unicode, if we use unicode."""
3 if not self._is_unicode(codec):
4 return
5 for dangerous in BIDI_UNICODE:
6 if _cached_encode_search(dangerous, codec) in line:
7 # Note that we don't add a col_offset on purpose:
8 # Using these unicode characters it depends on the editor
9 # how it displays the location of characters in the line.
10 # So we mark the complete line.
11 self.add_message(
12 "bidirectional-unicode",
13 # Currently Nodes will lead to crashes of pylint
14 # node=node,
15 line=lineno,
16 end_lineno=lineno,
17 # We mark the complete line, as bidi controls make it hard
18 # to determine the correct cursor position within an editor
19 col_offset=0,
20 end_col_offset=_line_length(line, codec),
21 confidence=pylint.interfaces.HIGH,
22 )
23 # We look for bidirectional unicode only once per line
24 # as we mark the complete line anyway
25 break
Path 2: 55 calls (0.0)
bytes (55)
1 (50) 3 (2) 11 (1) 13 (1) 8 (1)
'utf-8' (13) 'utf-16le' (11) 'utf-32le' (11) 'utf-16be' (10) 'utf-32be' (10)
1def _check_bidi_chars(self, line: bytes, lineno: int, codec: str) -> None:
2 """Look for Bidirectional Unicode, if we use unicode."""
3 if not self._is_unicode(codec):
4 return
5 for dangerous in BIDI_UNICODE:
6 if _cached_encode_search(dangerous, codec) in line:
7 # Note that we don't add a col_offset on purpose:
8 # Using these unicode characters it depends on the editor
9 # how it displays the location of characters in the line.
10 # So we mark the complete line.
11 self.add_message(
12 "bidirectional-unicode",
13 # Currently Nodes will lead to crashes of pylint
14 # node=node,
15 line=lineno,
16 end_lineno=lineno,
17 # We mark the complete line, as bidi controls make it hard
18 # to determine the correct cursor position within an editor
19 col_offset=0,
20 end_col_offset=_line_length(line, codec),
21 confidence=pylint.interfaces.HIGH,
22 )
23 # We look for bidirectional unicode only once per line
24 # as we mark the complete line anyway
25 break
Path 3: 41 calls (0.0)
bytes (41)
1 (8) 2 (8) 3 (6) 4 (6) 5 (5) 6 (4) 7 (4)
'iso-8859-1' (25) 'ascii' (16)
None (41)
1def _check_bidi_chars(self, line: bytes, lineno: int, codec: str) -> None:
2 """Look for Bidirectional Unicode, if we use unicode."""
3 if not self._is_unicode(codec):
4 return
5 for dangerous in BIDI_UNICODE:
6 if _cached_encode_search(dangerous, codec) in line:
7 # Note that we don't add a col_offset on purpose:
8 # Using these unicode characters it depends on the editor
9 # how it displays the location of characters in the line.
10 # So we mark the complete line.
11 self.add_message(
12 "bidirectional-unicode",
13 # Currently Nodes will lead to crashes of pylint
14 # node=node,
15 line=lineno,
16 end_lineno=lineno,
17 # We mark the complete line, as bidi controls make it hard
18 # to determine the correct cursor position within an editor
19 col_offset=0,
20 end_col_offset=_line_length(line, codec),
21 confidence=pylint.interfaces.HIGH,
22 )
23 # We look for bidirectional unicode only once per line
24 # as we mark the complete line anyway
25 break