As a python beginner, I've been trying to get pylint running under IronPython to run over some scripts. I've managed to get it installed and reporting some results but I'm getting an AssertionError whenever I run it, and it's the same on multiple scripts.
I'm running it with a default rcfile save for the addition of disable=C0103,C0301,C0303
.
The output:
<string>:1: DeprecationWarning: object.__new__() takes no parameters
************* Module testscript
C: 1, 0: Missing module docstring (missing-docstring)
C: 11, 0: Missing function docstring (missing-docstring)
C: 19, 0: Missing function docstring (missing-docstring)
R: 19, 0: Too many local variables (24/15) (too-many-locals)
Traceback (most recent call last):
File "C:\Program Files (x86)\IronPython 2.7\Scripts\pylint", line 3, in <module>
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\__init__.py", line 21, in run_pylint
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\lint.py", line 982, in __init__
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\lint.py", line 578, in check
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\lint.py", line 664, in check_astroid_module
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 662, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\utils.py", line 659, in walk
File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pylint\checkers\format.py", line 309, in visit_default
AssertionError: If()
The visit_default function with line 309 noted, if it's of use:
@check_messages('C0321' ,'C03232', 'C0323', 'C0324')
def visit_default(self, node):
"""check the node line number and check it if not yet done"""
if not node.is_statement:
return
if not node.root().pure_python:
return # XXX block visit of child nodes
prev_sibl = node.previous_sibling()
if prev_sibl is not None:
prev_line = prev_sibl.fromlineno
309>else:
prev_line = node.parent.statement().fromlineno
line = node.fromlineno
assert line, node
if prev_line == line and self._visited_lines.get(line) != 2:
# py2.5 try: except: finally:
if not (isinstance(node, nodes.TryExcept)
and isinstance(node.parent, nodes.TryFinally)
and node.fromlineno == node.parent.fromlineno):
self.add_message('C0321', node=node)
self._visited_lines[line] = 2
return
if line in self._visited_lines:
return
try:
tolineno = node.blockstart_tolineno
except AttributeError:
tolineno = node.tolineno
assert tolineno, node
lines = []
for line in xrange(line, tolineno + 1):
self._visited_lines[line] = 1
try:
lines.append(self._lines[line].rstrip())
except KeyError:
lines.append('')
try:
msg_def = check_line('\n'.join(lines))
if msg_def:
self.add_message(msg_def[0], node=node, args=msg_def[1])
except KeyError:
# FIXME: internal error !
pass
This could be a problem in pylint, or rather in pylint's support of IronPython.
IronPython is a Python implementation, but it's pretty different from the others in that it typically isn't used with a Python Standard Library.
You might try taking this issue to the logilab projects mailing list, and seeing if they have any suggestions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.