Method: pylint.checkers.format.FormatChecker.check_indent_level
Calls: 23631, Exceptions: 0, Paths: 4Back
Path 1: 14647 calls (0.62)
' ' (4110) ' ' (3019) ' ' (668) ' ' (179) ' def __init__(self):\n' (109) ' else:\n' (105) ' else:\n' ...
1 (9085) 2 (4368) 3 (911) 4 (212) 5 (51) 6 (13) 7 (6) 8 (1)
9 (290) 10 (258) 11 (258) 8 (251) 12 (231) 15 (227) 13 (205) 7 (204) 17 (202) 20 (201)
1def check_indent_level(self, string: str, expected: int, line_num: int) -> None:
2 """Return the indent level of the string."""
3 indent = self.linter.config.indent_string
4 if indent == "\\t": # \t is not interpreted in the configuration file
5 indent = "\t"
6 level = 0
7 unit_size = len(indent)
8 while string[:unit_size] == indent:
9 string = string[unit_size:]
10 level += 1
11 suppl = ""
12 while string and string[0] in " \t":
13 suppl += string[0]
14 string = string[1:]
15 if level != expected or suppl:
16 i_type = "spaces"
17 if indent[0] == "\t":
18 i_type = "tabs"
19 self.add_message(
20 "bad-indentation",
21 line=line_num,
22 args=(level * unit_size + len(suppl), i_type, expected * unit_size),
23 )
Path 2: 8932 calls (0.38)
'' (993) 'try:\n' (113) 'else:\n' (53) 'import os\n' (46) 'class Foo:\n' (44) 'def func():\n' (41) 'class MyClass:\n' (35) 'import typing\n' (32) 'def...
0 (8932)
6 (345) 5 (332) 7 (304) 4 (292) 8 (270) 10 (238) 9 (211) 12 (187) 13 (186) 14 (180)
1def check_indent_level(self, string: str, expected: int, line_num: int) -> None:
2 """Return the indent level of the string."""
3 indent = self.linter.config.indent_string
4 if indent == "\\t": # \t is not interpreted in the configuration file
5 indent = "\t"
6 level = 0
7 unit_size = len(indent)
8 while string[:unit_size] == indent:
9 string = string[unit_size:]
10 level += 1
11 suppl = ""
12 while string and string[0] in " \t":
13 suppl += string[0]
14 string = string[1:]
15 if level != expected or suppl:
16 i_type = "spaces"
17 if indent[0] == "\t":
18 i_type = "tabs"
19 self.add_message(
20 "bad-indentation",
21 line=line_num,
22 args=(level * unit_size + len(suppl), i_type, expected * unit_size),
23 )
Path 3: 51 calls (0.0)
'\t' (12) '\tfor i in range(5):\n' (12) '\t\t' (12) '\tprint(count)\n' (12) ' ' (2) ' ' (1)
1 (39) 2 (12)
8 (12) 9 (12) 10 (12) 11 (12) 5 (2) 2 (1)
1def check_indent_level(self, string: str, expected: int, line_num: int) -> None:
2 """Return the indent level of the string."""
3 indent = self.linter.config.indent_string
4 if indent == "\\t": # \t is not interpreted in the configuration file
5 indent = "\t"
6 level = 0
7 unit_size = len(indent)
8 while string[:unit_size] == indent:
9 string = string[unit_size:]
10 level += 1
11 suppl = ""
12 while string and string[0] in " \t":
13 suppl += string[0]
14 string = string[1:]
15 if level != expected or suppl:
16 i_type = "spaces"
17 if indent[0] == "\t":
18 i_type = "tabs"
19 self.add_message(
20 "bad-indentation",
21 line=line_num,
22 args=(level * unit_size + len(suppl), i_type, expected * unit_size),
23 )
Path 4: 1 calls (0.0)
' ' (1)
1 (1)
11 (1)
1def check_indent_level(self, string: str, expected: int, line_num: int) -> None:
2 """Return the indent level of the string."""
3 indent = self.linter.config.indent_string
4 if indent == "\\t": # \t is not interpreted in the configuration file
5 indent = "\t"
6 level = 0
7 unit_size = len(indent)
8 while string[:unit_size] == indent:
9 string = string[unit_size:]
10 level += 1
11 suppl = ""
12 while string and string[0] in " \t":
13 suppl += string[0]
14 string = string[1:]
15 if level != expected or suppl:
16 i_type = "spaces"
17 if indent[0] == "\t":
18 i_type = "tabs"
19 self.add_message(
20 "bad-indentation",
21 line=line_num,
22 args=(level * unit_size + len(suppl), i_type, expected * unit_size),
23 )