diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-11 17:15:25 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-11 17:15:25 +0200 |
commit | f57dae9a1134df95e6418f37f6b7bf5ced1c77b0 (patch) | |
tree | 7e6678193e917e38df84e6967c3cc640ebb64438 | |
parent | e61e2d7e01447fd4948c4f0427af7422b8b38baa (diff) | |
download | pylint-f57dae9a1134df95e6418f37f6b7bf5ced1c77b0.tar.gz |
Remove the star-args error.
This warning is removed because it doesn't add any real value and
it's not a problem if someone uses unpacking in their code.
-rw-r--r-- | pylint/checkers/base.py | 19 | ||||
-rw-r--r-- | pylint/test/functional/access_to__name__.py | 2 | ||||
-rw-r--r-- | pylint/test/functional/string_formatting.py | 2 | ||||
-rw-r--r-- | pylint/test/functional/unnecessary_lambda.py | 2 | ||||
-rw-r--r-- | pylint/test/input/func_w0152.py | 18 | ||||
-rw-r--r-- | pylint/test/messages/func_w0152_py29.txt | 2 | ||||
-rw-r--r-- | pylint/test/messages/func_w0152_py30.txt | 4 | ||||
-rw-r--r-- | pylint/test/unittest_lint.py | 14 |
8 files changed, 10 insertions, 53 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index 404f9de..6ce8825 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -497,11 +497,6 @@ functions, methods 'bad-function option). Usual black listed functions are the ones ' 'like map, or filter , where Python offers now some cleaner ' 'alternative like list comprehension.'), - 'W0142': ('Used * or ** magic', - 'star-args', - 'Used when a function or method is called using `*args` or ' - '`**kwargs` to dispatch arguments. This doesn\'t improve ' - 'readability and should be used with care.'), 'W0150': ("%s statement in finally block may swallow exception", 'lost-exception', 'Used when a break or a return statement is found inside the ' @@ -753,7 +748,7 @@ functions, methods """just print a warning on exec statements""" self.add_message('exec-used', node=node) - @check_messages('bad-builtin', 'star-args', 'eval-used', + @check_messages('bad-builtin', 'eval-used', 'exec-used', 'missing-reversed-argument', 'bad-reversed-sequence') def visit_callfunc(self, node): @@ -774,18 +769,6 @@ functions, methods self.add_message('eval-used', node=node) if name in self.config.bad_functions: self.add_message('bad-builtin', node=node, args=name) - if node.starargs or node.kwargs: - scope = node.scope() - if isinstance(scope, astroid.Function): - toprocess = [(n, vn) for (n, vn) in ((node.starargs, scope.args.vararg), - (node.kwargs, scope.args.kwarg)) if n] - if toprocess: - for cfnode, fargname in toprocess[:]: - if getattr(cfnode, 'name', None) == fargname: - toprocess.remove((cfnode, fargname)) - if not toprocess: - return # star-args can be skipped - self.add_message('star-args', node=node.func) @check_messages('assert-on-tuple') def visit_assert(self, node): diff --git a/pylint/test/functional/access_to__name__.py b/pylint/test/functional/access_to__name__.py index 45e500e..4bd1497 100644 --- a/pylint/test/functional/access_to__name__.py +++ b/pylint/test/functional/access_to__name__.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods,star-args, print-statement +# pylint: disable=too-few-public-methods, print-statement """test access to __name__ gives undefined member on new/old class instances but not on new/old class object """ diff --git a/pylint/test/functional/string_formatting.py b/pylint/test/functional/string_formatting.py index dd7e4ea..d0390c6 100644 --- a/pylint/test/functional/string_formatting.py +++ b/pylint/test/functional/string_formatting.py @@ -1,6 +1,6 @@ """test for Python 3 string formatting error
"""
-# pylint: disable=too-few-public-methods, import-error, unused-argument, star-args, line-too-long, no-absolute-import
+# pylint: disable=too-few-public-methods, import-error, unused-argument, line-too-long, no-absolute-import
import os
from missing import Missing
diff --git a/pylint/test/functional/unnecessary_lambda.py b/pylint/test/functional/unnecessary_lambda.py index 1c9b424..fa1e122 100644 --- a/pylint/test/functional/unnecessary_lambda.py +++ b/pylint/test/functional/unnecessary_lambda.py @@ -1,4 +1,4 @@ -# pylint: disable=star-args, undefined-variable
+# pylint: disable=undefined-variable
"""test suspicious lambda expressions
"""
diff --git a/pylint/test/input/func_w0152.py b/pylint/test/input/func_w0152.py deleted file mode 100644 index 9fff4a6..0000000 --- a/pylint/test/input/func_w0152.py +++ /dev/null @@ -1,18 +0,0 @@ -"""check use of * or ** -""" -# pylint: disable=no-absolute-import -from operator import add -__revision__ = reduce(*(add, (1, 2, 3))) - - -def func(arg1, arg2): - """magic function - """ - return arg2, arg1 - -MYDICT = {'arg1':2, 'arg2': 4} -func(**MYDICT) - -def coolfunc(*args, **kwargs): - """magic function""" - return func(*args, **kwargs) diff --git a/pylint/test/messages/func_w0152_py29.txt b/pylint/test/messages/func_w0152_py29.txt deleted file mode 100644 index 484d5bf..0000000 --- a/pylint/test/messages/func_w0152_py29.txt +++ /dev/null @@ -1,2 +0,0 @@ -W: 5: Used * or ** magic -W: 14: Used * or ** magic diff --git a/pylint/test/messages/func_w0152_py30.txt b/pylint/test/messages/func_w0152_py30.txt deleted file mode 100644 index 4bec00a..0000000 --- a/pylint/test/messages/func_w0152_py30.txt +++ /dev/null @@ -1,4 +0,0 @@ -E: 5: Undefined variable 'reduce' -W: 5: Used * or ** magic -W: 14: Used * or ** magic - diff --git a/pylint/test/unittest_lint.py b/pylint/test/unittest_lint.py index ed2f20c..b99605c 100644 --- a/pylint/test/unittest_lint.py +++ b/pylint/test/unittest_lint.py @@ -397,23 +397,21 @@ class PyLinterTC(unittest.TestCase): def test_set_option_1(self): linter = self.linter - linter.set_option('disable', 'C0111,W0142') + linter.set_option('disable', 'C0111,W0234') self.assertFalse(linter.is_message_enabled('C0111')) - self.assertFalse(linter.is_message_enabled('W0142')) + self.assertFalse(linter.is_message_enabled('W0234')) self.assertTrue(linter.is_message_enabled('W0113')) self.assertFalse(linter.is_message_enabled('missing-docstring')) - self.assertFalse(linter.is_message_enabled('star-args')) - # no name for W0113 + self.assertFalse(linter.is_message_enabled('non-iterator-returned')) def test_set_option_2(self): linter = self.linter - linter.set_option('disable', ('C0111', 'W0142') ) + linter.set_option('disable', ('C0111', 'W0234') ) self.assertFalse(linter.is_message_enabled('C0111')) - self.assertFalse(linter.is_message_enabled('W0142')) + self.assertFalse(linter.is_message_enabled('W0234')) self.assertTrue(linter.is_message_enabled('W0113')) self.assertFalse(linter.is_message_enabled('missing-docstring')) - self.assertFalse(linter.is_message_enabled('star-args')) - # no name for W0113 + self.assertFalse(linter.is_message_enabled('non-iterator-returned')) def test_enable_checkers(self): self.linter.disable('design') |