Method: pylint.checkers.strings.StringConstantChecker.check_for_concatenated_strings
Calls: 8756, Exceptions: 0, Paths: 11Back
Path 1: 5180 calls (0.59)
list (5180)
'call' (2924) 'list' (1310) 'tuple' (904) 'set' (42)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 2: 1977 calls (0.23)
[] (1977)
'call' (1777) 'list' (154) 'tuple' (46)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 3: 1244 calls (0.14)
list (1244)
'call' (739) 'assignment' (352) 'list' (102) 'tuple' (46) 'set' (5)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 4: 313 calls (0.04)
list (313)
'call' (217) 'tuple' (75) 'list' (18) 'set' (3)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 5: 25 calls (0.0)
list (25)
'assignment' (20) 'call' (4) 'list' (1)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 6: 8 calls (0.0)
list (8)
'call' (3) 'list' (2) 'tuple' (1) 'set' (1) 'assignment' (1)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 7: 3 calls (0.0)
list (3)
'assignment' (1) 'tuple' (1) 'call' (1)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 8: 2 calls (0.0)
list (2)
'tuple' (2)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 9: 2 calls (0.0)
list (2)
'tuple' (1) 'call' (1)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 10: 1 calls (0.0)
list (1)
'tuple' (1)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )
Path 11: 1 calls (0.0)
list (1)
'call' (1)
1def check_for_concatenated_strings(
2 self, elements: Sequence[nodes.NodeNG], iterable_type: str
3 ) -> None:
4 for elt in elements:
5 if not (
6 isinstance(elt, nodes.Const) and elt.pytype() in _AST_NODE_STR_TYPES
7 ):
8 continue
9 if elt.col_offset < 0:
10 # This can happen in case of escaped newlines
11 continue
12 token_index = (elt.lineno, elt.col_offset)
13 if token_index not in self.string_tokens:
14 # This may happen with Latin1 encoding
15 # cf. https://github.com/PyCQA/pylint/issues/2610
16 continue
17 matching_token, next_token = self.string_tokens[token_index]
18 # We detect string concatenation: the AST Const is the
19 # combination of 2 string tokens
20 if matching_token != elt.value and next_token is not None:
21 if next_token.type == tokenize.STRING and (
22 next_token.start[0] == elt.lineno
23 or self.linter.config.check_str_concat_over_line_jumps
24 ):
25 self.add_message(
26 "implicit-str-concat",
27 line=elt.lineno,
28 args=(iterable_type,),
29 confidence=HIGH,
30 )