Method: pylint.checkers.format.FormatChecker.check_lines
Calls: 40198, Exceptions: 254, Paths: 9Back
Path 1: 36003 calls (0.9)
TokenWrapper (36003)
3 (863) 5 (522) 7 (370) 1 (367) 6 (364) 4 (338) 8 (275) 9 (240) 15 (230) 10 (220)
'\n' (10741) '\r\n' (661) ' pass\n' (654) ' pass\n' (408) ' """\n' (341) '"""\n' (199) ' def __init__(self):\n' (169) ' pass\r\...
4 (864) 3 (831) 5 (775) 6 (758) 7 (724) 2 (714) 8 (678) 9 (656) 11 (604) 10 (601)
None (36003)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 2: 2824 calls (0.07)
TokenWrapper (2824)
1 (574) 8 (57) 3 (39) 12 (33) 13 (22) 14 (21) 22 (20) 17 (19) 42 (17) 16 (15)
'"""Perfect module with only documentation for configuration tests."""\n' (50) ' """hehehe"""\n' (22) '""""\n pylint score: +7.50\n"""\n' (...
1 (574) 5 (95) 8 (55) 9 (51) 14 (46) 6 (45) 2 (44) 10 (43) 7 (39) 15 (34)
None (2824)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 3: 1113 calls (0.03)
TokenWrapper (1113)
1 (112) 10 (58) 39 (28) 28 (23) 22 (16) 26 (15) 15 (15) 16 (15) 9 (13) 41 (12)
'' (1113)
1 (112) 6 (80) 10 (61) 12 (48) 7 (46) 8 (34) 5 (32) 13 (27) 4 (26) 14 (26)
None (1113)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 4: 128 calls (0.0)
TokenWrapper (128)
3 (50) 1 (41) 4 (19) 5 (5) 6 (2) 7 (2) 53 (2) 36 (1) 48 (1) 25 (1)
'# pylint: disable=too-few-public-methods,missing-docstring,import-error,unnecessary-lambda-assignment\n' (9) '# pylint: disable=unused-import,ungroup...
2 (44) 1 (41) 3 (21) 4 (10) 6 (3) 5 (1) 18 (1) 24 (1) 27 (1) 11 (1)
GeneratorExit (128)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 5: 90 calls (0.0)
TokenWrapper (90)
65 (3) 13 (3) 315 (2) 97 (2) 109 (2) 1 (2) 5 (2) 423 (2) 3 (2) 156 (1)
'def func1(arg1: List[int], /, *args: List[int], arg2: set[int], **kwargs: Dict[str, int]) -> typing.Tuple[int]:\n' (3) 'class CustomImplementation(Cu...
38 (3) 3 (3) 14 (3) 99 (2) 9 (2) 24 (2) 42 (2) 85 (2) 17 (2) 19 (2)
GeneratorExit (90)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 6: 22 calls (0.0)
TokenWrapper (22)
1 (8) 4 (6) 3 (4) 6 (2) 7 (1) 25 (1)
'# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unnecessary-direct-lambda-call\n' (2) '# pylint: disable=missing-docst...
1 (8) 2 (3) 3 (3) 6 (2) 9 (1) 7 (1) 5 (1) 10 (1) 4 (1) 12 (1)
GeneratorExit (22)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 7: 11 calls (0.0)
TokenWrapper (11)
3 (2) 1 (1) 7 (1) 9 (1) 66 (1) 120 (1) 136 (1) 677 (1) 498 (1) 500 (1)
'""" Test for a crash found in\r\nhttps://bitbucket.org/logilab/astroid/issue/45/attributeerror-module-object-has-no#comment-11944673\r\n"""\r\n' (1) ...
2 (2) 1 (1) 4 (1) 5 (1) 32 (1) 61 (1) 72 (1) 150 (1) 99 (1) 100 (1)
GeneratorExit (11)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 8: 4 calls (0.0)
TokenWrapper (4)
1 (3) 10 (1)
"'Empty'" (2) 'print(1)' (1) 'a,b = object()' (1)
1 (3) 4 (1)
None (4)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)
Path 9: 3 calls (0.0)
TokenWrapper (3)
83 (1) 100 (1) 146 (1)
' """\r\n # pylint: disable=line-too-long\r\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbb...
41 (1) 50 (1) 77 (1)
GeneratorExit (3)
1def check_lines(
2 self, tokens: TokenWrapper, line_start: int, lines: str, lineno: int
3 ) -> None:
4 """Check given lines for potential messages.
5
6 Check if lines have:
7 - a final newline
8 - no trailing white-space
9 - less than a maximum number of characters
10 """
11 # we're first going to do a rough check whether any lines in this set
12 # go over the line limit. If none of them do, then we don't need to
13 # parse out the pylint options later on and can just assume that these
14 # lines are clean
15
16 # we'll also handle the line ending check here to avoid double-iteration
17 # unless the line lengths are suspect
18
19 max_chars = self.linter.config.max_line_length
20
21 split_lines = self.specific_splitlines(lines)
22
23 for offset, line in enumerate(split_lines):
24 if not line.endswith("\n"):
25 self.add_message("missing-final-newline", line=lineno + offset)
26 continue
27 # We don't test for trailing whitespaces in strings
28 # See https://github.com/PyCQA/pylint/issues/6936
29 # and https://github.com/PyCQA/pylint/issues/3822
30 if tokens.type(line_start) != tokenize.STRING:
31 self.check_trailing_whitespace_ending(line, lineno + offset)
32
33 # This check is purposefully simple and doesn't rstrip since this is running
34 # on every line you're checking it's advantageous to avoid doing a lot of work
35 potential_line_length_warning = any(
36 len(line) > max_chars for line in split_lines
37 )
38
39 # if there were no lines passing the max_chars config, we don't bother
40 # running the full line check (as we've met an even more strict condition)
41 if not potential_line_length_warning:
42 return
43
44 # Line length check may be deactivated through `pylint: disable` comment
45 mobj = OPTION_PO.search(lines)
46 checker_off = False
47 if mobj:
48 if not self.is_line_length_check_activated(mobj):
49 checker_off = True
50 # The 'pylint: disable whatever' should not be taken into account for line length count
51 lines = self.remove_pylint_option_from_lines(mobj)
52
53 # here we re-run specific_splitlines since we have filtered out pylint options above
54 for offset, line in enumerate(self.specific_splitlines(lines)):
55 self.check_line_length(line, lineno + offset, checker_off)