Skip to content

Commit d8174d4

Browse files
committed
Refactor 'class_checks.py'
1 parent 78496d7 commit d8174d4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

gdtoolkit/linter/class_checks.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def lint(parse_tree: Tree, config: MappingProxyType) -> List[Problem]:
2020
),
2121
] # type: List[Tuple[str, Callable]]
2222
problem_clusters = (
23-
x[1](parse_tree) if x[0] not in disable else [] for x in checks_to_run_w_tree
23+
function(parse_tree) if name not in disable else []
24+
for name, function in checks_to_run_w_tree
2425
)
2526
problems = [problem for cluster in problem_clusters for problem in cluster]
2627
checks_to_run_w_ast = [
@@ -31,7 +32,8 @@ def lint(parse_tree: Tree, config: MappingProxyType) -> List[Problem]:
3132
]
3233
ast = AbstractSyntaxTree(parse_tree)
3334
problem_clusters = (
34-
x[1](ast) if x[0] not in disable else [] for x in checks_to_run_w_ast
35+
function(ast) if name not in disable else []
36+
for name, function in checks_to_run_w_ast
3537
)
3638
problems += [problem for cluster in problem_clusters for problem in cluster]
3739
return problems
@@ -50,7 +52,7 @@ def _private_method_call_check(parse_tree: Tree) -> List[Problem]:
5052
and called.value == "self"
5153
):
5254
continue
53-
if not _is_method_private(callee_name):
55+
if is_function_public(callee_name):
5456
continue
5557
problems.append(
5658
Problem(
@@ -63,11 +65,6 @@ def _private_method_call_check(parse_tree: Tree) -> List[Problem]:
6365
return problems
6466

6567

66-
# TODO: drop
67-
def _is_method_private(method_name: str) -> bool:
68-
return method_name.startswith("_") # TODO: consider making configurable
69-
70-
7168
def _class_definitions_order_check(
7269
order: List[str], ast: AbstractSyntaxTree
7370
) -> List[Problem]:

0 commit comments

Comments
 (0)