[ANN] pylint-0.2

A

Alexandre Fayolle

Logilab has released pylint-0.2

What's new?
-----------

In addition to a large number of bug fixes, this release adds two new
checkers, for missing encoding declaration, and for FIXME comments. Zope
support was improved.

About Pylint
------------

Pylint is a lint-like tool for Python code. It performs almost all the
verifications that pychecker does, and additionally can perform some
stylistic verification and coding standard enforcements. The checked
code is assigned a mark based on the number and the severity of the
encountered problems. The previous mark of a given piece of code is
cached so that you can see if the code quality has improved since the
last check.

URLs
 
M

Mark Hahn

Pylint is a lint-like tool for Python code

Does pylint only work for modules? When I tried to run it on my code file
(ezpicmailer.py) , it raised an exception:

No config file found, using default configuration
<snip>
Exception: Unable to find module for C:\photoedit\ezpicmailer in
<snip>

and then it gave a long list of modules in my sys.path. It seems to insist
that the argument I give it be a module in sys.path, not just an arbitrary
python code file.

------------------------------------------

Logilab has released pylint-0.2

What's new?
-----------

In addition to a large number of bug fixes, this release adds two new
checkers, for missing encoding declaration, and for FIXME comments. Zope
support was improved.

About Pylint
------------

Pylint is a lint-like tool for Python code. It performs almost all the
verifications that pychecker does, and additionally can perform some
stylistic verification and coding standard enforcements. The checked
code is assigned a mark based on the number and the severity of the
encountered problems. The previous mark of a given piece of code is
cached so that you can see if the code quality has improved since the
last check.

URLs
 
P

Peter Milliken

I get the same error.

I tried to find documentation to see whether I was using Pylint correctly or
not but there isn't any. There seems to have been an attempt at providing
the possible command line options (python pylint.py --help) but I don't find
them particularly self-explanatory - so without documentation and the
apparent ability to "run out of the box", I guess I'll just have to give
this one a miss.

One nice thing that has happened is it has led me to the Optik package
(Option parsing). There is some nice documentation for this package - the
author(s) of Pylint could take some direction from this package if they
really want people to use Pylint (I have a personal hangup with people who
write good, useful packages and then don't bother documenting them - life is
just too short to read somebody else'e code to get around this deficiency
:) I get frustrated however when I think there is something that I could be
taking advantage of but something as simple as the lack of 0.5hr of
documentation stops me :-( ).

In the meantime, I'll just have to watch this space :)

Peter
 
P

Peter Hansen

Peter said:
I get the same error. [snip]
(I have a personal hangup with people who
write good, useful packages and then don't bother documenting them - life is
just too short to read somebody else'e code to get around this deficiency
:) I get frustrated however when I think there is something that I could be
taking advantage of but something as simple as the lack of 0.5hr of
documentation stops me :-( ).

Maybe RTFM would help. See http://www.logilab.org/projects/pylint/documentation and
note the "dependancies" (sic) line which states "Pylint requires the
logilab-common(version >= 0.2.1) and the optik packages."

If you download the "Common libraries" from the links provided on that page,
I suspect it will work better.

Unfortunately, by posting the direct link to the download I suspect Alexandre
led people astray by implying that a single download might be enough to make
this work.

-Peter
 
J

John J. Lee

Peter Milliken said:
One nice thing that has happened is it has led me to the Optik package
[...]

Optik is now in 2.3 standard library, renamed as the optparse module.


John
 
P

Peter Milliken

Hi Peter,

No, I caught all of the dependencies that are required (common libraries and
optik - I think that is all that is required). I installed both of them
before attempting to run pylint and still received that error. Perhaps the
install is order dependent i.e. I installed pylint, then the "common
libraries" then the optik package.

Does Pylint work for you?

Peter

Peter Hansen said:
Peter said:
I get the same error. [snip]
(I have a personal hangup with people who
write good, useful packages and then don't bother documenting them - life is
just too short to read somebody else'e code to get around this deficiency
:) I get frustrated however when I think there is something that I could be
taking advantage of but something as simple as the lack of 0.5hr of
documentation stops me :-( ).

Maybe RTFM would help. See
http://www.logilab.org/projects/pylint/documentation and
 
M

Mark Hahn

They not only feel no need to document, they also feel no need to follow ANN
threads they start.
 
S

Sylvain =?iso-8859-1?q?Th=E9nault?=

Mark Hahn said:
They not only feel no need to document, they also feel no need to follow ANN
threads they start.

Sorry, I don't have the time to follow c.l.py at the moment and that's
just today that I've been informed about this thread.

So, regarding the command line, pylint expects the name of a package
or module as argument. As a convenience, you can give to it a file
name if it's possible to guess a module name from the file's
path, using the python path. Some examples :

"pylint mymodule.py" should always works since the current working
directory is automatically added on top of the python path

"pylint directory/mymodule.py" will work if "directory" is a python
package (i.e. has an __init__.py file) or if "directory" is in the
python path.

"pylint /whatever/directory/mymodule.py" will work if either:
- "/whatever/directory" is in the python path
- your cwd is "/whatever/directory"
- "directory" is a python package and "/whatever" is in the python path
- "directory" is a python package and your cwd is "/whatever"
and so on...


Regarding the lack of documentation, we're pretty busy at this time at
logilab, but I hope we'll have the time to write some until the next
release... Anyway, any contribution would be welcome ;)


Hope that helps,
regards
 
P

Peter Milliken

Sorry mate, but I am in the same directory of the Python file I am trying to
run through pylint and I get the same message originally posted by Mark
Hahn.

So something is wrong - perhaps you should verify that what is on the
web-site is actually working as you expect?

Here is the full error message from one of my runs:

roebourne#1(~/swimming)$ python
c:/Python22/Lib/site-packages/logilab/pylint/lint.py roll.py
No config file found, using default configuration
Traceback (most recent call last):
File "c:/Python22/Lib/site-packages/logilab/pylint/lint.py", line 529, in
?
Run(*sys.argv[1:])
File "c:/Python22/Lib/site-packages/logilab/pylint/lint.py", line 496, in
__init__
modname = '.'.join(modpath_from_file(modname))
File "c:\Python22\Lib\site-packages\logilab\common\modutils.py", line 70,
in modpath_from_file
raise Exception('Unable to find module for %s in %s' % (
Exception: Unable to find module for c:\usr\local\swimming\roll in
c:\usr\local\swimming,
c:/Python22/Lib/site-packages/logilab/pylint,
c:\Python22,
c:\Python22\DLLs,
c:\Python22\Lib,
c:\Python22\Lib\lib-tk,
c:\usr\local\swimming,
c:\Python22\lib\site-packages,
c:\usr\local\share\emacs\site-lisp\pymacs
[exited with 1]

Note that I am running Python 2.2.2.

Peter
 
S

Sylvain =?iso-8859-1?Q?Th=E9nault?=

Sorry mate, but I am in the same directory of the Python file I am trying to
run through pylint and I get the same message originally posted by Mark
Hahn.

So something is wrong - perhaps you should verify that what is on the
web-site is actually working as you expect?

ok, that was actually a problem in the common library. I've just made a
new release which should fix this problem :

ftp://ftp.logilab.fr/pub/common/common-0.3.3.tar.gz
 
P

Peter Hansen

Peter said:
No, I caught all of the dependencies that are required (common libraries and
optik - I think that is all that is required). I installed both of them
before attempting to run pylint and still received that error. Perhaps the
install is order dependent i.e. I installed pylint, then the "common
libraries" then the optik package.

Does Pylint work for you?

Sorry, I was jumping to conclusions. I got the same message you did,
after a pylint-only install, so then I visited the web site and saw
the notes about common and posted my response. Didn't actually try
it out yet.

Thanks to Sylvain for posting the fix that resolves this. (Assuming
it does... anyone try it yet? ;-)

-Peter
 
P

Peter Milliken

Getting closer but still no prizes :)

Installed the supplied common and re-ran with the following result:

roebourne#1(~/swimming)$ python
c:/Python22/Lib/site-packages/logilab/pylint/lint.py roll.py
No config file found, using default configuration
An error occured while parsing roll
Traceback (most recent call last):
File "c:/Python22/Lib/site-packages/logilab/pylint/lint.py", line 529, in
?
Run(*sys.argv[1:])
File "c:/Python22/Lib/site-packages/logilab/pylint/lint.py", line 497, in
__init__
linter.check(modname)
File "c:/Python22/Lib/site-packages/logilab/pylint/lint.py", line 230, in
check
astng = self.manager.astng_from_module_name(mod_name)
File "c:\Python22\Lib\site-packages\logilab\common\astng\manager.py", line
85, in astng_from_module_name
return self.astng_from_module(module, norm_mod_name)
File "c:\Python22\Lib\site-packages\logilab\common\astng\manager.py", line
62, in astng_from_module
astng = self._builder.build_from_module(module, mod_name)
File "c:\Python22\Lib\site-packages\logilab\common\astng\astng.py", line
179, in build_from_module
astng = self._string_build(data)
File "c:\Python22\Lib\site-packages\logilab\common\astng\astng.py", line
234, in _string_build
ast = parser.suite(data + linesep)
parser.ParserError: could not parse string
[exited with 1]


I assume that we are getting closer? :)

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top