summaryrefslogtreecommitdiff
path: root/pylint/checkers
diff options
context:
space:
mode:
authorAndy Young <a7young@ucsd.edu>2022-05-03 08:32:26 -0700
committerGitHub <noreply@github.com>2022-05-03 17:32:26 +0200
commit6aa336f529de03a170d9538dcd5f581109f9dd9e (patch)
treed70eced9d5de1860e54a22f69efec30b3bc3f170 /pylint/checkers
parentf2f3182150008e152009d94098143192a83d3faf (diff)
downloadpylint-git-6aa336f529de03a170d9538dcd5f581109f9dd9e.tar.gz
Ignore underscore as a local variable (#6492)
Diffstat (limited to 'pylint/checkers')
-rw-r--r--pylint/checkers/design_analysis.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/checkers/design_analysis.py b/pylint/checkers/design_analysis.py
index 550853b05..1ed19be78 100644
--- a/pylint/checkers/design_analysis.py
+++ b/pylint/checkers/design_analysis.py
@@ -536,6 +536,11 @@ class MisdesignChecker(BaseChecker):
ignored_args_num = 0
# check number of local variables
locnum = len(node.locals) - ignored_args_num
+
+ # decrement number of local variables if '_' is one of them
+ if "_" in node.locals:
+ locnum -= 1
+
if locnum > self.linter.config.max_locals:
self.add_message(
"too-many-locals",