pylint

Are there any static analysis tools for Python?

I am starting to use Python (specifically because of Django) and I would like to remove the burden for exhaustive testing by performing some static analysis. What tools/parameters/etc. exist to detect issues at compile time that would otherwise show up during runtime? (type errors are probably the most obvious case of this, but undefine...

Using Pylint with Django

I would very much like to integrate pylint into the build process for my python projects, but I have run into one show-stopper: One of the error types that I find extremely useful--:E1101: *%s %r has no %r member*--constantly reports errors when using common django fields, for example: E1101:125:get_user_tags: Class 'Tag' has no 'objec...

python code convention using pylint

I'm trying out pylint to check my source code for conventions. Somehow some variable names are matched with the regex for constants (const-rgx) instead of the variable name regex (variable-rgx). How to match the variable name with variable-rgx? Or should I extend const-rgx with my variable-rgx stuff? e.g. C0103: 31: Invalid name "settin...

pylint warning on 'except Exception:'

For a block like this: try: #some stuff except Exception: pass pylint raises warning W0703 'Catch "Exception"'. Why? ...

Python: avoiding pylint warnings about too many arguments

I want to refactor a big Python function into smaller ones. For example, consider this following code snippet: x = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 Of course, this is a trivial example. In practice, the code is more complex. My point is that it contains many local-scope variables that would have to be passed to the extracted...

Python composite pattern exception handling & pylint

I'm implementig a Composite pattern in this way: 1) the "abstract" component is: class Component(object): """Basic Component Abstraction""" def __init__(self, *args, **kw): raise NotImplementedError("must be subclassed") def status(self): """Base Abstract method""" raise NotImplementedError("must be implemented") 2) a le...

pylint false positive for superclass __init__

If I derive a class from ctypes.BigEndianStructure, pylint warns if I don't call BigEndianStructure.init (). Great, but if I fix my code, pylint still warns: import ctypes class Foo(ctypes.BigEndianStructure): def __init__(self): ctypes.BigEndianStructure.__init__(self) $ pylint mymodule.py C: 1: Missing docstring C: 3:F...

How can I use Emacs Flymake mode for python with pyflakes and pylint checking code?

For checking code in python mode I use flymake with pyflakes Also I want check code style (pep8) with pylint (description on the same page with pyflakes) This solutions work. But I can't configure flymake for work with pyflakes and pylint together. How can I do it? ...

pylint not recognizing some of the standard library

I'm using pylint + pydev, with python 2.6. I have a module with just this line of code from email import Message Now when I try to run this module it runs fine. But pylint reports an error: ID: E0611 No name 'Message' in module 'email' Although it exists... Any idea why? ...

How to specify a configuration file for pylint under windows?

I am evaluating pylint as source code checker and I would like to customize the maximum number of characters on a single line. I would like to use a configuration file. I've generated a template thanks to the --generate-rcfile command and I've made my modification. I am trying to run pylint --rcfile=myfile.rc but I can see that my cha...

PyLint, PyChecker or PyFlakes ?

I would like to get some feedback on these tools on : features; adaptability; ease of use and learning curve. ...

epylint script is not working on Windows.

I have installed http://ftp.logilab.org/pub/pylint/pylint-0.18.1.tar.gz on Windows and now I am trying to configure my Emacs's flymake mode using epylint script. But it is not working. Here is the output of I got when I tried epylint on windows command prompt. C:\>epylint test.py 'test.py':1: [F] No module named 'test.py' Did anyone t...

How does pylint quit the Windows command box it is running in?

Pylint is doing something odd on my Windows box - something that shouldn't be possible. This isn't a question about fixing pylint, so much as fixing my understanding. I have a typical install of the latest version of pylint, Python 2.6 and Windows Vista. If I open a Command Prompt, and run pylint from the command line, it executes succ...

Can I put Hudson Plots on the project page?

I've got Hudson up and running, building Django and Python projects I'm working on. I've found and am using the [Plot plugin][2] to graph Pylint scores, by extracting them with Awk to create a pylint.properties file. So far everything is working great, but I'd like to have the Pylint score appear on the project page. Right now you have...

Enable pylint in Netbeans

How can I integrate pylint with netbeans? ...

Linting Python: what is good?

Are there any good modules that you can run against your code to catch coding errors? I expected pylint to catch mistakes in the use of default arguments to functions like this: >>> def spam(eggs=[]): ... eggs.append("spam") ... return eggs but was disappointed to find them unreported. I am looking for something beyond PEP8 fo...

How do I tell PyLint "it's a variable, not a constant" to stop message C0103?

I have a module-level variable in my Python 2.6 program named "_log", which PyLint complains about: C0103: Invalid name "_log" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) Having read this answer I understand why it's doing this: it thinks the variable is a constant and applies the constant regex. However, I beg to differ: I think it...

PyLint "Unable to import" error - how to set PYTHONPATH?

I'm running PyLint from inside Wing IDE on Windows. I have a sub-directory (package) in my project and inside the package I import a module from the top level, ie. __init__.py myapp.py one.py subdir\ __init__.py two.py Inside two.py I have import one and this works fine at runtime, because the top-level directory (from which m...

pylint PyQt4 error

I write a program : from PyQt4.QtCore import * from PyQt4.QtGui import * def main(): app = QApplication([]) button = QPushButton("hello?") button.show() app.exec_() if __name__=="__main__": main() the file name is t.py, when I run: pylint t.py in ubuntu9.10, pyqt4, I got this: pylint t.py No config file foun...

What makes pylint think my class is abstract?

As I understand it, Python (2.5.2) does not have real support for abstract classes. Why is pylint complaining about this class being an "Abstract class not reference?" Will it do this for any class that has NotImplementedError thrown? I have each class in its own file so if this is the case I guess I have no choice but to suppress this ...