summaryrefslogtreecommitdiff
path: root/checkers/variables.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2009-03-16 15:05:08 +0100
committerEmile Anclin <emile.anclin@logilab.fr>2009-03-16 15:05:08 +0100
commit61fd82d95bc765d5d424ef09e2d83697858a79e9 (patch)
treecf7edc74d0cc9c982194297857852c2956859ab5 /checkers/variables.py
parentb79605a960f62e4083768c56ae6330791dab3078 (diff)
downloadpylint-61fd82d95bc765d5d424ef09e2d83697858a79e9.tar.gz
fix E0601/E0602 alternative and tests
Diffstat (limited to 'checkers/variables.py')
-rw-r--r--checkers/variables.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/checkers/variables.py b/checkers/variables.py
index de006ba..9c34590 100644
--- a/checkers/variables.py
+++ b/checkers/variables.py
@@ -391,10 +391,12 @@ builtins. Remember that you should avoid to define new builtins when possible.'
and stmt.fromlineno <= defstmt.fromlineno
and not is_defined_before(node)
and not are_exclusive(stmt, defstmt)):
- if stmt is defstmt: # Aug AssName
- self.add_message('E0602', args=name, node=node)
- else:
+ if (stmt is defstmt
+ and not isinstance(stmt, astng.AugAssign)
+ and not isinstance(node, astng.DelName)):
self.add_message('E0601', args=name, node=node)
+ else:
+ self.add_message('E0602', args=name, node=node)
if not isinstance(node, astng.AssName): # Aug AssName
del to_consume[name]
# check it's not a loop variable used outside the loop