diff options
author | Jacek Konieczny <jajcus@jajcus.net> | 2005-03-20 20:57:57 +0300 |
---|---|---|
committer | Jacek Konieczny <jajcus@jajcus.net> | 2005-03-20 20:57:57 +0300 |
commit | 3ee11af7c2acfd7206c34ef76577965d2fb575a6 (patch) | |
tree | 7bd51b52ec18edbe72d75c2e53098b7ca116025b /auxtools | |
parent | 2bbbe6c9b1d27a78a1601f8fb97b0cee65a9cf64 (diff) |
- update for the new pylint
Diffstat (limited to 'auxtools')
-rwxr-xr-x | auxtools/pylint.sh | 45 | ||||
-rw-r--r-- | auxtools/pylintrc | 251 |
2 files changed, 177 insertions, 119 deletions
diff --git a/auxtools/pylint.sh b/auxtools/pylint.sh index 784dc9a..06a55c4 100755 --- a/auxtools/pylint.sh +++ b/auxtools/pylint.sh @@ -7,51 +7,12 @@ fi cd $auxdir auxdir=`pwd` cd .. -make >&2 +#make >&2 topdir=`pwd` cd build/lib.* -DISABLE_MSG="W0324,W0322,W0323,W0704,W0121,W0702" -IGNORE="^" -IGNORE="${IGNORE}\\(W0232\\|E0201\\):[^:]*:JID" -IGNORE="${IGNORE}\\|W0231:.*base class 'object'" -IGNORE="${IGNORE}\\|W0403:.*'stringprep'" -IGNORE="${IGNORE}\\|W0613:[^:]*:\\(StreamHandler.*'doc'\\|RR_.*\\('length'\\|'cls'\\)\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:\\(ClientStream.*'realm'\\|Client.*'iq'\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:\\(StreamBase.*'doc'\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:PlainClientAuthenticator.*\\('challenge'\\|'data'\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:PasswordManager.*\\('username'\\|'realm'\\|'acceptable_formats'\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:ClientAuthenticator.*\\('username'\\|'authzid'\\|'challenge'\\|'data'\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:ServerAuthenticator.*\\('initial_response'\\|'response'\\)" -IGNORE="${IGNORE}\\|W0613:[^:]*:DigestMD5ServerAuthenticator.start.*'response'" -IGNORE="${IGNORE}\\|W0613:[^:]*:MucRoomState.set_stream.*'stream'" -IGNORE="${IGNORE}\\|W0613:[^:]*:LegacyClientStream.*'\\(stanza\\|resource\\)'" -IGNORE="${IGNORE}\\|W0613:[^:]*:JabberClient\\.connect.*'register'" -IGNORE="${IGNORE}\\|W0613:[^:]*:VCard.*\\.__init__.*'rfc2425parameters'" -IGNORE="${IGNORE}\\|W0613:[^:]*:Cache.request_object.error_handler.*'data'" -IGNORE="${IGNORE}\\|W0613:[^:]*:.*complete_xml_element.*'doc'" -IGNORE="${IGNORE}\\|W0612:[^:]*:Cache.purge_items.*'i'" -IGNORE="${IGNORE}\\|W0612:[^:]*:\\(StreamBase._connect.*'canonname'\\|StreamBase._loop_iter.*'ofd'\\)" -IGNORE="${IGNORE}\\|W0612:[^:]*:\\(parse_message:.*'i'\\|do_query:.*'canonname'\\)" -IGNORE="${IGNORE}\\|W0612:[^:]*:\\(VCard\\.rfc2426:.*'name'\\|VCard\\.complete_xml_element:.*'name'\\|VCard\\.__init__:.*'cl'\\)" -IGNORE="${IGNORE}\\|W0201:[^:]*:\\([^.]*\\._reset\\|ClientStream.*'me'\\)" -IGNORE="${IGNORE}\\|W0201:[^:]*:StreamSASLMixIn.*'\\(me\\|authenticated\\|peer_authenticated\\|peer\\|auth_method_used\\)'" -IGNORE="${IGNORE}\\|W0201:[^:]*:StreamTLSMixIn.*'\\(socket\\|features\\)'" -IGNORE="${IGNORE}\\|W0201:[^:]*:ComponentStream._process_node" -IGNORE="${IGNORE}\\|W0201:[^:]*:DiscoItem.*\\(node\\|jid\\|name\\|action\\)" -IGNORE="${IGNORE}\\|W0201:[^:]*:DiscoIdentity.*\\(category\\|type\\|name\\)" -IGNORE="${IGNORE}\\|W0201:[^:]*:DiscoItems.*\\(node\\|items\\)" -IGNORE="${IGNORE}\\|W0201:[^:]*:DiscoInfo.*\\(node\\|features\\|identities\\)" -IGNORE="${IGNORE}\\|E0201:[^:]*:VCard.__make_fn:.*'n'" -IGNORE="${IGNORE}\\|W0221:[^:]*:\\(Client\\|Component\\)Stream._\\?\\(connect\\|accept\\)" -IGNORE="${IGNORE}\\|W0232:[^:]*:\\(CachedPropertyObject\\|StanzaPayloadWrapperObject\\|StanzaPayloadObject\\):.*__init__" -IGNORE="${IGNORE}\\|W0231:[^:]*:.*'\\(CachedPropertyObject\\|StanzaPayloadWrapperObject\\|StanzaPayloadObject\\)'" -IGNORE="${IGNORE}\\|W0152:[^:]*:.*" -IGNORE="${IGNORE}\\|\\(W0141\\|E0102\\):.*:Cache\\.request_object\\.\\(error\\|timeout\\)_handler" - -export PYLINTRC=$auxdir/pylintrc if [ -n "$1" ] ; then - pylint --disable-msg $DISABLE_MSG $1 | sed -e"s#$IGNORE#ignore that: &#" + pylint --rcfile $auxdir/pylintrc $1 else - pylint --disable-msg $DISABLE_MSG pyxmpp | sed -e"s#$IGNORE#ignore that: &#" + pylint --rcfile $auxdir/pylintrc pyxmpp fi diff --git a/auxtools/pylintrc b/auxtools/pylintrc index 91321a0..76b2f75 100644 --- a/auxtools/pylintrc +++ b/auxtools/pylintrc @@ -1,35 +1,118 @@ -# lint Python modules using external checkers. -# [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 +# Add <file or directory> to the black list. It should be a base name, not a +# path. You may set this option multiple times. +ignore=.svn # 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=no + +# 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 +# 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). -evaluation='10.0 - ((float(5 * errors + warnings) / statements) * 10)' +evaluation=10.0 - ((float(5 * 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 +comment=no # 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=C0324,C0322,C0323,W0704,W0121,W0702,W0142 + +# Enable the report with the given id. +enable-report= + +# Disable the report with the given id. +disable-report= + + + +# 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, _unused1, _unused2, _unused3, _unused4 + + + +# checks for +# * external modules dependencies +# * relative / wildcard imports +# * cyclic imports +# * uses of deprecated modules +# +# This checker also defines the following reports: +# * R0401: External dependencies +# * R0402: Modules dependencies graph +# +[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,types + +# Create a graph of every (i.e. internal and external) dependencies in the given +# file (report R0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report R0402 must +# not be disabled) +ext-import-graph=ext_import_graph + +# Create a graph of internal dependencies in the given file (report R0402 must +# not be disabled) +int-import-graph=int_import_graph + + + # checks for : # * doc strings # * modules / classes / functions / methods / arguments / variables name @@ -39,31 +122,16 @@ include-ids=yes # * dangerous default values as arguments # * redefinition of function / method / class # * uses of the global statement -# +# +# This checker also defines the following reports: +# * R0101: Statistics by type +# [BASIC] # Enable / disable this checker enable-basic=yes -# Maximum number of arguments for function / method -#max-args=5 -max-args=15 - -# Maximum number of locals for function / method body -max-locals=25 - -# Maximum number of return / yield for function / method body -# J: limiting number of exit points sometimes complicates the code and makes it -# less readable IMHO -max-returns=100 - -# Maximum number of branch for function / method body -max-branchs=15 - -# Maximum number of statements in function / method body -max-statements=50 - # Required attributes for module, separated by a comma -required-attributes=__revision__,__docformat__ +required-attributes=__revision__ # Regular expression which should only match functions or classes name which do # not require a docstring @@ -77,7 +145,7 @@ min-name-length=1 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-z_A-Z0-9]+$ +class-rgx=(error)|([A-Z_][a-zA-Z0-9]+)$ # Regular expression which should only match correct function names function-rgx=[a-z_][a-z0-9_]*$ @@ -92,7 +160,7 @@ argument-rgx=[a-z_][a-z0-9_]*$ variable-rgx=[a-z_][a-z0-9_]*$ # Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run +good-names=i,j,k,ex,Run,_,tmp,iq,m,p # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata @@ -102,33 +170,42 @@ bad-functions=map,filter,apply,input -# checks for -# * external modules dependancies -# * relative / wildcard imports -# * cyclic imports -# * uses of deprecated modules +# checks for sign of poor/misdesign: +# * number of methods, attributes, local variables... +# * size, complexity of functions, methods # -[IMPORTS] +[DESIGN] # Enable / disable this checker -enable-imports=yes +enable-design=yes -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec +# Maximum number of arguments for function / method +max-args=15 +# Maximum number of locals for function / method body +max-locals=25 +# Maximum number of return / yield for function / method body +# J: limiting number of exit points sometimes complicates the code and makes it +# less readable IMHO +max-returns=100 -# 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 +# Maximum number of branch for function / method body +max-branchs=15 -# Tells wether we should check for unused import in __init__ files. -init-import=no +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=10 + +# Maximum number of attributes for a class (see R0902). +max-attributes=40 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=0 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=60 @@ -146,7 +223,7 @@ 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,adaptWith,is_implemented_by +#ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,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). @@ -164,32 +241,44 @@ enable-exceptions=yes -# checks for : -# * unauthorized constructions -# * strict indentation -# * line length -# * use of <> -# -[FORMAT] +# 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 +# +# This checker also defines the following reports: +# * R0701: Raw metrics +# +[METRICS] # Enable / disable this checker -enable-format=yes +enable-metrics=yes -# Maximum number of characters on a single line. -max-line-length=100 -# 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 similarities and duplicated code. This computation may be +# memory / CPU intensive, so you should disable it if you experiments some +# problems. +# +# This checker also defines the following reports: +# * R0801: Duplication +# +[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 # checks for: -# * source code with non ascii characters but no encoding declaration (PEP -# 263) -# * warning notes in the code like FIXME, XXX +# * warning notes in the code like FIXME, XXX +# * PEP 263: source code with non ascii character but no encoding declaration # [MISCELLANEOUS] # Enable / disable this checker @@ -201,16 +290,24 @@ notes=FIXME,XXX,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 +# checks for : +# * unauthorized constructions +# * strict indentation +# * line length +# * use of <> instead of != # -[METRICS] +[FORMAT] # Enable / disable this checker -enable-metrics=yes +enable-format=yes + +# Maximum number of characters on a single line. +max-line-length=100 + +# 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=' ' |