diff options
author | cpopa <devnull@localhost> | 2013-08-04 20:23:09 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2013-08-04 20:23:09 +0300 |
commit | 5754b5bb3f552fd5dd6c1a76b99368a853e2a543 (patch) | |
tree | 9652de7d4324da06d282ae2a2fbd05c41188e28b | |
parent | d51aae3461f5505ef64157b3d07fba2072358b7c (diff) | |
parent | e93787aeb77e2d983b7a0f663d8e6dfb892aab28 (diff) | |
download | pylint-5754b5bb3f552fd5dd6c1a76b99368a853e2a543.tar.gz |
Merge with default.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | __pkginfo__.py | 2 | ||||
-rw-r--r-- | checkers/base.py | 18 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | pyreverse/writer.py | 3 | ||||
-rw-r--r-- | test/input/func_exec_used_py30.py | 13 | ||||
-rw-r--r-- | test/messages/func_exec_used_py30.txt | 4 | ||||
-rw-r--r-- | test/messages/func_w0122_py_30.txt | 8 |
8 files changed, 41 insertions, 15 deletions
@@ -4,6 +4,8 @@ ChangeLog for Pylint -- * Check for non-exception classes inside an except clause + * Add check for the use of 'exec' function + * New --msg-template option to control output, deprecating "msvc" and "parseable" output formats as well as killing `--include-ids` and `--symbols` options diff --git a/__pkginfo__.py b/__pkginfo__.py index d4fbf59..997b9a5 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -18,7 +18,7 @@ modname = distname = 'pylint' -numversion = (0, 28, 0) +numversion = (1, 0, 0) version = '.'.join([str(num) for num in numversion]) install_requires = ['logilab-common >= 0.53.0', 'astroid >= 0.24.3'] diff --git a/checkers/base.py b/checkers/base.py index bb6f778..de40c4c 100644 --- a/checkers/base.py +++ b/checkers/base.py @@ -374,12 +374,10 @@ functions, methods 'duplicate-key', "Used when a dictionary expression binds the same key multiple \ times."), - 'W0122': ('Use of the exec statement', - 'exec-statement', - 'Used when you use the "exec" statement, to discourage its \ - usage. That doesn\'t mean you can not use it !', - {'maxversion': (3, 0)}), - + 'W0122': ('Use of exec', + 'exec-used', + 'Used when you use the "exec" statement (function for Python 3), to discourage its \ + usage. That doesn\'t mean you can not use it !'), 'W0141': ('Used builtin function %r', 'bad-builtin', 'Used when a black listed builtin function is used (see the ' @@ -595,12 +593,12 @@ functions, methods if node.exc is not None and node.inst is not None and node.tback is None: self.add_message('old-raise-syntax', node=node) - @check_messages('exec-statement') + @check_messages('exec-used') def visit_exec(self, node): """just print a warning on exec statements""" - self.add_message('exec-statement', node=node) + self.add_message('exec-used', node=node) - @check_messages('bad-builtin', 'star-args') + @check_messages('bad-builtin', 'star-args', 'exec-used') def visit_callfunc(self, node): """visit a CallFunc node -> check if this is not a blacklisted builtin call and check for * or ** use @@ -611,6 +609,8 @@ functions, methods # locals nor globals scope) if not (name in node.frame() or name in node.root()): + if name == 'exec': + self.add_message('exec-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: diff --git a/debian/changelog b/debian/changelog index 34c671e..3e46fff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +pylint (1.0.0-1) unstable; urgency=low + + * new upstream release + + -- Sylvain Thénault <sylvain.thenault@logilab.fr> Tue, 30 Jul 2013 18:18:06 +0200 + pylint (0.28.0-1) unstable; urgency=low * new upstream release diff --git a/pyreverse/writer.py b/pyreverse/writer.py index 940e324..dd00850 100644 --- a/pyreverse/writer.py +++ b/pyreverse/writer.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2008-2013 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # @@ -115,7 +116,7 @@ class DotWriter(DiagramWriter): """ label = obj.title if obj.shape == 'interface': - label = "«interface»\\n%s" % label + label = u"«interface»\\n%s" % label if not self.config.only_classnames: label = r"%s|%s\l|" % (label, r"\l".join(obj.attrs) ) for func in obj.methods: diff --git a/test/input/func_exec_used_py30.py b/test/input/func_exec_used_py30.py new file mode 100644 index 0000000..dbcc024 --- /dev/null +++ b/test/input/func_exec_used_py30.py @@ -0,0 +1,13 @@ +"""test global statement""" + +__revision__ = 0 + +exec('a = __revision__') +exec('a = 1', globals={}) + +exec('a = 1', globals=globals()) + +def func(): + """exec in local scope""" + exec('b = 1') + diff --git a/test/messages/func_exec_used_py30.txt b/test/messages/func_exec_used_py30.txt new file mode 100644 index 0000000..362da68 --- /dev/null +++ b/test/messages/func_exec_used_py30.txt @@ -0,0 +1,4 @@ +W: 5: Use of exec
+W: 6: Use of exec
+W: 8: Use of exec
+W: 12:func: Use of exec
diff --git a/test/messages/func_w0122_py_30.txt b/test/messages/func_w0122_py_30.txt index 1522cac..d833076 100644 --- a/test/messages/func_w0122_py_30.txt +++ b/test/messages/func_w0122_py_30.txt @@ -1,5 +1,5 @@ -W: 5: Use of the exec statement -W: 6: Use of the exec statement -W: 8: Use of the exec statement -W: 12:func: Use of the exec statement +W: 5: Use of exec +W: 6: Use of exec +W: 8: Use of exec +W: 12:func: Use of exec |