diff options
author | cpopa <devnull@localhost> | 2013-08-30 15:14:43 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2013-08-30 15:14:43 +0300 |
commit | 122972308e541ff15a351d6c25ad495e2de4639c (patch) | |
tree | e2880a51f08e04cc996fed21ee60ae02bbc1025d | |
parent | f09017aab057531c07fe6d36d411bc48c914d380 (diff) | |
download | pylint-122972308e541ff15a351d6c25ad495e2de4639c.tar.gz |
Add more context informations regarding the unpacked sequence location.
-rw-r--r-- | checkers/variables.py | 6 | ||||
-rw-r--r-- | test/messages/func_unbalanced_tuple_unpacking.txt | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index f358f91..9a6d925 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -119,7 +119,7 @@ MSGS = { a list comprehension or a generator expression) is used outside \ the loop.'), - 'W0632': ('Possible unbalanced tuple unpacking: ' + 'W0632': ('Possible unbalanced tuple unpacking with sequence at line %d: ' 'left side has %d label(s), right side has %d value(s)', 'unbalanced-tuple-unpacking', 'Used when there is an unbalanced tuple unpacking in assignment'), @@ -571,7 +571,9 @@ builtins. Remember that you should avoid to define new builtins when possible.' if len(targets) != len(values): self.add_message('unbalanced-tuple-unpacking', node=node, - args=(len(targets), len(values))) + args=(infered.lineno, + len(targets), + len(values))) else: if infered is astroid.YES: continue diff --git a/test/messages/func_unbalanced_tuple_unpacking.txt b/test/messages/func_unbalanced_tuple_unpacking.txt index 56e2b24..43c6bb3 100644 --- a/test/messages/func_unbalanced_tuple_unpacking.txt +++ b/test/messages/func_unbalanced_tuple_unpacking.txt @@ -1,4 +1,4 @@ -W: 7:do_stuff: Possible unbalanced tuple unpacking: left side has 2 label(s), right side has 3 value(s) -W: 12:do_stuff1: Possible unbalanced tuple unpacking: left side has 2 label(s), right side has 3 value(s) -W: 17:do_stuff2: Possible unbalanced tuple unpacking: left side has 2 label(s), right side has 3 value(s) -W: 48:do_stuff7: Possible unbalanced tuple unpacking: left side has 2 label(s), right side has 3 value(s)
\ No newline at end of file +W: 7:do_stuff: Possible unbalanced tuple unpacking with sequence at line 7: left side has 2 label(s), right side has 3 value(s) +W: 12:do_stuff1: Possible unbalanced tuple unpacking with sequence at line 12: left side has 2 label(s), right side has 3 value(s) +W: 17:do_stuff2: Possible unbalanced tuple unpacking with sequence at line 17: left side has 2 label(s), right side has 3 value(s) +W: 48:do_stuff7: Possible unbalanced tuple unpacking with sequence at line 44: left side has 2 label(s), right side has 3 value(s)
\ No newline at end of file |