diff --git a/pavelib/quality.py b/pavelib/quality.py index a5c7eb4634d7..924ed00e5da7 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -42,10 +42,8 @@ def find_fixme(options): sh( "{pythonpath_prefix} pylint --disable R,C,W,E --enable=fixme " - "--msg-template={msg_template} {apps} " - "| tee {report_dir}/pylint_fixme.report".format( + "-f parseable {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 ) @@ -99,11 +97,10 @@ def run_pylint(options): ) sh( - "{pythonpath_prefix} pylint {flags} --msg-template={msg_template} {apps} | " + "{pythonpath_prefix} pylint {flags} -f parseable {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 72463fa12553..f92ec1806ac2 100644 --- a/pylintrc +++ b/pylintrc @@ -26,46 +26,53 @@ 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. See also the "--disable" option for examples. +# multiple time. #enable= # Disable the message, report, category or checker with the given id(s). You -# 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" +# 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). disable= - 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 +# 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 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. +# (visual studio) and html 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]". @@ -85,11 +92,53 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme # evaluation report (RP0004). comment=no +# Display symbolic names of messages in reports +symbols=yes + + +[TYPECHECK] + +# Tells whether 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 dynamically set). +ignored-classes=SQLObject -# 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= +# 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. Python regular +# expressions are accepted. +generated-members= + REQUEST, + acl_users, + aq_parent, + objects, + DoesNotExist, + can_read, + can_write, + get_url, + size, + content, + status_code, +# For factory_boy factories + create, + build, +# For xblocks + fields, +# For locations + tag, + org, + course, + category, + name, + revision, +# For django models + _meta, [BASIC] @@ -109,12 +158,10 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns)$ 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_]+)$ +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}$ @@ -125,10 +172,6 @@ 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_]*$ @@ -139,13 +182,15 @@ 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 +# Regular expression which should only match functions or classes name which 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 + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO [FORMAT] @@ -153,16 +198,6 @@ docstring-min-length=-1 # 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 @@ -171,12 +206,6 @@ max-module-lines=1000 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. @@ -188,54 +217,6 @@ ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes -# Ignore imports when computing similarities. -ignore-imports=no - - -[TYPECHECK] - -# Tells whether 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 dynamically 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. Python regular -# expressions are accepted. -generated-members= - REQUEST, - acl_users, - aq_parent, - objects, - DoesNotExist, - can_read, - can_write, - get_url, - size, - content, - status_code, -# For factory_boy factories - create, - build, -# For xblocks - fields, -# For locations - tag, - org, - course, - category, - name, - revision, -# For django models - _meta, - [VARIABLES] @@ -251,20 +232,22 @@ dummy-variables-rgx=_|dummy|unused|.*_unused additional-builtins= -[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,string,TERMIOS,Bastion,rexec,track.views -# 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= -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= [DESIGN] @@ -283,7 +266,7 @@ max-locals=15 max-returns=6 # Maximum number of branch for function / method body -max-branches=12 +max-branchs=12 # Maximum number of statements in function / method body max-statements=50 @@ -301,22 +284,17 @@ min-public-methods=2 max-public-methods=20 -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,TERMIOS,Bastion,rexec +[CLASSES] -# 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 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 external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp -# 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 class method. +valid-classmethod-first-arg=cls [EXCEPTIONS] diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 45d754167e31..08462b9b9648 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -130,7 +130,7 @@ nose-exclude nose-ignore-docstring nosexcover==1.0.7 pep8==1.5.7 -pylint==1.4.0 +pylint==0.28 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 97376de102a9..cb4f502eb06f 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=5800 +PYLINT_THRESHOLD=4600 PEP8_THRESHOLD=0 source $HOME/jenkins_env