From da64a4588f0fb8408febac42efe283af7c94d445 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Thu, 16 Sep 2021 16:45:27 +0200 Subject: [PATCH 01/59] misc: update pylint configuration (#56982) --- pylint.rc | 66 +++++++++++++++++++++++++++++++++++++++++++++++++------ pylint.sh | 5 +++++ tox.ini | 16 +++----------- 3 files changed, 67 insertions(+), 20 deletions(-) create mode 100755 pylint.sh diff --git a/pylint.rc b/pylint.rc index 864d4dac..a317ffdd 100644 --- a/pylint.rc +++ b/pylint.rc @@ -1,12 +1,64 @@ [MASTER] profile=no persistent=yes -ignore=migrations +ignore=vendor,Bouncers,ezt.py cache-size=500 -load-plugins=pylint_django [MESSAGES CONTROL] -disable=abstract-method,arguments-differ,assignment-from-no-return,assignment-from-none,attribute-defined-outside-init,broad-except,consider-using-dict-comprehension,consider-using-set-comprehension,consider-using-ternary,cyclic-import,deprecated-module,duplicate-code,duplicate-except,eval-used,exec-used,fixme,global-variable-undefined,import-outside-toplevel,inconsistent-return-statements,invalid-name,keyword-arg-before-vararg,len-as-condition,missing-class-docstring,missing-function-docstring,missing-module-docstring,no-else-return,no-member,no-self-use,non-parent-init-called,not-a-mapping,not-callable,possibly-unused-variable,protected-access,raise-missing-from,redefined-argument-from-local,redefined-builtin,redefined-outer-name,signature-differs,stop-iteration-return,subprocess-run-check,super-init-not-called,superfluous-parens,too-many-ancestors,too-many-arguments,too-many-boolean-expressions,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-nested-blocks,too-many-public-methods,too-many-return-statements,too-many-statements,undefined-loop-variable,unnecessary-comprehension,unnecessary-lambda,unsubscriptable-object,unsupported-membership-test,unused-argument +disable= + abstract-method, + arguments-differ, + assignment-from-none, + attribute-defined-outside-init, + bad-super-call, + broad-except, + consider-using-dict-comprehension, + consider-using-set-comprehension, + cyclic-import, + duplicate-code, + exec-used, + fixme, + global-variable-undefined, + import-outside-toplevel, + inconsistent-return-statements, + invalid-name, + keyword-arg-before-vararg, + missing-class-docstring, + missing-function-docstring, + missing-module-docstring, + no-else-return, + no-member, + no-self-use, + non-parent-init-called, + not-callable, + possibly-unused-variable, + protected-access, + raise-missing-from, + redefined-argument-from-local, + redefined-builtin, + redefined-outer-name, + signature-differs, + stop-iteration-return, + super-init-not-called, + superfluous-parens, + too-many-ancestors, + too-many-arguments, + too-many-branches, + too-many-instance-attributes, + too-many-lines, + too-many-locals, + too-many-nested-blocks, + too-many-return-statements, + too-many-statements, + undefined-loop-variable, + unnecessary-comprehension, + unspecified-encoding, + unsubscriptable-object, + unsupported-membership-test, + unused-argument, + use-a-generator, + c-extension-no-member, + consider-using-f-string [REPORTS] @@ -30,7 +82,7 @@ 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= +ignored-classes=SQLObject,WSGIRequest,Publisher,NullSessionManager # When zope mode is activated, add a predefined set of Zope acquired attributes # to generated-members. @@ -38,16 +90,16 @@ zope=no # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E0201 when accessed. -generated-members=objects,DoesNotExist,id,pk,_meta,base_fields +generated-members=objects,DoesNotExist,id,pk,_meta,base_fields,context # List of method names used to declare (i.e. assign) instance attributes -defining-attr-methods=__init__,__new__ +defining-attr-methods=__init__,__new__,setUp [VARIABLES] init-import=no dummy-variables-rgx=_|dummy -good-names=_,i,j,k,fd +good-names=_,i,j,k,e,x,Run,,setUp,tearDown,r,p,s,v,fd [SIMILARITIES] min-similarity-lines=6 diff --git a/pylint.sh b/pylint.sh new file mode 100755 index 00000000..ba7a6c3a --- /dev/null +++ b/pylint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e -x +env + +pylint -f parseable --rcfile pylint.rc "$@" | tee pylint.out; test $PIPESTATUS -eq 0 diff --git a/tox.ini b/tox.ini index 38d2bff1..c3be5c47 100644 --- a/tox.ini +++ b/tox.ini @@ -66,6 +66,8 @@ deps = pytz pytest-freezegun faker + pylint + pylint-django enum34<=1.1.6 ldaptools>=0.15 oldldap: python-ldap<3 @@ -78,6 +80,7 @@ usedevelop = True commands = ./getlasso3.sh rbac,authentic: py.test {env:PYTESTOPTIONS:} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {env:SW:} {posargs:{env:TESTS} --random-group} + pylint: ./pylint.sh tests/ src/ [testenv:check-migrations] basepython = python3 @@ -91,19 +94,6 @@ commands = ./getlasso3.sh ./check-migrations.sh -[testenv:pylint] -basepython = python3 -setenv = - DJANGO_SETTINGS_MODULE=authentic2.settings - SETUPTOOLS_USE_DISTUTILS=stdlib -deps = - pylint - pylint-django - psycopg2-binary -commands = - ./getlasso3.sh - bash -c 'pylint -f parseable --rcfile pylint.rc src/authentic2_idp_cas src/authentic2_auth_oidc src/authentic2_idp_oidc src/authentic2_auth_saml src/authentic2 src/django_rbac src/authentic2_auth_fc | tee pylint.out' - [testenv:manage] usedevelop = True setenv = -- 2.30.2