File tree 2 files changed +3
-34
lines changed
2 files changed +3
-34
lines changed Original file line number Diff line number Diff line change 2
2
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
3
3
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
4
4
5
- """Basic checker for Python code."""
6
5
7
6
__all__ = [
8
7
"NameChecker" ,
17
16
18
17
from typing import TYPE_CHECKING
19
18
20
- from astroid import nodes
21
-
22
19
from pylint .checkers .base .basic_checker import BasicChecker
23
20
from pylint .checkers .base .basic_error_checker import BasicErrorChecker
24
21
from pylint .checkers .base .comparison_checker import ComparisonChecker
39
36
from pylint .lint import PyLinter
40
37
41
38
42
- UNITTEST_CASE = "unittest.case"
43
-
44
-
45
- LOOPLIKE_NODES = (
46
- nodes .For ,
47
- nodes .ListComp ,
48
- nodes .SetComp ,
49
- nodes .DictComp ,
50
- nodes .GeneratorExp ,
51
- )
52
-
53
-
54
- def in_loop (node : nodes .NodeNG ) -> bool :
55
- """Return whether the node is inside a kind of for loop."""
56
- return any (isinstance (parent , LOOPLIKE_NODES ) for parent in node .node_ancestors ())
57
-
58
-
59
- def in_nested_list (nested_list , obj ):
60
- """Return true if the object is an element of <nested_list> or of a nested
61
- list
62
- """
63
- for elmt in nested_list :
64
- if isinstance (elmt , (list , tuple )):
65
- if in_nested_list (elmt , obj ):
66
- return True
67
- elif elmt == obj :
68
- return True
69
- return False
70
-
71
-
72
39
def register (linter : "PyLinter" ) -> None :
73
40
linter .register_checker (BasicErrorChecker (linter ))
74
41
linter .register_checker (BasicChecker (linter ))
Original file line number Diff line number Diff line change 2
2
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
3
3
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
4
4
5
- """Permits separating multiple checks with the same checker name into classes/file ."""
5
+ """Basic checker for Python code ."""
6
6
7
7
import collections
8
8
import itertools
30
30
31
31
32
32
class _BasicChecker (BaseChecker ):
33
+ """Permits separating multiple checks with the same checker name into classes/file."""
34
+
33
35
__implements__ = IAstroidChecker
34
36
name = "basic"
35
37
You can’t perform that action at this time.
0 commit comments