diff options
-rw-r--r-- | .hgtags | 2 | ||||
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | __pkginfo__.py | 6 | ||||
-rw-r--r-- | checkers/imports.py | 5 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/control | 7 | ||||
-rw-r--r-- | debian/pylint.manpages | 1 | ||||
-rw-r--r-- | doc/features.txt | 388 | ||||
-rw-r--r-- | doc/makefile | 2 | ||||
-rw-r--r-- | examples/pylintrc | 138 | ||||
-rw-r--r-- | man/pylint.1 | 119 | ||||
-rw-r--r-- | pyreverse/writer.py | 2 | ||||
-rw-r--r-- | test/test_import_graph.py | 3 |
13 files changed, 365 insertions, 316 deletions
@@ -1,2 +1,4 @@ f9e3771de4a213561f9efb5b3f1785e341de3e25 pylint-version-0_13_0 63f72a5447c9848450d47f47cb1a89ebc2a3e7de pylint-debian-version-0_13_0-1 +9f21b4da368aea49cedd73765d5cf10ea48d5973 pylint-version-0_15_0 +d90270eddb4a9bbe6c4c99006a4dbea2b4aafafc pylint-debian-version-0_15_0-1 @@ -1,7 +1,8 @@ ChangeLog for PyLint ==================== --- 0.15.0 +2008-09-10 -- 0.15.0 + * include pyreverse package and class diagram generation * included Stefan Rank's patch to deal with 2.4 relative import * included Robert Kirkpatrick's tutorial and typos fixes * fix bug in reenabling message diff --git a/__pkginfo__.py b/__pkginfo__.py index 4330f3d95..776c0c0c5 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -18,7 +18,7 @@ modname = 'pylint' -numversion = (0, 14, 0) +numversion = (0, 15, 1) version = '.'.join([str(num) for num in numversion]) license = 'GPL' @@ -49,8 +49,8 @@ ftp = "ftp://ftp.logilab.org/pub/%s" % modname mailinglist = "mailto://python-projects@logilab.org" from os.path import join -scripts = [join('bin', filename) - for filename in ('pylint', 'pylint-gui', "symilar", "epylint")] +scripts = [join('bin', filename) for filename in + ('pylint', 'pylint-gui', "symilar", "epylint", "pyreverse")] include_dirs = [join('test', 'input'), join('test', 'messages'), diff --git a/checkers/imports.py b/checkers/imports.py index c11238e8e..71e3204d5 100644 --- a/checkers/imports.py +++ b/checkers/imports.py @@ -93,15 +93,12 @@ def repr_tree_defs(data, indent_str=None): return '\n'.join(lines) -DOT_HEADERS = '''URL="." concentrate=false edge[fontsize="10"] -node[width="0" height="0" fontsize="12" fontcolor="black"]''' - def dependencies_graph(filename, dep_info): """write dependencies as a dot (graphviz) file """ done = {} printer = DotBackend(filename[:-4], rankdir = "LR") - printer.emit(DOT_HEADERS) + printer.emit('URL="." node[shape="box"]') for modname, dependencies in dep_info.items(): done[modname] = 1 printer.emit_node(modname) diff --git a/debian/changelog b/debian/changelog index 99d4b4589..65f169071 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,10 @@ -pylint (0.14.0-3) unstable; urgency=low +pylint (0.15.0-1) unstable; urgency=low + * new upstream release * Acknowledge NMU: thanks a lot, your patches have been backported in upstream code (closes: #427244, #448102, #415485, #431653) - -- + -- Emile Anclin <emile.anclin@logilab.fr> Wed, 10 Sep 2008 12:16:00 +0200 pylint (0.14.0-2.1) unstable; urgency=low diff --git a/debian/control b/debian/control index 76b38b3ce..18fdc232f 100644 --- a/debian/control +++ b/debian/control @@ -5,13 +5,13 @@ Maintainer: Sylvain Thénault <sylvain.thenault@logilab.fr> Uploaders: Alexandre Fayolle <afayolle@debian.org> Build-Depends: debhelper (>= 5.0.38) Build-Depends-Indep: python (>=2.3.5-7), python-central (>=0.5.6) -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Homepage: http://www.logilab.org/Project/name/pylint XS-Python-Version: all Package: pylint Architecture: all -Depends: python, python-logilab-common (>= 0.22.2), python-logilab-astng (>= 0.17.1) +Depends: python, python-logilab-common (>= 0.35.0), python-logilab-astng (>= 0.17.3) Recommends: python-tk XB-Python-Version: ${python:Versions} Conflicts: python2.2-pylint, python2.3-pylint, python2.4-pylint, pylint-common, pylint-test @@ -28,6 +28,9 @@ Description: python code static checker standard, or checking if declared interfaces are truly implemented, and much more. . + Pylint can generate UML class and package diagrams with the pyreverse + command. + . Additionally, it is possible to write plugins to add your own checks. . The recommended python-tk package is only for using the pylint-gui diff --git a/debian/pylint.manpages b/debian/pylint.manpages index 12b9a3324..4b550be55 100644 --- a/debian/pylint.manpages +++ b/debian/pylint.manpages @@ -1 +1,2 @@ man/pylint.1 +man/pyreverse.1 diff --git a/doc/features.txt b/doc/features.txt index 3ef51360b..7b3271b6d 100644 --- a/doc/features.txt +++ b/doc/features.txt @@ -1,6 +1,8 @@ PyLint features =============== +.. generated by pylint --list-msgs + .. contents:: General options @@ -20,13 +22,16 @@ General options :ignore: Add <file or directory> to the black list. It should be a base name, not a path. You may set this option multiple times. - Default: CVS + + Default: ``CVS`` :persistent: Pickle collected data for later comparisons. - Default: yes + + Default: ``yes`` :cache-size: Set the cache size for astng objects. - Default: 500 + + Default: ``500`` :load-plugins: List of plugins (as comma separated values of python modules names) to load, usually to register additional checkers. @@ -67,7 +72,8 @@ Reports options :output-format: Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html - Default: text + + Default: ``text`` :include-ids: Include message's id in output :files-output: @@ -76,14 +82,16 @@ Reports options written in a file name "pylint_global.[txt|html]". :reports: Tells wether to display a full report or only the messages - Default: yes + + Default: ``yes`` :evaluation: Python expression which should return a note less than 10 (10 is the highest note). You have access to the variables errors warning, statement 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). - Default: 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + + Default: ``10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)`` :comment: Add a comment according to your evaluation note. This is used by the global evaluation report (R0004). @@ -132,6 +140,64 @@ Main reports :R0004: Global evaluation +Variables checker +----------------- +checks for +* unused variables / imports +* undefined variables +* redefinition of variable from builtins or from an outer scope +* use of variable before assigment + +Options +~~~~~~~ +:init-import: + Tells wether we should check for unused import in __init__ files. +:dummy-variables-rgx: + A regular expression matching names used for dummy variables (i.e. not used). + + Default: ``_|dummy`` +:additional-builtins: + List of additional names supposed to be defined in builtins. Remember that + you should avoid to define new builtins when possible. + +Messages +~~~~~~~~ +:E0601: *Using variable %r before assignment* + Used when a local variable is accessed before it's assignment. +:E0602: *Undefined variable %r* + Used when an undefined variable is accessed. +:E0611: *No name %r in module %r* + Used when a name cannot be found in a module. +:W0601: *Global variable %r undefined at the module level* + Used when a variable is defined through the "global" statement but the + variable is not defined in the module scope. +:W0602: *Using global for %r but no assigment is done* + Used when a variable is defined through the "global" statement but no + assigment to this variable is done. +:W0603: *Using the global statement* + Used when you use the "global" statement to update a global variable. PyLint + just try to discourage this usage. That doesn't mean you can not use it ! +:W0604: *Using the global statement at the module level* + Used when you use the "global" statement at the module level since it has no + effect +:W0611: *Unused import %s* + Used when an imported module or variable is not used. +:W0612: *Unused variable %r* + Used when a variable is defined but not used. +:W0613: *Unused argument %r* + Used when a function or method argument is not used. +:W0614: *Unused import %s from wildcard import* + Used when an imported module or variable is not used from a 'from X import \*' + style import. +:W0621: *Redefining name %r from outer scope (line %s)* + Used when a variable's name hide a name defined in the outer scope. +:W0622: *Redefining built-in %r* + Used when a variable or function override a built-in. +:W0631: *Using possibly undefined loop variable %r* + Used when an loop variable (i.e. defined by a for loop or a list comprehension + or a generator expression) is used outside the loop. + + Basic checker ------------- checks for : @@ -151,44 +217,57 @@ Options :no-docstring-rgx: Regular expression which should only match functions or classes name which do not require a docstring - Default: __.*__ + + Default: ``__.*__`` :module-rgx: Regular expression which should only match correct module names - Default: `(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$` + + Default: ``(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$`` :const-rgx: Regular expression which should only match correct module level names - Default: `(([A-Z_][A-Z1-9_]*)|(__.*__))$` + + Default: ``(([A-Z_][A-Z0-9_]*)|(__.*__))$`` :class-rgx: Regular expression which should only match correct class names - Default: `[A-Z_][a-zA-Z0-9]+$` + + Default: ``[A-Z_][a-zA-Z0-9]+$`` :function-rgx: Regular expression which should only match correct function names - Default: `[a-z_][a-z0-9_]{2,30}$` + + Default: ``[a-z_][a-z0-9_]{2,30}$`` :method-rgx: Regular expression which should only match correct method names - Default: `[a-z_][a-z0-9_]{2,30}$` + + Default: ``[a-z_][a-z0-9_]{2,30}$`` :attr-rgx: Regular expression which should only match correct instance attribute names - Default: `[a-z_][a-z0-9_]{2,30}$` + + Default: ``[a-z_][a-z0-9_]{2,30}$`` :argument-rgx: Regular expression which should only match correct argument names - Default: `[a-z_][a-z0-9_]{2,30}$` + + Default: ``[a-z_][a-z0-9_]{2,30}$`` :variable-rgx: Regular expression which should only match correct variable names - Default: `[a-z_][a-z0-9_]{2,30}$` + + Default: ``[a-z_][a-z0-9_]{2,30}$`` :inlinevar-rgx: Regular expression which should only match correct list comprehension / generator expression variable names - Default: `[A-Za-z_][A-Za-z0-9_]*$` + + Default: ``[A-Za-z_][A-Za-z0-9_]*$`` :good-names: Good variable names which should always be accepted, separated by a comma - Default: i,j,k,ex,Run,_ + + Default: ``i,j,k,ex,Run,_`` :bad-names: Bad variable names which should always be refused, separated by a comma - Default: foo,bar,baz,toto,tutu,tata + + Default: ``foo,bar,baz,toto,tutu,tata`` :bad-functions: List of builtins function names that should not be used, separated by a comma - Default: map,filter,apply,input + + Default: ``map,filter,apply,input`` Messages ~~~~~~~~ @@ -201,11 +280,11 @@ Messages Used when a function / class / method is redefined. :E0103: *%r not properly in loop* Used when break or continue keywords are used outside a loop. -:E0104: *return outside function* +:E0104: *Return outside function* Used when a "return" statement is found outside a function or method. -:E0105: *yield outside function* +:E0105: *Yield outside function* Used when a "yield" statement is found outside a function or method. -:E0106: *return with argument inside generator* +:E0106: *Return with argument inside generator* Used when a "return" statement with an argument is found outside in a generator function or method (e.g. with some "yield" statements). :W0101: *Unreachable code* @@ -265,18 +344,21 @@ Options :ignore-mixin-members: Tells wether missing members accessed in mixin class should be ignored. A mixin class is detected if its name ends with "mixin" (case insensitive). - Default: yes + + Default: ``yes`` :ignored-classes: List of classes names for which member attributes should not be checked (useful for classes with attributes dynamicaly set). - Default: SQLObject + + Default: ``SQLObject`` :zope: - When zope mode is activated, consider the acquired-members option to ignore - access to some undefined attributes. -:acquired-members: - List of members which are usually get through zope's acquisition mecanism and - so shouldn't trigger E0201 when accessed (need zope=yes to be considered). - Default: REQUEST,acl_users,aq_parent + When zope mode is activated, add a predefined set of Zope acquired attributes + to generated-members. +:generated-members: + List of members which are set dynamically and missed by pylint inference + system, and so shouldn't trigger E0201 when accessed. + + Default: ``REQUEST,acl_users,aq_parent`` Messages ~~~~~~~~ @@ -295,61 +377,54 @@ Messages returns nothing but None. -Variables checker ------------------ +Imports checker +--------------- checks for -* unused variables / imports -* undefined variables -* redefinition of variable from builtins or from an outer scope -* use of variable before assigment +* external modules dependencies +* relative / wildcard imports +* cyclic imports +* uses of deprecated modules Options ~~~~~~~ -:init-import: - Tells wether we should check for unused import in __init__ files. -:dummy-variables-rgx: - A regular expression matching names used for dummy variables (i.e. not used). - Default: _|dummy -:additional-builtins: - List of additional names supposed to be defined in builtins. Remember that - you should avoid to define new builtins when possible. +:deprecated-modules: + Deprecated modules which should not be used, separated by a comma + + Default: ``regsub,string,TERMIOS,Bastion,rexec`` +:import-graph: + Create a graph of every (i.e. internal and external) dependencies in the + given file (report R0402 must not be disabled) +:ext-import-graph: + Create a graph of external dependencies in the given file (report R0402 must + not be disabled) +:int-import-graph: + Create a graph of internal dependencies in the given file (report R0402 must + not be disabled) Messages ~~~~~~~~ -:E0601: *Using variable %r before assignment* - Used when a local variable is accessed before it's assignment. -:E0602: *Undefined variable %r* - Used when an undefined variable is accessed. -:E0611: *No name %r in module %r* - Used when a name cannot be found in a module. -:W0601: *Global variable %r undefined at the module level* - Used when a variable is defined through the "global" statement but the - variable is not defined in the module scope. -:W0602: *Using global for %r but no assigment is done* - Used when a variable is defined through the "global" statement but no - assigment to this variable is done. -:W0603: *Using the global statement* - Used when you use the "global" statement to update a global variable. PyLint - just try to discourage this usage. That doesn't mean you can not use it ! -:W0604: *Using the global statement at the module level* - Used when you use the "global" statement at the module level since it has no - effect -:W0611: *Unused import %s* - Used when an imported module or variable is not used. -:W0612: *Unused variable %r* - Used when a variable is defined but not used. -:W0613: *Unused argument %r* - Used when a function or method argument is not used. -:W0614: *Unused import %s from wildcard import* - Used when an imported module or variable is not used from a `from X import *` - style import. -:W0621: *Redefining name %r from outer scope (line %s)* - Used when a variable's name hide a name defined in the outer scope. -:W0622: *Redefining built-in %r* - Used when a variable or function override a built-in. -:W0631: *Using possibly undefined loop variable %r* - Used when an loop variable (i.e. defined by a for loop or a list comprehension - or a generator expression) is used outside the loop. +:W0401: *Wildcard import %s* + Used when `from module import *` is detected. +:W0402: *Uses of a deprecated module %r* + Used a module marked as deprecated is imported. +:W0403: *Relative import %r* + Used when an import relative to the package directory is detected. +:W0404: *Reimport %r (imported line %s)* + Used when a module is reimported multiple times. +:W0406: *Module import itself* + Used when a module is importing itself. +:W0410: *__future__ import is not the first non docstring statement* + Python 2.5 and greater require __future__ import to be the first non docstring + statement in the module. +:R0401: *Cyclic import (%s)* + Used when a cyclic import between two or more modules is detected. +:F0401: *Unable to import %r (%s)* + Used when pylint has been unable to import a module. + +Reports +~~~~~~~ +:R0401: External dependencies +:R0402: Modules dependencies graph Classes checker @@ -367,10 +442,12 @@ Options :ignore-iface-methods: 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. - Default: isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by + + Default: ``isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by`` :defining-attr-methods: List of method names used to declare (i.e. assign) instance attributes. - Default: __init__,__new__,setUp + + Default: ``__init__,__new__,setUp`` Messages ~~~~~~~~ @@ -442,31 +519,40 @@ Options ~~~~~~~ :max-args: Maximum number of arguments for function / method - Default: 5 + + Default: ``5`` :max-locals: Maximum number of locals for function / method body - Default: 15 + + Default: ``15`` :max-returns: Maximum number of return / yield for function / method body - Default: 6 + + Default: ``6`` :max-branchs: Maximum number of branch for function / method body - Default: 12 + + Default: ``12`` :max-statements: Maximum number of statements in function / method body - Default: 50 + + Default: ``50`` :max-parents: Maximum number of parents for a class (see R0901). - Default: 7 + + Default: ``7`` :max-attributes: Maximum number of attributes for a class (see R0902). - Default: 7 + + Default: ``7`` :min-public-methods: Minimum number of public methods for a class (see R0903). - Default: 2 + + Default: ``2`` :max-public-methods: Maximum number of public methods for a class (see R0904). - Default: 20 + + Default: ``20`` Messages ~~~~~~~~ @@ -502,55 +588,6 @@ Messages Used when an interface class is not implemented anywhere. -Imports checker ---------------- -checks for -* external modules dependencies -* relative / wildcard imports -* cyclic imports -* uses of deprecated modules - -Options -~~~~~~~ -:deprecated-modules: - Deprecated modules which should not be used, separated by a comma - Default: regsub,string,TERMIOS,Bastion,rexec -:import-graph: - Create a graph of every (i.e. internal and external) dependencies in the - given file (report R0402 must not be disabled) -:ext-import-graph: - Create a graph of external dependencies in the given file (report R0402 must - not be disabled) -:int-import-graph: - Create a graph of internal dependencies in the given file (report R0402 must - not be disabled) - -Messages -~~~~~~~~ -:W0401: *Wildcard import %s* - Used when `from module import *` is detected. -:W0402: *Uses of a deprecated module %r* - Used a module marked as deprecated is imported. -:W0403: *Relative import %r* - Used when an import relative to the package directory is detected. -:W0404: *Reimport %r (imported line %s)* - Used when a module is reimported multiple times. -:W0406: *Module import itself* - Used when a module is importing itself. -:W0410: *__future__ import is not the first non docstring statement* - Python 2.5 and greater require __future__ import to be the first non docstring - statement in the module. -:R0401: *Cyclic import (%s)* - Used when a cyclic import between two or more modules is detected. -:F0401: *Unable to import %r (%s)* - Used when pylint has been unable to import a module. - -Reports -~~~~~~~ -:R0401: External dependencies -:R0402: Modules dependencies graph - - Newstyle checker ---------------- checks for usage of new style capabilities on old style classes and @@ -608,6 +645,39 @@ Messages value which can't be used as an exception. +Similarities checker +-------------------- +checks for similarities and duplicated code. This computation may be +memory / CPU intensive, so you should disable it if you experiments some +problems. + +Options +~~~~~~~ +:min-similarity-lines: + Minimum lines number of a similarity. + + Default: ``4`` +:ignore-comments: + Ignore comments when computing similarities. + + Default: ``yes`` +:ignore-docstrings: + Ignore docstrings when computing similarities. + + Default: ``yes`` + +Messages +~~~~~~~~ +:R0801: *Similar lines in %s files* + Indicates that a set of similar lines has been detected among multiple file. + This usually means that the code should be refactored to avoid this + duplication. + +Reports +~~~~~~~ +:R0801: Duplication + + Format checker -------------- checks for : @@ -620,14 +690,17 @@ Options ~~~~~~~ :max-line-length: Maximum number of characters on a single line. - Default: 80 + + Default: ``80`` :max-module-lines: Maximum number of lines in a module - Default: 1000 + + Default: ``1000`` :indent-string: String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab). - Default: ' ' + + Default: ``' '`` Messages ~~~~~~~~ @@ -673,7 +746,8 @@ Options ~~~~~~~ :notes: List of note tags to take in consideration, separated by a comma. - Default: FIXME,XXX,TODO + + Default: ``FIXME,XXX,TODO`` Messages ~~~~~~~~ @@ -703,33 +777,3 @@ Reports :R0701: Raw metrics -Similarities checker --------------------- -checks for similarities and duplicated code. This computation may be -memory / CPU intensive, so you should disable it if you experiments some -problems. - -Options -~~~~~~~ -:min-similarity-lines: - Minimum lines number of a similarity. - Default: 4 -:ignore-comments: - Ignore comments when computing similarities. - Default: yes -:ignore-docstrings: - Ignore docstrings when computing similarities. - Default: yes - -Messages -~~~~~~~~ -:R0801: *Similar lines in %s files* - Indicates that a set of similar lines has been detected among multiple file. - This usually means that the code should be refactored to avoid this - duplication. - -Reports -~~~~~~~ -:R0801: Duplication - - diff --git a/doc/makefile b/doc/makefile index 4e0481b9f..595869fbe 100644 --- a/doc/makefile +++ b/doc/makefile @@ -1,5 +1,5 @@ MKHTML=mkdoc -MKHTML_OPT=--doctype article --param toc.section.depth=1 --target html --stylesheet single-file +MKHTML_OPT=--doctype article --param toc.section.depth=1 --target html --stylesheet standard SRC=. diff --git a/examples/pylintrc b/examples/pylintrc index f674e19e4..6ed593f45 100644 --- a/examples/pylintrc +++ b/examples/pylintrc @@ -91,6 +91,46 @@ comment=no #disable-report= +# try to find bugs in the code using type inference +# +[TYPECHECK] + +# 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 + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamicaly set). +ignored-classes=SQLObject + +# When zope mode is activated, add a predefined set of Zope acquired attributes +# to generated-members. +zope=no + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. +generated-members=REQUEST,acl_users,aq_parent + + +# checks for +# * unused variables / imports +# * undefined variables +# * redefinition of variable from builtins or from an outer scope +# * use of variable before assigment +# +[VARIABLES] + +# Tells wether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching names used for dummy variables (i.e. not used). +dummy-variables-rgx=_|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + # checks for : # * doc strings # * modules / classes / functions / methods / arguments / variables name @@ -114,7 +154,7 @@ no-docstring-rgx=__.*__ module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ # Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z1-9_]*)|(__.*__))$ +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ # Regular expression which should only match correct class names class-rgx=[A-Z_][a-zA-Z0-9]+$ @@ -148,64 +188,6 @@ bad-names=foo,bar,baz,toto,tutu,tata bad-functions=map,filter,apply,input -# try to find bugs in the code using type inference -# -[TYPECHECK] - -# 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 - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamicaly set). -ignored-classes=SQLObject - -# When zope mode is activated, consider the acquired-members option to ignore -# access to some undefined attributes. -zope=no - -# List of members which are usually get through zope's acquisition mecanism and -# so shouldn't trigger E0201 when accessed (need zope=yes to be considered). -acquired-members=REQUEST,acl_users,aq_parent - - -# checks for -# * unused variables / imports -# * undefined variables -# * redefinition of variable from builtins or from an outer scope -# * use of variable before assigment -# -[VARIABLES] - -# Tells wether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching names used for dummy variables (i.e. not used). -dummy-variables-rgx=_|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -# checks for : -# * methods without self as first argument -# * overridden methods signature -# * access only to existant members via self -# * attributes not defined in the __init__ method -# * supported interfaces implementation -# * unreachable code -# -[CLASSES] - -# 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,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - - # checks for sign of poor/misdesign: # * number of methods, attributes, local variables... # * size, complexity of functions, methods @@ -240,6 +222,24 @@ min-public-methods=2 max-public-methods=20 +# checks for : +# * methods without self as first argument +# * overridden methods signature +# * access only to existant members via self +# * attributes not defined in the __init__ method +# * supported interfaces implementation +# * unreachable code +# +[CLASSES] + +# 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,adaptWith,is_implemented_by + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + + # checks for # * external modules dependencies # * relative / wildcard imports @@ -283,16 +283,6 @@ max-module-lines=1000 indent-string=' ' -# checks for: -# * warning notes in the code like FIXME, XXX -# * PEP 263: source code with non ascii character but no encoding declaration -# -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - # checks for similarities and duplicated code. This computation may be # memory / CPU intensive, so you should disable it if you experiments some # problems. @@ -307,3 +297,13 @@ ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes + + +# checks for: +# * warning notes in the code like FIXME, XXX +# * PEP 263: source code with non ascii character but no encoding declaration +# +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO diff --git a/man/pylint.1 b/man/pylint.1 index 1e58bc5de..f053332a0 100644 --- a/man/pylint.1 +++ b/man/pylint.1 @@ -42,15 +42,15 @@ enable the rpython checker which is disabled by default .IP "--errors-only, -e" In debug mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default .IP "--profile=<y_or_n>" -Profiled execution. [current: %default] +Profiled execution. [current: no] .IP "--ignore=<file>" -Add <file or directory> to the black list. It should be a base name, not a path. You may set this option multiple times. [current: %default] +Add <file or directory> to the black list. It should be a base name, not a path. You may set this option multiple times. [current: CVS] .IP "--persistent=<y_or_n>" -Pickle collected data for later comparisons. [current: %default] +Pickle collected data for later comparisons. [current: yes] .IP "--cache-size=<size>" -Set the cache size for astng objects. [current: %default] +Set the cache size for astng objects. [current: 500] .IP "--load-plugins=<modules>" -List of plugins (as comma separated values of python modules names) to load, usually to register additional checkers. [current: %default] +List of plugins (as comma separated values of python modules names) to load, usually to register additional checkers. [current: none] .SH COMMANDS .IP "--help-msg=<msg-id>" @@ -62,11 +62,11 @@ Generate a sample configuration file according to the current configuration. You .IP "--generate-man" Generate pylint's man page. -.SH MESSAGES CONTROL +.SH MESSAGE CONTROL .IP "--enable-checker=<checker ids>" -Enable only checker(s) with the given id(s). This option conflicts with the disable-checker option +Enable only checker(s) with the given id(s). This option conflicts with the disable-checker option .IP "--disable-checker=<checker ids>" -Enable all checker(s) except those with the given id(s). This option conflicts with the enable-checker option +Enable all checker(s) except those with the given id(s). This option conflicts with the enable-checker option .IP "--enable-msg-cat=<msg cats>" Enable all messages in the listed categories. .IP "--disable-msg-cat=<msg cats>" @@ -78,17 +78,17 @@ Disable the message(s) with the given id(s). .SH REPORTS .IP "--output-format=<format>, -f <format>" -Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html [current: %default] +Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html [current: text] .IP "--include-ids=<y_or_n>, -i <y_or_n>" -Include message's id in output [current: %default] +Include message's id in output [current: no] .IP "--files-output=<y_or_n>" -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]". [current: %default] +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]". [current: no] .IP "--reports=<y_or_n>, -r <y_or_n>" -Tells wether to display a full report or only the messages [current: %default] +Tells wether to display a full report or only the messages [current: yes] .IP "--evaluation=<python_expression>" -Python expression which should return a note less than 10 (10 is the highest note). You have access to the variables errors warning, statement 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). [current: %default] +Python expression which should return a note less than 10 (10 is the highest note). You have access to the variables errors warning, statement 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). [current: 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)] .IP "--comment=<y_or_n>" -Add a comment according to your evaluation note. This is used by the global evaluation report (R0004). [current: %default] +Add a comment according to your evaluation note. This is used by the global evaluation report (R0004). [current: no] .IP "--enable-report=<rpt ids>" Enable the report(s) with the given id(s). .IP "--disable-report=<rpt ids>" @@ -96,107 +96,108 @@ Disable the report(s) with the given id(s). .SH BASIC .IP "--required-attributes=<attributes>" -Required attributes for module, separated by a comma [current: %default] +Required attributes for module, separated by a comma [current: none] .IP "--no-docstring-rgx=<regexp>" -Regular expression which should only match functions or classes name which do not require a docstring [current: %default] +Regular expression which should only match functions or classes name which do not require a docstring [current: __.*__] .IP "--module-rgx=<regexp>" -Regular expression which should only match correct module names [current: %default] +Regular expression which should only match correct module names [current: (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$] .IP "--const-rgx=<regexp>" -Regular expression which should only match correct module level names [current: %default] +Regular expression which should only match correct module level names [current: (([A-Z_][A-Z0-9_]*)|(__.*__))$] .IP "--class-rgx=<regexp>" -Regular expression which should only match correct class names [current: %default] +Regular expression which should only match correct class names [current: [A-Z_][a-zA-Z0-9]+$] .IP "--function-rgx=<regexp>" -Regular expression which should only match correct function names [current: %default] +Regular expression which should only match correct function names [current: [a-z_][a-z0-9_]{2,30}$] .IP "--method-rgx=<regexp>" -Regular expression which should only match correct method names [current: %default] +Regular expression which should only match correct method names [current: [a-z_][a-z0-9_]{2,30}$] .IP "--attr-rgx=<regexp>" -Regular expression which should only match correct instance attribute names [current: %default] +Regular expression which should only match correct instance attribute names [current: [a-z_][a-z0-9_]{2,30}$] .IP "--argument-rgx=<regexp>" -Regular expression which should only match correct argument names [current: %default] +Regular expression which should only match correct argument names [current: [a-z_][a-z0-9_]{2,30}] .IP "--variable-rgx=<regexp>" -Regular expression which should only match correct variable names [current: %default] +Regular expression which should only match correct variable names [current: [a-z_][a-z0-9_]{2,30}$] .IP "--inlinevar-rgx=<regexp>" -Regular expression which should only match correct list comprehension / generator expression variable names [current: %default] +Regular expression which should only match correct list comprehension / generator expression variable names [current: [A-Za-z_][A-Za-z0-9_]*$] .IP "--good-names=<names>" -Good variable names which should always be accepted, separated by a comma [current: %default] +Good variable names which should always be accepted, separated by a comma [current: i,j,k,ex,Run,_] .IP "--bad-names=<names>" -Bad variable names which should always be refused, separated by a comma [current: %default] +Bad variable names which should always be refused, separated by a comma [current: foo,bar,baz,toto,tutu,tata ] .IP "--bad-functions=<builtin function names>" -List of builtins function names that should not be used, separated by a comma [current: %default] +List of builtins function names that should not be used, separated by a comma [current: map,filter,apply,input] .SH CLASSES .IP "--ignore-iface-methods=<method names>" -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. [current: %default] +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. [current: isIm plementedBy,deferred,extends,names,namesAndDescription s,queryDescriptionFor,getBases,getDescriptionFor,getDo c,getName,getTaggedValue,getTaggedValueTags,isEqualOrE xtendedBy,setTaggedValue,isImplementedByInstancesOf,ad aptWith,is_implemented_by] .IP "--defining-attr-methods=<method names>" -List of method names used to declare (i.e. assign) instance attributes. [current: %default] +List of method names used to declare (i.e. assign) instance attributes. [current: __init__,__new__,setUp] .SH DESIGN .IP "--max-args=<int>" -Maximum number of arguments for function / method [current: %default] +Maximum number of arguments for function / method [current: 5] .IP "--max-locals=<int>" -Maximum number of locals for function / method body [current: %default] +Maximum number of locals for function / method body [current: 15] .IP "--max-returns=<int>" -Maximum number of return / yield for function / method body [current: %default] +Maximum number of return / yield for function / method body [current: 6] .IP "--max-branchs=<int>" -Maximum number of branch for function / method body [current: %default] +Maximum number of branch for function / method body [current: 12] .IP "--max-statements=<int>" -Maximum number of statements in function / method body [current: %default] +Maximum number of statements in function / method body [current: 50] .IP "--max-parents=<num>" -Maximum number of parents for a class (see R0901). [current: %default] +Maximum number of parents for a class (see R0901). [current: 7] .IP "--max-attributes=<num>" -Maximum number of attributes for a class (see R0902). [current: %default] +Maximum number of attributes for a class (see R0902). [current: 7] .IP "--min-public-methods=<num>" -Minimum number of public methods for a class (see R0903). [current: %default] +Minimum number of public methods for a class (see R0903). [current: 2] .IP "--max-public-methods=<num>" -Maximum number of public methods for a class (see R0904). [current: %default] +Maximum number of public methods for a class (see R0904). [current: 20] .SH FORMAT .IP "--max-line-length=<int>" -Maximum number of characters on a single line. [current: %default] +Maximum number of characters on a single line. [current: 80] .IP "--max-module-lines=<int>" -Maximum number of lines in a module [current: %default] +Maximum number of lines in a module [current: 1000] .IP "--indent-string=<string>" -String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab). [current: %default] +String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab). + [current: " "] .SH IMPORTS .IP "--deprecated-modules=<modules>" -Deprecated modules which should not be used, separated by a comma [current: %default] +Deprecated modules which should not be used, separated by a comma [current: regsub,string,TERMIOS,Bastion,rexec] .IP "--import-graph=<file.dot>" -Create a graph of every (i.e. internal and external) dependencies in the given file (report R0402 must not be disabled) [current: %default] +Create a graph of every (i.e. internal and external) dependencies in the given file (report R0402 must not be disabled) [current: none] .IP "--ext-import-graph=<file.dot>" -Create a graph of external dependencies in the given file (report R0402 must not be disabled) [current: %default] +Create a graph of external dependencies in the given file (report R0402 must not be disabled) [current: none] .IP "--int-import-graph=<file.dot>" -Create a graph of internal dependencies in the given file (report R0402 must not be disabled) [current: %default] +Create a graph of internal dependencies in the given file (report R0402 must not be disabled) [current: none] .SH MISCELLANEOUS .IP "--notes=<comma separated values>" -List of note tags to take in consideration, separated by a comma. [current: %default] +List of note tags to take in consideration, separated by a comma. [current: FIXME,TODO,XXX] .SH SIMILARITIES .IP "--min-similarity-lines=<int>" -Minimum lines number of a similarity. [current: %default] +Minimum lines number of a similarity. [current: 4] .IP "--ignore-comments=<y or n>" -Ignore comments when computing similarities. [current: %default] +Ignore comments when computing similarities. [current: yes] .IP "--ignore-docstrings=<y or n>" -Ignore docstrings when computing similarities. [current: %default] +Ignore docstrings when computing similarities. [current: yes] .SH TYPECHECK .IP "--ignore-mixin-members=<y_or_n>" -Tells wether missing members accessed in mixin class should be ignored. A mixin class is detected if its name ends with "mixin" (case insensitive). [current: %default] -.IP "--ignored-classes=<members names>" -List of classes names for which member attributes should not be checked (useful for classes with attributes dynamicaly set). [current: %default] +Tells wether missing members accessed in mixin class should be ignored. A mixin class is detected if its name ends with "mixin" (case insensitive). [current: yes] +.IP "--ignored-classes=<names>" +List of class names for which member attributes should not be checked (useful for classes with attributes dynamicaly set). [current: SQLObject] .IP "--zope=<y_or_n>" -When zope mode is activated, consider the acquired-members option to ignore access to some undefined attributes. [current: %default] -.IP "--acquired-members=<members names>" -List of members which are usually get through zope's acquisition mecanism and so shouldn't trigger E0201 when accessed (need zope=yes to be considered). [current: %default] +When zope mode is activated, consider the acquired-members option to ignore access to some undefined attributes. [current: no] +.IP "--generated-members=<members>" +List of members which are usually get through zope's acquisition mecanism and so shouldn't trigger E0201 when accessed (need zope=yes to be considered). [current: REQUEST,acl_users,aq_parent] .SH VARIABLES .IP "--init-import=<y_or_n>" -Tells wether we should check for unused import in __init__ files. [current: %default] +Tells wether we should check for unused import in __init__ files. [current: no] .IP "--dummy-variables-rgx=<regexp>" -A regular expression matching names used for dummy variables (i.e. not used). [current: %default] +A regular expression matching names used for dummy variables (i.e. not used). [current: _|dummy] .IP "--additional-builtins=<comma separated list>" -List of additional names supposed to be defined in builtins. Remember that you should avoid to define new builtins when possible. [current: %default] +List of additional names supposed to be defined in builtins. Remember that you should avoid to define new builtins when possible. [current: none] .SH ENVIRONMENT VARIABLES diff --git a/pyreverse/writer.py b/pyreverse/writer.py index e09eabfd2..6284f8b5f 100644 --- a/pyreverse/writer.py +++ b/pyreverse/writer.py @@ -104,7 +104,7 @@ class DotWriter(DiagramWriter): def set_printer(self, file_name, basename): """initialize DotWriter and add options for layout. """ - layout = dict(rankdir="BT", concentrate="true") + layout = dict(rankdir="BT") self.printer = DotBackend(basename, additionnal_param=layout) self.file_name = file_name diff --git a/test/test_import_graph.py b/test/test_import_graph.py index ec31c4e4b..5d7ee9a09 100644 --- a/test/test_import_graph.py +++ b/test/test_import_graph.py @@ -24,8 +24,7 @@ class DependenciesGraphTC(unittest.TestCase): digraph "dependencies_graph" { rankdir=LR charset="utf-8" -URL="." concentrate=false edge[fontsize="10"] -node[width="0" height="0" fontsize="12" fontcolor="black"] +URL="." node[shape="box"] "hoho" []; "yep" []; "labas" []; |