From 79e17532f6efb67113a3f50b8fc28353cbda7cf7 Mon Sep 17 00:00:00 2001 From: mozga Date: Sat, 30 Oct 2021 16:54:39 +0200 Subject: [PATCH] Prospector checker initial commit (#20684) --- ci/docker/install/requirements | 10 +- ci/docker/runtime_functions.sh | 31 ++- ci/other/pylintrc | 460 --------------------------------- prospector.yaml | 279 ++++++++++++++++++++ 4 files changed, 310 insertions(+), 470 deletions(-) delete mode 100644 ci/other/pylintrc create mode 100644 prospector.yaml diff --git a/ci/docker/install/requirements b/ci/docker/install/requirements index 1d93e4825827..21f10b92cba8 100644 --- a/ci/docker/install/requirements +++ b/ci/docker/install/requirements @@ -34,8 +34,8 @@ Cython==0.29.24 # Development dependencies cpplint==1.3.0 -pylint==2.3.1 # pylint and astroid need to be aligned -astroid==2.3.3 # pylint and astroid need to be aligned +pylint<3,>=2.8.3 # pylint and astroid need to be aligned +astroid<2.9,>=2.8.0 # pylint and astroid need to be aligned pytest==6.1.2 pytest-env==0.6.2 pytest-cov==2.10.1 @@ -54,3 +54,9 @@ h5py==2.10.0 # Array API Standardization requirements hypothesis==6.14.0 + +# Prospector - Python Static Analysis +prospector==1.5.1 + +# pyflakes - passive checker of Python programs +pyflakes<2.4.0,>=2.2.0 diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index 392d54b3fa50..0f7913557935 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -703,10 +703,17 @@ sanity_check() { set -ex sanity_clang sanity_license - sanity_python + sanity_tutorial + sanity_python_prospector sanity_cpp } +sanity_tutorial() { + set -ex + export DMLC_LOG_STACK_TRACE_DEPTH=100 + OMP_NUM_THREADS=$(expr $(nproc) / 4) pytest -n 4 tests/tutorials/test_sanity_tutorials.py +} + sanity_license() { set -ex tools/license_header.py check @@ -717,6 +724,21 @@ sanity_cpp() { 3rdparty/dmlc-core/scripts/lint.py mxnet cpp include src plugin cpp-package tests --exclude_path src/operator/contrib/ctc_include include/onednn } +sanity_python_prospector() { + set -e + set +x + + # Run Prospector + python3 -m prospector --profile prospector.yaml | tee prospector-output.txt + error_cnt=$(awk '/Messages Found:/{print $NF}' prospector-output.txt) + if [ $error_cnt -ne 0 ]; then + echo 'Please fix the above Prospector warnings.' + rm -rf prospector-output.txt + exit 1 + fi + rm -rf prospector-output.txt +} + sanity_clang() { set -e set +x @@ -755,13 +777,6 @@ sanity_clang() { exit 1 } -sanity_python() { - set -ex - export DMLC_LOG_STACK_TRACE_DEPTH=100 - python3 -m pylint --rcfile=ci/other/pylintrc --ignore-patterns=".*\.so$$,.*\.dll$$,.*\.dylib$$" python/mxnet - OMP_NUM_THREADS=$(expr $(nproc) / 4) pytest -n 4 tests/tutorials/test_sanity_tutorials.py -} - # Tests libmxnet # Parameters: # $1 -> mxnet_variant: The variant of the libmxnet.so library diff --git a/ci/other/pylintrc b/ci/other/pylintrc deleted file mode 100644 index a1034cd50f9c..000000000000 --- a/ci/other/pylintrc +++ /dev/null @@ -1,460 +0,0 @@ -[MASTER] - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Use multiple processes to speed up Pylint. -jobs=1 - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist=numpy,opencv - -# Allow optimization of some AST trees. This will activate a peephole AST -# optimizer, which will apply various small optimizations. For instance, it can -# be used to obtain the result of joining multiple strings with the addition -# operator. Joining a lot of strings can lead to a maximum recursion error in -# Pylint and this flag can prevent that. It has one side effect, the resulting -# AST will be different than the one from reality. This option is deprecated -# and it will be removed in Pylint 2.0. -optimize-ast=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# 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 (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=indexing-exception,old-raise-syntax,undefined-variable - -# 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" -disable= - no-self-use, - attribute-defined-outside-init, - bad-option-value, - global-statement, - fixme, - no-member, - no-name-in-module, - import-error, - unsubscriptable-object, - protected-access, - superfluous-parens, - invalid-name, - no-else-return, - useless-super-delegation, - len-as-condition, - invalid-unary-operand-type, - chained-comparison, - consider-using-dict-comprehension, - consider-using-set-comprehension, - try-except-raise, - useless-object-inheritance, - c-extension-no-member, - deprecated-lambda, - redefined-builtin, - too-few-public-methods, - too-many-arguments, - too-many-branches, - too-many-instance-attributes, - too-many-locals, - too-many-public-methods, - too-many-statements, - too-many-lines, - duplicate-code, - cyclic-import - -# disable=unicode-builtin,delslice-method,using-cmp-argument,setslice-method,dict-view-method,parameter-unpacking,range-builtin-not-iterating,print-statement,file-builtin,old-raise-syntax,basestring-builtin,execfile-builtin,indexing-exception,import-star-module-level,coerce-method,long-builtin,old-ne-operator,old-division,no-absolute-import,raw_input-builtin,old-octal-literal,oct-method,xrange-builtin,hex-method,unpacking-in-except,nonzero-method,raising-string,intern-builtin,reload-builtin,metaclass-assignment,cmp-method,filter-builtin-not-iterating,apply-builtin,map-builtin-not-iterating,next-method-called,unichr-builtin,buffer-builtin,dict-iter-method,input-builtin,coerce-builtin,getslice-method,useless-suppression,standarderror-builtin,zip-builtin-not-iterating,suppressed-message,cmp-builtin,backtick,long-suffix,reduce-builtin,round-builtin - - -[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. -output-format=text - -# 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]". This option is deprecated -# and it will be removed in Pylint 2.0. -files-output=no - -# Tells whether to display a full report or only the messages -reports=no - -# 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 -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# 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= - - -[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. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -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=' ' - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - - -[SPELLING] - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[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 module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[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 - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_,_cb - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,future.builtins - - -[BASIC] - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,_,a,b,op,x,y,wd,lr,kv,k,v,s,p,h,c,m,n,X,t,g,f - -# Bad variable names which should always be refused, separated by a comma -bad-names= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression matching correct constant names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ - -# Regular expression matching correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for method names -method-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression matching correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for argument names -argument-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for attribute names -attr-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for variable names -variable-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Naming hint for function names -function-name-hint=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression matching correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Naming hint for class names -class-name-hint=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=10 - - -[ELIF] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=optparse - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# 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= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# 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-branches=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 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/prospector.yaml b/prospector.yaml new file mode 100644 index 000000000000..a94836d8584e --- /dev/null +++ b/prospector.yaml @@ -0,0 +1,279 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +output-format: text + +strictness: medium +test-warnings: true +doc-warnings: false +max-line-length: 120 + +ignore-paths: + - .github + - 3rdparty + - benchmark + - cd + - ci + - cmake + - config + - contrib + - cpp-package + - docker + - docs + - example + - include + - licences + - plugin + - src + - tools + - build + # - python # enabled + # - tests # enabled + + +pylint: + disable: + - consider-using-enumerate + - consider-using-with + - unspecified-encoding + - consider-using-f-string + - simplifiable-if-expression + - undefined-variable + - deprecated-method + - unused-import + - wrong-import-position + - bare-except + - import-outside-toplevel + - protected-access + - no-value-for-parameter + - unused-private-member + - import-error + - unused-wildcard-import + - arguments-differ + - logging-format-interpolation + - unused-variable + - logging-too-many-args + - pointless-string-statement + - useless-suppression + - trailing-newlines + - use-maxsplit-arg + - redefined-builtin + - singleton-comparison + - misplaced-comparison-constant + - unsubscriptable-object + - too-many-locals + - too-many-statements + - invalid-sequence-index + - chained-comparison + - pointless-statement + - unbalanced-tuple-unpacking + - no-else-return + - super-with-arguments + - use-list-literal + - logging-not-lazy + - unreachable + - too-many-arguments + - multiple-imports + - bad-indentation + - invalid-envvar-default + - unused-argument + - line-too-long + - no-self-use + - attribute-defined-outside-init + - bad-option-value + - global-statement + - fixme + - no-member + - no-name-in-module + - superfluous-parens + - useless-super-delegation + - len-as-condition + - invalid-unary-operand-type + - consider-using-dict-comprehension + - consider-using-set-comprehension + - try-except-raise + - useless-object-inheritance + - c-extension-no-member + - deprecated-lambda + - too-few-public-methods + - too-many-branches + - too-many-instance-attributes + - too-many-public-methods + - too-many-lines + - duplicate-code + - cyclic-import + - cell-var-from-loop + - raise-missing-from + - unnecessary-comprehension + - unidiomatic-typecheck + - consider-using-in + - unsupported-assignment-operation + - unnecessary-pass + - reimported + - unexpected-keyword-arg + - arguments-renamed + - consider-using-dict-items + - consider-iterating-dictionary + - undefined-loop-variable + - no-else-continue + - too-many-nested-blocks + - comparison-with-itself + - unnecessary-lambda + - too-many-function-args + - use-dict-literal + - redefined-argument-from-local + - function-redefined + - bad-staticmethod-argument + - consider-using-generator + - abstract-method + - relative-beyond-top-level + - use-a-generator + - no-else-break + - using-constant-test + - use-symbolic-message-instead + - bad-inline-option + - invalid-name + - consider-using-min-builtin + - consider-using-max-builtin + - trailing-comma-tuple + - inconsistent-return-statements + - global-variable-not-assigned + - literal-comparison + - expression-not-assigned + - used-before-assignment + - disallowed-name + - not-callable + - implicit-str-concat + - self-assigning-variable + - dangerous-default-value + - eval-used + - consider-using-from-import + - redundant-u-string-prefix + enable: + - indexing-exception + - old-raise-syntax + - undefined-variable + + options: + # Good variable names which should always be accepted, separated by a comma + good-names: i,j,_,a,b,op,x,y,wd,lr,kv,k,v,s,p,h,c,m,n,X,t,g,f + # Bad variable names which should always be refused, separated by a comma + #bad-names: + # Colon-delimited sets of names that determine each other's naming style when + # the name regexes allow several styles. + #name-group: + # Include a hint for the correct naming format with invalid-name + include-naming-hint: no + # List of decorators that produce properties, such as abc.abstractproperty. Add + # to this list to register other decorators that produce valid properties. + property-classes: abc.abstractproperty + # Regular expression matching correct module names + module-rgx: (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + # Naming hint for module names + module-name-hint: (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + # Regular expression matching correct constant names + const-rgx: (([A-Z_][A-Z0-9_]*)|(__.*__))$ + # Naming hint for constant names + const-name-hint: (([A-Z_][A-Z0-9_]*)|(__.*__))$ + # Regular expression matching correct inline iteration names + inlinevar-rgx: "[A-Za-z_][A-Za-z0-9_]*$" + # Naming hint for inline iteration names + inlinevar-name-hint: "[A-Za-z_][A-Za-z0-9_]*$" + # Regular expression matching correct method names + method-rgx: "[a-z_][a-z0-9_]{2,30}$" + # Naming hint for method names + method-name-hint: "[a-z_][a-z0-9_]{2,30}$" + # Regular expression matching correct class attribute names + class-attribute-rgx: ([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + # Naming hint for class attribute names + class-attribute-name-hint: ([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ + # Regular expression matching correct argument names + argument-rgx: "[a-z_][a-z0-9_]{2,30}$" + # Naming hint for argument names + argument-name-hint: "[a-z_][a-z0-9_]{2,30}$" + # Regular expression matching correct attribute names + attr-rgx: "[a-z_][a-z0-9_]{2,30}$" + # Naming hint for attribute names + attr-name-hint: "[a-z_][a-z0-9_]{2,30}$" + # Regular expression matching correct variable names + variable-rgx: "[a-z_][a-z0-9_]{2,30}$" + # Naming hint for variable names + variable-name-hint: "[a-z_][a-z0-9_]{2,30}$" + # Regular expression matching correct function names + function-rgx: "[a-z_][a-z0-9_]{2,30}$" + # Naming hint for function names + function-name-hint: "[a-z_][a-z0-9_]{2,30}$" + # Regular expression matching correct class names + class-rgx: "[A-Za-z_][a-zA-Z0-9]+$" + # Naming hint for class names + class-name-hint: "[A-Z_][a-zA-Z0-9]+$" + # Regular expression which should only match function or class names that do + # not require a docstring. + no-docstring-rgx: ^_ + # Minimum line length for functions/classes that require docstrings, shorter + # ones are exempt. + docstring-min-length: 10 + +mccabe: + disable: + - MC0001 # A statement is too complex + +pep8: + disable: + # Descriptions and examples for each of the rules in Flake8 https://www.flake8rules.com/ + - E305 # Expected 2 blank lines after end of function or class + - E306 # Expected 1 blank line before a nested definition + - E501 # Line too long (139 > 120 characters) + - E117 # Over-indented + - E722 # Do not use bare except, specify exception instead + - E741 # Do not use variables named 'I', 'O', or 'l' + - E712 # Comparison to true should be 'if cond is true:' or 'if cond:' + - W605 # Invalid escape sequence 'x' + - E704 # Multiple statements on one line (def) + - F811 # Redefinition of unused name from line N + - F632 # Use ==/!= to compare str, bytes, and int literals + - F821 # Undefined name name + - F524 # .format(...) missing argument + - E116 # Unexpected indentation (comment) + - E114 # Indentation is not a multiple of four (comment) + - N807 # Function name should not start and end with ‘__’ + - E129 # Visually indented line with same indent as next logical line + - E131 # Continuation line unaligned for hanging indent + - E713 # Test for membership should be 'not in' + - E115 # Expected an indented block (comment) + - E714 # Test for object identity should be 'is not' + - E711 # Comparison to none should be 'if cond is none:' + - E101 # Indentation contains mixed spaces and tabs + - E721 # Do not compare types, use 'isinstance()' + +pyflakes: + disable: + # Descriptions and examples for each of the rules in Flake8 https://www.flake8rules.com/ + - F401 # Module imported but unused + - F405 # Name may be undefined, or defined from star imports: module + - F841 # Local variable name is assigned to but never used + - E713 # Test for membership should be 'not in' + - E114 # Indentation is not a multiple of four (comment) + - E116 # Unexpected indentation (comment) + - E711 # Comparison to none should be 'if cond is none:' + - E115 # Expected an indented block (comment) + - N807 # Function name should not start and end with ‘__’ + - E101 # Indentation contains mixed spaces and tabs + - F811 # Redefinition of unused name from line N + - F632 # Use ==/!= to compare str, bytes, and int literals + - F821 # undefined name name + - F524 # .format(...) missing argument