diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-20 20:50:18 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-20 20:50:18 +0200 |
commit | db47e6ae3e7f1838d4b38b213514461114d79bab (patch) | |
tree | 5ea976e43613d9667104bdf84fc1f99749454edd | |
parent | e0d77b9795a01ae0e98a951ebfa54eb810bda893 (diff) | |
download | pylint-db47e6ae3e7f1838d4b38b213514461114d79bab.tar.gz |
Promote a couple of warnings to errors.
These warnings were promoted since they could uncover
potential bugs in the code and since most people are using `pylint -E` anyway,
it's good to have them as errors. These warnings are: assignment-from-none,
unbalanced-tuple-unpacking, unpacking-non-sequence, non-iterator-returned.
Closes issue #388.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | pylint/checkers/classes.py | 5 | ||||
-rw-r--r-- | pylint/checkers/typecheck.py | 10 | ||||
-rw-r--r-- | pylint/checkers/variables.py | 10 | ||||
-rw-r--r-- | pylint/test/messages/func_non_iterator_returned_py30.txt | 6 | ||||
-rw-r--r-- | pylint/test/messages/func_non_iterator_returned_py_30.txt | 6 | ||||
-rw-r--r-- | pylint/test/messages/func_typecheck_callfunc_assigment.txt | 4 |
7 files changed, 26 insertions, 19 deletions
@@ -6,6 +6,10 @@ ChangeLog for Pylint exception handler which handles an exception type that was handled before. Closes issue #485. + * A couple of warnings got promoted to errors, since they could uncover + potential bugs in the code. These warnings are: assignment-from-none, + unbalanced-tuple-unpacking, unpacking-non-sequence, non-iterator-returned. + Closes issue #388. 2015-03-14 -- 1.4.3 diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 87e3bcf..fe6d26d 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -210,10 +210,11 @@ MSGS = { 'non-parent-init-called', 'Used when an __init__ method is called on a class which is not ' 'in the direct ancestors for the analysed class.'), - 'W0234': ('__iter__ returns non-iterator', + 'E0234': ('__iter__ returns non-iterator', 'non-iterator-returned', 'Used when an __iter__ method returns something which is not an ' - 'iterable (i.e. has no `%s` method)' % NEXT_METHOD), + 'iterable (i.e. has no `%s` method)' % NEXT_METHOD, + {'old_names': [('W0234', 'non-iterator-returned')]}), 'E0235': ('__exit__ must accept 3 arguments: type, value, traceback', 'bad-context-manager', 'Used when the __exit__ special method, belonging to a ' diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 9f074ae..71cb673 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -42,11 +42,6 @@ MSGS = { 'assignment-from-no-return', 'Used when an assignment is done on a function call but the \ inferred function doesn\'t return anything.'), - 'W1111': ('Assigning to function call which only returns None', - 'assignment-from-none', - 'Used when an assignment is done on a function call but the \ - inferred function returns nothing but None.'), - 'E1120': ('No value for argument %s in %s call', 'no-value-for-parameter', 'Used when a function call passes too few arguments.'), @@ -77,6 +72,11 @@ MSGS = { 'invalid-slice-index', 'Used when a slice index is not an integer, None, or an object \ with an __index__ method.'), + 'E1128': ('Assigning to function call which only returns None', + 'assignment-from-none', + 'Used when an assignment is done on a function call but the ' + 'inferred function returns nothing but None.', + {'old_names': [('W1111', 'assignment-from-none')]}), } # builtin sequence types in Python 2 and 3. diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 8f6f957..1841846 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -255,16 +255,18 @@ MSGS = { a list comprehension or a generator expression) is used outside \ the loop.'), - 'W0632': ('Possible unbalanced tuple unpacking with ' + 'E0632': ('Possible unbalanced tuple unpacking with ' 'sequence%s: ' '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'), + 'Used when there is an unbalanced tuple unpacking in assignment', + {'old_names': [('W0632', 'unbalanced-tuple-unpacking')]}), - 'W0633': ('Attempting to unpack a non-sequence%s', + 'E0633': ('Attempting to unpack a non-sequence%s', 'unpacking-non-sequence', 'Used when something which is not ' - 'a sequence is used in an unpack assignment'), + 'a sequence is used in an unpack assignment', + {'old_names': [('W0633', 'unpacking-non-sequence')]}), 'W0640': ('Cell variable %s defined in loop', 'cell-var-from-loop', diff --git a/pylint/test/messages/func_non_iterator_returned_py30.txt b/pylint/test/messages/func_non_iterator_returned_py30.txt index b41b14b..c956ae7 100644 --- a/pylint/test/messages/func_non_iterator_returned_py30.txt +++ b/pylint/test/messages/func_non_iterator_returned_py30.txt @@ -1,3 +1,3 @@ -W: 39:FirstBadIterator.__iter__: __iter__ returns non-iterator -W: 45:SecondBadIterator.__iter__: __iter__ returns non-iterator -W: 51:ThirdBadIterator.__iter__: __iter__ returns non-iterator
\ No newline at end of file +E: 39:FirstBadIterator.__iter__: __iter__ returns non-iterator +E: 45:SecondBadIterator.__iter__: __iter__ returns non-iterator +E: 51:ThirdBadIterator.__iter__: __iter__ returns non-iterator
\ No newline at end of file diff --git a/pylint/test/messages/func_non_iterator_returned_py_30.txt b/pylint/test/messages/func_non_iterator_returned_py_30.txt index b41b14b..c956ae7 100644 --- a/pylint/test/messages/func_non_iterator_returned_py_30.txt +++ b/pylint/test/messages/func_non_iterator_returned_py_30.txt @@ -1,3 +1,3 @@ -W: 39:FirstBadIterator.__iter__: __iter__ returns non-iterator -W: 45:SecondBadIterator.__iter__: __iter__ returns non-iterator -W: 51:ThirdBadIterator.__iter__: __iter__ returns non-iterator
\ No newline at end of file +E: 39:FirstBadIterator.__iter__: __iter__ returns non-iterator +E: 45:SecondBadIterator.__iter__: __iter__ returns non-iterator +E: 51:ThirdBadIterator.__iter__: __iter__ returns non-iterator
\ No newline at end of file diff --git a/pylint/test/messages/func_typecheck_callfunc_assigment.txt b/pylint/test/messages/func_typecheck_callfunc_assigment.txt index 1d84510..e1d0564 100644 --- a/pylint/test/messages/func_typecheck_callfunc_assigment.txt +++ b/pylint/test/messages/func_typecheck_callfunc_assigment.txt @@ -1,3 +1,3 @@ E: 20: Assigning to function call which doesn't return -W: 28: Assigning to function call which only returns None -W: 35: Assigning to function call which only returns None +E: 28: Assigning to function call which only returns None +E: 35: Assigning to function call which only returns None |