[Python-projects] Pylint 0.5.0 has problems with wxPython files on my system

Pierre Rouleau prouleau001 at sympatico.ca
Tue Nov 16 18:40:07 CET 2004


Bonjour!

I noticed that pylint 0.5.0 (with common 0.7.1) has more problems 
handling my wxPython code than pylint 0.4.1.

I am using wxPython 2.4.2.4u running under Python 2.3.4 on Windows XP.

The following code snippet saved in a file make pylint 0.5.0 raise a 
ResolveError for Dialog

#--------------------------------
import wx

class AboutDialog(wx.Dialog):
     "a test class"

     def __init__(self, parent, parentXpos, parentYpos,
                  programTitle, labelString, versionString):
         "Initializer"

         wx.Dialog.__init__(self, id=IDDIALOG, name='', parent=parent,
               pos=wx.Point(15, 67), size=wx.Size(352, 202),
               style=wx.DEFAULT_DIALOG_STYLE,
               title=programTitle)

#--------------------------------

I do not use pylint from the command line directly, I find I need to 
type lots of command line arguments and they change from version of 
pylint to version of pylint.  So I wrote runpylint (very rough) to issue 
the pylint command, and calling lint.Run(arguments).  It prints the 
command to show how pylint is invoked.  runpylint has the -p option to 
generate parsable output.  The pylint output shows up after the "----" line.


The output I get:

C:\dev\python\wxx>runpylint -p test.py
Pylint control file: _pylintrc.txt
PYLINT command: lint.Run(args)
  args=['--parseable=y', '--include-ids=y', '--comment=y', 
'--enable-similarities=y', '--disable-msg=C0301', '--disable-msg=C0321', 
'--disable-msg=W0142', '--disable-msg=W0403', 'test.py']
----
C:\dev\python\wxx\test.py:0: [W0131] Missing docstring
C:\dev\python\wxx\test.py:0: [W0103] Missing required attribute 
"__version__"
C:\dev\python\wxx\test.py:0: [W0103] Missing required attribute "__author__"
C:\dev\python\wxx\test.py:6: [R0913, AboutDialog.__init__] Too many 
arguments (7/5)
Traceback (most recent call last):
   File "c:\dev\python\runpylint.py", line 240, in ?
     main()
   File "c:\dev\python\runpylint.py", line 114, in main
     run(fname, options.parseable)
   File "c:\dev\python\runpylint.py", line 197, in run
     lint.Run(arguments)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
922, in __init__
     linter.check(args)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
625, in check
     self.check_file(filepath, modname, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
640, in check_file
     astng = self._check_file(filepath, modname, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
664, in _check_file
     self.check_astng_module(astng, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
721, in check_astng_module
     self.astng_events(astng, [checker for checker in checkers
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
738, in astng_events
     self.astng_events(child, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
738, in astng_events
     self.astng_events(child, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
738, in astng_events
     self.astng_events(child, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
738, in astng_events
     self.astng_events(child, checkers)
   File "c:\python23\Lib\site-packages\logilab\pylint\lint.py", line 
735, in astng_events
     checker.visit(astng)
   File "c:\python23\Lib\site-packages\logilab\common\astng\utils.py", 
line 91, in visit
     method(node)
   File 
"c:\python23\Lib\site-packages\logilab\pylint\checkers\classes.py", line 
190, in visit_function
     self.check_init(node)
   File 
"c:\python23\Lib\site-packages\logilab\pylint\checkers\classes.py", line 
355, in check_init
     to_call, unresolved = self._ancestors_to_call(node)
   File 
"c:\python23\Lib\site-packages\logilab\pylint\checkers\classes.py", line 
428, in _ancestors_to_call
     baseastng = baseastng.resolve(part)
   File "c:\python23\Lib\site-packages\logilab\common\astng\astng.py", 
line 201, in resolve
     raise ResolveError(name)
logilab.common.astng.ResolveError: Dialog

C:\dev\python\wxx>

------------------------------------
I included the _pylintrc.txt file that I used with this.

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

Hope this is usefull.  Note that I can run pylint 0.4.1 on the same file 
without any problem.

Merci!

Pierre Rouleau



-------------- next part --------------
#   DOCUMENT:     _PYLINTRC.TXT
#                 =============
# 
#   Abstract:         Pylint configuration for iMPath Guidelines
# 
#   iMPath restricted and confidential. Copyright iMPath 2004. All rights reserved.
# 
#   Last update: Tuesday, November 16, 2004. @ 12:04:34.
# 
#   File: ROUP2003N01::C:/dev/python/wxx/_pylintrc.txt
# 
#   RCS $Header: //software/official/MKS/MKS_SI/TV_NT/dev/Python/wxx/rcs/_pylintrc.txt 1.3 2004/10/15 08:37:27 PRouleau Exp $
# 
#   Update history:
# 
#   - File created: Friday, May 14, 2004. by Pierre Rouleau
#   - 12/07/04 rcs : RCS Revision 1.5  2004/05/20 17:37:13  PRouleau
#   - 13/10/04 rcs : RCS Revision 1.1  2004/07/12 13:23:18  PRouleau
#   - 13/10/04 rcs : RCS Initial revision
#   - 13/10/04 P.R.: [code:feature] : allow the use of 2-letter variables.
#   - 15/10/04 rcs : RCS Revision 1.2  2004/10/13 15:34:25  PRouleau
#   - 15/10/04 P.R.: [code:doc] : Added bret and bRet to the list of bad names.
#   - 15/11/04 rcs : RCS Revision 1.3  2004/10/15 08:37:27  PRouleau
#   - 15/11/04 P.R.: [code:feature] : No longer check for XXX and FIXME.  Use TODO!
#   - 16/11/04 P.R.: [code:feature] : updated to support Pylint 0.5.0 : more checks and flexibility supported.
# 
#   RCS $Log: $
# 
# 
# -----------------------------------------------------------------------------
# Overview
# ========
# 
# This file is a configuration file for the very useful Pylint tool. 
# 
# Pylint is a a tool that verifies the validity of Python source code, checks if
# the Python code complies with the Python Source Code Guideline and computes
# metrics.  
# 
# You should **always** check any python code you write with Pylint. Set up
# CRiSP to run pyck.cmd to compile Python source code. This way you will run
# Pylint (and other tools) to verify your python code.
# 
# The Pylint configuration sets the guideline and the things that must be
# checked. I have modified some of the guidelines to prevent excessive warning
# generation. These modifications are marked here with the IMPATH_MODIFIED tag.
# Over time these modifications will be removed, as our code gets closer to the
# pure Python guidelines.
# 
# The guideline has been modified to allow creation of wxPython code.
# 
# Please report any problems you may encounter to me (Pierre R).
# 
# 
# -----------------------------------------------------------------------------
#     lint Python modules using external checkers
# 
#     This class is itself both a raw checker and an astng checker in order to:
#     * handle some basic but necessary stats'data (number of classes, methods...)
#     * handle message activation / deactivation at the module level

[MASTER]
# Add <file> (may be a directory) to the black list. It should be a base name,
# not a path. You may set this option multiple times.
ignore=CVS

# Pickle collected data for later comparisons.
persistent=yes

# Set the cache size for astng objects.
cache-size=500


# -----------------------------------------------------------------------------

[REPORTS]
# Tells wether to display a full report or only the messages
reports=yes

# Use HTML as output format instead of text
html=no

# Use a parseable text output format, so your favorite text editor will be able
# to jump to the line corresponding to a message.
parseable=yes

# Colorizes text output using ansi escape codes
color=no

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be 
# written in a file name "pylint_global.[txt|html]".
files-output=no

# Python expression which should return a note less than 10 (10 is the highest
# note).You have access to the variables errors, warnings, statements which
# respectivly contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (R0004).
evaluation='10.0 - ((float(11 * error + warning + refactor + convention) / statement) * 10)'

# Add a comment according to your evaluation note. This is used by the global
# evaluation report (R0004).
comment=yes

# Include message's id in output
include-ids=yes

# Enable all messages in the listed categories.
enable-msg-cat=

# Disable all messages in the listed categories.
disable-msg-cat=

# Enable the message with the given id.
enable-msg=

# Disable the message with the given id.
disable-msg=

# Enable the report with the given id.
enable-report=

# Disable the report with the given id.
disable-report=


# -----------------------------------------------------------------------------
# checks for :                                                            
#   * doc strings                                                          
#   * modules / classes / functions / methods / arguments / variables name 
#   * number of arguments, local variables, branchs, returns and statements
#     in functions, methods                                                
#   * required module attributes                                           
#   * dangerous default values as arguments                                
#   * redefinition of function / method / class                            
#   * uses of the global statement                                         
    
[BASIC]
# Enable / disable this checker
enable-basic=yes

# Required attributes for module, separated by a comma
required-attributes=__version__,__author__

# Regular expression which should only match functions or classes name which do
# not require a docstring
no-docstring-rgx=__.*__

# Minimal length for module / class / function / method / argument / variable
# names
min-name-length=2

# Regular expression which should only match correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression which should only match correct class names
class-rgx=[A-Z][a-zA-Z0-9]+$

# Regular expression which should only match correct function names
# function-rgx=[a-z_][a-z0-9_]*$
# IMPATH_MODIFIED
function-rgx=[a-z_][a-zA-Z0-9_]*$

# Regular expression which should only match correct method names
# method-rgx=[a-z_][a-z0-9_]*$
# IMPATH_MODIFIED : wxPython code methods start with uppercase letters.
method-rgx=[a-zA-Z0-9_]*$

# Regular expression which should only match correct argument names
# argument-rgx=[a-z_][a-z0-9_]*$
# IMPATH_MODIFIED
argument-rgx=[a-z_][a-zA-Z0-9_]*$

# Regular expression which should only match correct variable names
# variable-rgx=[a-z_][a-z0-9_]*$
# IMPATH_MODIFIED (will be removed once other warnings are cleaned up)
variable-rgx=[a-z_][a-zA-Z0-9_]*$

# Good variable names which should always be accepted, separated by a comma
# good-names=i,j,k,ex,Run
# IMPATH_MODIFIED
good-names=ii,jj,kk

# Bad variable names which should always be refused, separated by a comma
# bad-names=foo,bar,baz,toto,tutu,tata
# IMPATH_MODIFIED
bad-names=foo,bar,baz,toto,tutu,tata,rc,bRet,bret

# List of builtins function names that should not be used, separated by a comma
# bad-functions=map,filter,apply,input
# IMPATH_MODIFIED
bad-functions=apply,input

# -----------------------------------------------------------------------------
# checks for                            
#   * external modules dependancies   
#   * relative / wildcard imports     
#   * cyclic imports                  
#   * uses of deprecated modules
    
[IMPORTS]
# Enable / disable this checker
enable-imports=yes

# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec

# -----------------------------------------------------------------------------
# checks for                                                              
#   * unused variables / imports                                        
#   * undefined variables                                               
#   * redefinition of variable from builtins or from an outer scope     
#   * use of variable before assigment                                  
    
[VARIABLES]
# Enable / disable this checker
enable-variables=yes

# Tells wether we should check for unused import in __init__ files.
init-import=no

# List of variable names used for dummy variables (i.e. not used).
dummy-variables=_,unused_arg,event

# -----------------------------------------------------------------------------
# checks for :                                                            
#   * methods without self as first argument                            
#   * overriden methods signature                                       
#   * access only to existant members via self                          
#   * attributes not defined in the __init__ method                     
#   * supported interfaces implementation                               
#   * unreachable code                                                  
    
[CLASSES]
# Enable / disable this checker
enable-classes=yes

# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,is_implemented_by

# Tells wether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes


# -----------------------------------------------------------------------------
# checks for sign of poor/misdesign:                                      
# * number of methods, attributes, local variables...
# * size, complexity of functions, methods
    
[DESIGN]
# Enable / disable this checker
enable-design=yes

# Maximum number of arguments for function / method
max-args=5

# Maximum number of locals for function / method body
max-locals=15

# Maximum number of return / yield for function / method body
max-returns=6

# Maximum number of branch for function / method body
max-branchs=12

# Maximum number of statements in function / method body
max-statements=50

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of attributes for a class (see R0902).
max-attributes=7

# Minimum number of public methods for a class (see R0903).
min-public-methods=2

# Maximum number of public methods for a class (see R0904).
max-public-methods=20


# -----------------------------------------------------------------------------
# checks for                                                              
#   * excepts without exception filter                                  
#   * string exceptions                                                 
    
[EXCEPTIONS]
# Enable / disable this checker
enable-exceptions=yes


# -----------------------------------------------------------------------------
# checks for :                                                            
#   * unauthorized constructions                                        
#   * strict indentation                                                
#   * line length                                                       
#   * use of <>
    
[FORMAT]
# Enable / disable this checker
enable-format=yes

# Maximum number of characters on a single line.
# max-line-length=80
# IMPATH_MODIFIED
max-line-length=132

# Maximum number of lines in a module
max-module-lines=1000

# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string='    '



# -----------------------------------------------------------------------------
# checks for:                                                             
#   * source code with non ascii characters but no encoding declaration (PEP
#     263)                                                                     
#   * warning notes in the code like FIXME, XXX
    
[MISCELLANEOUS]
# Enable / disable this checker
enable-miscellaneous=yes

# List of note tags to take in consideration, separated by a comma. Default to
# FIXME, XXX, TODO
notes=TODO



# -----------------------------------------------------------------------------
# does not check anything but gives some raw metrics :                    
#   * total number of lines                                             
#   * total number of code lines                                        
#   * total number of docstring lines                                   
#   * total number of comments lines                                    
#   * total number of empty lines                                       
    
[METRICS]
# Enable / disable this checker
enable-metrics=yes

# -----------------------------------------------------------------------------
# checks for similarities and duplicated code. This computation may be
# memory / CPU intensive, so you should disable it if you experiments some
# problems.
    
[SIMILARITIES]
# Enable / disable this checker
enable-similarities=yes

# Minimum lines number of a similarity.
min-similarity-lines=4

# Ignore comments when computing similarities.
ignore-comments=yes

# -----------------------------------------------------------------------------


More information about the Python-Projects mailing list