diff --git a/pavelib/quality.py b/pavelib/quality.py index 924ed00e5d..a5c7eb4634 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -42,8 +42,10 @@ def find_fixme(options): sh( "{pythonpath_prefix} pylint --disable R,C,W,E --enable=fixme " - "-f parseable {apps} | tee {report_dir}/pylint_fixme.report".format( + "--msg-template={msg_template} {apps} " + "| tee {report_dir}/pylint_fixme.report".format( pythonpath_prefix=pythonpath_prefix, + msg_template='"{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"', apps=apps_list, report_dir=report_dir ) @@ -97,10 +99,11 @@ def run_pylint(options): ) sh( - "{pythonpath_prefix} pylint {flags} -f parseable {apps} | " + "{pythonpath_prefix} pylint {flags} --msg-template={msg_template} {apps} | " "tee {report_dir}/pylint.report".format( pythonpath_prefix=pythonpath_prefix, flags=" ".join(flags), + msg_template='"{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"', apps=apps_list, report_dir=report_dir ) diff --git a/pylintrc b/pylintrc index f92ec1806a..72463fa125 100644 --- a/pylintrc +++ b/pylintrc @@ -26,53 +26,46 @@ load-plugins= # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option -# multiple time. +# multiple time. See also the "--disable" option for examples. #enable= # Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" disable= -# Never going to use these -# I0011: Locally disabling W0232 -# C0301: Line too long -# W0141: Used builtin function 'map' -# W0142: Used * or ** magic -# R0921: Abstract class not referenced -# R0922: Abstract class is only referenced 1 times - I0011,C0301,W0141,W0142,R0921,R0922, - -# Django makes classes that trigger these -# W0232: Class has no __init__ method - W0232, - -# Disable 'fixme' so that quality builds don't fail due to them - W0511, - -# Might use these when the code is in better shape -# C0302: Too many lines in module -# R0201: Method could be a function -# R0901: Too many ancestors -# R0902: Too many instance attributes -# R0903: Too few public methods (1/2) -# R0904: Too many public methods -# R0911: Too many return statements -# R0912: Too many branches -# R0913: Too many arguments -# R0914: Too many local variables - C0302,R0201,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914 + locally-disabled, + too-few-public-methods, + bad-builtin, + star-args, + abstract-class-not-used, + abstract-class-little-used, + no-init, + fixme, + too-many-lines, + no-self-use, + too-many-ancestors, + too-many-instance-attributes, + too-few-public-methods, + too-many-public-methods, + too-many-return-statements, + too-many-branches, + too-many-arguments, + too-many-locals [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. output-format=text -# Include message's id in output -include-ids=yes - # 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]". @@ -92,8 +85,111 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme # evaluation report (RP0004). comment=no -# Display symbolic names of messages in reports -symbols=yes + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + + +[BASIC] + +# Required attributes for module, separated by a comma +required-attributes= + +# List of builtins function names that should not be used, separated by a comma +bad-functions=map,filter,apply,input + +# 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 module level names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ + +# 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 +# Normally limited to 30 chars, but test names can be as long as they want +function-rgx=([a-z_][a-z0-9_]{2,30}|test_[a-z0-9_]+)$ + +# Regular expression which should only match correct method names +# Normally, should be all lower, but some exceptions for unittest methods +method-rgx=([a-z_][a-z0-9_]{2,40}|setUp|set[Uu]pClass|tearDown|tear[Dd]ownClass|assert[A-Z]\w*|maxDiff|test_[a-z0-9_]+)$ + +# Regular expression which should only match correct instance attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct attribute names in class +# bodies +class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + +# Regular expression which should only match correct list comprehension / +# generator expression variable names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Good variable names which should always be accepted, separated by a comma +good-names=f,i,j,k,db,ex,Run,_,__ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=__.*__|test_.+|setUp|tearDown + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=120 + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + +# List of optional constructs for which whitespace checking is disabled +no-space-check=trailing-comma,dict-separator + +# 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=' ' + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no [TYPECHECK] @@ -140,83 +236,6 @@ generated-members= # For django models _meta, -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# 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 module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ - -# 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_]{2,30}|test_[a-z0-9_]+)$ - -# Regular expression which should only match correct method names -method-rgx=([a-z_][a-z0-9_]{2,60}|setUp|set[Uu]pClass|tearDown|tear[Dd]ownClass|assert[A-Z]\w*|maxDiff|test_[a-z0-9_]+)$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=f,i,j,k,db,ex,Run,_,__ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__|test_.*|setUp|tearDown - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=120 - -# 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=' ' - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - [VARIABLES] @@ -232,22 +251,20 @@ dummy-variables-rgx=_|dummy|unused|.*_unused additional-builtins= -[IMPORTS] +[CLASSES] -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec,track.views +# 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 -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs [DESIGN] @@ -266,7 +283,7 @@ max-locals=15 max-returns=6 # Maximum number of branch for function / method body -max-branchs=12 +max-branches=12 # Maximum number of statements in function / method body max-statements=50 @@ -284,17 +301,22 @@ min-public-methods=2 max-public-methods=20 -[CLASSES] +[IMPORTS] -# 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 +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,TERMIOS,Bastion,rexec -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= [EXCEPTIONS] diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 9a42af8aed..357d421c13 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -129,7 +129,7 @@ nose-exclude nose-ignore-docstring nosexcover==1.0.7 pep8==1.5.7 -pylint==0.28 +pylint==1.4.0 python-subunit==0.0.16 rednose==0.3 selenium==2.42.1 diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index cb4f502eb0..97376de102 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -56,7 +56,7 @@ set -e ############################################################################### # Violations thresholds for failing the build -PYLINT_THRESHOLD=4600 +PYLINT_THRESHOLD=5800 PEP8_THRESHOLD=0 source $HOME/jenkins_env