From 4db36d45173766aaec2d8bc6ab60c26b924b8d03 Mon Sep 17 00:00:00 2001 From: Jeremy Chou Date: Sat, 9 Apr 2022 15:18:44 +0800 Subject: [PATCH] [test] Dev tox pylint (#247) * add pylintrc * add pylint for tox * update pylint rules --- pylintrc | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tox.ini | 10 ++++- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 pylintrc diff --git a/pylintrc b/pylintrc new file mode 100644 index 00000000..0ba26d6c --- /dev/null +++ b/pylintrc @@ -0,0 +1,125 @@ +[MASTER] +persistent=no +jobs=1 # >1 hides results +suggestion-mode=yes # guess common misconfiguration and emit user-friendly hints +py-version = 3.7.0 + +[MESSAGES CONTROL] +disable=abstract-method, + anomalous-backslash-in-string, + arguments-differ, + arguments-renamed, + attribute-defined-outside-init, + bad-classmethod-argument, + bad-continuation, + bad-indentation, + bad-mcs-classmethod-argument, + bad-super-call, + bad-whitespace, + bare-except, + blacklisted-name, + broad-except, + c-extension-no-member, + catching-non-exception, + cell-var-from-loop, + comparison-with-callable, + consider-iterating-dictionary, + consider-using-dict-items, + consider-using-from-import, + consider-using-in, + consider-using-set-comprehension, + consider-using-sys-exit, + consider-using-with, + cyclic-import, + dangerous-default-value, + deprecated-method, + deprecated-module, + duplicate-code, # https://github.com/PyCQA/pylint/issues/214 + eval-used, + expression-not-assigned, + fixme, + function-redefined, + global-statement, + import-error, + import-outside-toplevel, + import-self, + inconsistent-return-statements, + inherit-non-class, + invalid-name, + invalid-overridden-method, + isinstance-second-argument-not-valid-type, + keyword-arg-before-vararg, + line-too-long, + logging-format-interpolation, + logging-not-lazy, + lost-exception, + method-hidden, + misplaced-comparison-constant, + missing-docstring, + missing-final-newline, + multiple-imports, + multiple-statements, + no-else-continue, + no-else-raise, + no-else-return, + no-init, + no-member, + no-method-argument, + no-name-in-module, + no-self-argument, + no-self-use, + no-value-for-parameter, + not-an-iterable, + not-callable, + pointless-statement, + pointless-string-statement, + protected-access, + raise-missing-from, + redefined-argument-from-local, + redefined-builtin, + redefined-outer-name, + reimported, + signature-differs, + singleton-comparison, + super-init-not-called, + super-with-arguments, + superfluous-parens, + too-few-public-methods, + too-many-ancestors, + too-many-arguments, + too-many-branches, + too-many-format-args, + too-many-function-args, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-public-methods, + too-many-return-statements, + trailing-newlines, + trailing-whitespace, + unbalanced-tuple-unpacking, + undefined-variable, + undefined-loop-variable, + unexpected-special-method-signature, + ungrouped-imports, + unidiomatic-typecheck, + unnecessary-comprehension, + unnecessary-lambda, + unnecessary-pass, + unreachable, + unspecified-encoding, + unsupported-assignment-operation, + unsubscriptable-object, + unused-argument, + unused-import, + unused-private-member, + unused-variable, + unused-wildcard-import, + use-implicit-booleaness-not-comparison, + used-before-assignment, + useless-object-inheritance, # Required for Python 2 support + useless-return, + useless-super-delegation, + wildcard-import, + wrong-import-order, + wrong-import-position \ No newline at end of file diff --git a/tox.ini b/tox.ini index 70936194..97b03c94 100644 --- a/tox.ini +++ b/tox.ini @@ -30,6 +30,7 @@ commands = python -m pytest --ignore=setup.py # --cov-report term --cov=scrapy_redis [testenv:flake8] +basepython=python3.8 deps = {[base]deps} flake8 # https://github.com/tholo/pytest-flake8/issues/81 @@ -37,12 +38,19 @@ commands = flake8 docs tests [testenv:security] +basepython=python3.8 deps = bandit==1.7.3 commands = bandit -r -c .bandit.yml src/ tests/ -# TODO: add pylint +[testenv:pylint] +basepython=python3.8 +deps = + {[base]deps} + pylint==2.12.2 +commands = + pylint setup.py docs/ src/ tests/ # TODO: build windows/linux/mac