eclim/autoload/eclim/python/validate.vim bug: don't assume pyflakes returncode <= 1 #33

Closed
edgimar opened this Issue Dec 1, 2010 · 6 comments

Projects

None yet

2 participants

@edgimar
edgimar commented Dec 1, 2010

In line 65 of .vim/eclim/autoload/eclim/python/validate.vim, an error is issued for any returncode > 1. With the latest pyflakes versions, the value of the returncode is equal to the number of warnings (and errors?) found, which can obviously exceed 1, generating an "error running pyflakes" message when there is no error running it.

@ervandew
Owner
ervandew commented Dec 2, 2010

What version of pyflakes are you using? I have the Divmod pyflakes 0.4.0 and don't have this issue. Are you using a development version? Perhaps the fork by Kevin Watters?

@edgimar
edgimar commented Dec 2, 2010

I suspect it is the same version. The Ubuntu Lucid package version is 0.4.0-1.

If I save the following to "x.py":

#!/usr/bin/env python

import d
import f
a = b
e = g

then I observe the following at the commandline:

pyflakes x.py

[4 lines of warnings printed]

echo $?

4
Is this different in your case?

@ervandew
Owner
ervandew commented Dec 2, 2010

I get the following:
$ python -c "import pyflakes; print pyflakes.version"
0.4.0

$ pyflakes test.py
test.py:2: 'd' imported but unused
test.py:3: 'f' imported but unused
test.py:4: undefined name 'b'
test.py:5: undefined name 'g'

$ echo $?
1

When I get time I'll try using a vanilla checkout from the divmod svn repos to see what their return codes is since one of our distros (yours: Ubuntu/Debian or mine: Arch) may be mucking with the return code. That or some other oddity is going on.

@edgimar
edgimar commented Dec 2, 2010

On my system /usr/bin/pyflakes exits with whatever pyflakes.scripts.pyflakes.main() returns. And main() returns a variable called "warnings" which (except in the case of more serious errors) contains the number of warnings printed (see lines 69-71).

@ervandew
Owner
ervandew commented Dec 9, 2010

Sorry for the long delay in responding. I finally got a chance to look into this and it turns out that debian patches pyflakes to behave this way (which by using Ubuntu you get to inherit). Both the pyflakes on my system and the one on the trunk of the Divmod svn repos exit the pyflakes.scripts.pyflakes main() function like so:
raise SystemExit(warnings > 0)

Then I went to the debian package page (http://packages.debian.org/sid/pyflakes) and there is a patch to pyflakes (http://ftp.de.debian.org/debian/pool/main/p/pyflakes/pyflakes_0.4.0-1.diff.gz) which includes the following change:
--- a/pyflakes/scripts/pyflakes.py
+++ b/pyflakes/scripts/pyflakes.py
@@ -64,4 +64,4 @@
else:
warnings += check(sys.stdin.read(), '')

-    raise SystemExit(warnings > 0)
+    return warnings

So, it looks like I'll have to make the annoying assumption that everyone's pyflakes behaves this way, or attempt to detect this sillyness and handle it as an edge case.

@ervandew
Owner

Closing now that eclim no longer uses pyflakes for validation (switched to pydev).

@ervandew ervandew closed this Mar 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment