diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 09:12:12 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 09:31:13 +0200 |
commit | ca9d4027692c26fea38a0a0dd5c8e31c2edf0d57 (patch) | |
tree | 30cc4a61aa2cc69551e55c2ce1c36c6b33a3b40e | |
parent | cec5b172a19761ceadb83cd92df04b8f4f09bb67 (diff) | |
download | pylint-git-ca9d4027692c26fea38a0a0dd5c8e31c2edf0d57.tar.gz |
[unused-private-member] Create functions for each part of the check
-rw-r--r-- | pylint/checkers/classes.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 4c9228d2d..b76b48087 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -898,11 +898,12 @@ a metaclass class method.", check that instance attributes are defined in __init__ and check access to existent members """ - self._check_unused_private_members(node) + self._check_unused_private_functions(node) + self._check_unused_private_variables(node) + self._check_unused_private_attributes(node) self._check_attribute_defined_outside_init(node) - def _check_unused_private_members(self, node: astroid.ClassDef) -> None: - # Check for unused private functions + def _check_unused_private_functions(self, node: astroid.ClassDef) -> None: for function_def in node.nodes_of_class(astroid.FunctionDef): function_def = cast(astroid.FunctionDef, function_def) if not is_attr_private(function_def.name): @@ -936,7 +937,7 @@ a metaclass class method.", args=(node.name, function_repr), ) - # Check for unused private variables + def _check_unused_private_variables(self, node: astroid.ClassDef) -> None: for assign_name in node.nodes_of_class(astroid.AssignName): found = False if isinstance(assign_name.parent, astroid.Arguments): @@ -960,7 +961,7 @@ a metaclass class method.", args=(node.name, assign_name.name), ) - # Check for unused private attributes + def _check_unused_private_attributes(self, node: astroid.ClassDef) -> None: for assign_attr in node.nodes_of_class(astroid.AssignAttr): found = False if not is_attr_private(assign_attr.attrname): |