import pylint config from w.c.s. and simplify launch (#51639)

This commit is contained in:
Benjamin Dauvergne 2021-03-31 23:31:27 +02:00
parent 13cd493740
commit d658eba701
3 changed files with 147 additions and 18 deletions

138
pylint.rc Normal file
View File

@ -0,0 +1,138 @@
[MASTER]
profile=no
persistent=yes
ignore=migrations
cache-size=500
load-plugins=pylint_django
[MESSAGES CONTROL]
# C0103 invalid-name
# C0114 missing-module-docstring
# C0115 missing-class-docstring
# C0116 missing-function-docstring
# C0302 too-many-lines
# C0325 superfluous-parens
# C0415 import-outside-toplevel
# C1801 len-as-condition
# E1101 no-member
# E1102 not-callable
# E1111 assignment-from-no-return
# E1121 too-many-function-args
# E1128 assignment-from-none
# E1134 not-a-mapping
# E1135 unsupported-membership-test
# E1136 unsubscriptable-object
# E1305 too-many-format-args
# R0201 no-self-use
# R0401 cyclic-import
# R0801 duplicate-code
# R0901 too-many-ancestors
# R0902 too-many-instance-attributes
# R0904 too-many-public-methods
# R0911 too-many-return-statements
# R0912 too-many-branches
# R0913 too-many-arguments
# R0914 too-many-locals
# R0915 too-many-statements
# R0916 too-many-boolean-expressions
# R1702 too-many-nested-blocks
# R1704 redefined-argument-from-local
# R1705 no-else-return
# R1706 consider-using-ternary
# R1708 stop-iteration-return
# R1710 inconsistent-return-statements
# R1717 consider-using-dict-comprehension
# R1718 consider-using-set-comprehension
# R1721 unnecessary-comprehension
# W0108 unnecessary-lambda
# W0122 exec-used
# W0123 eval-used
# W0201 attribute-defined-outside-init
# W0212 protected-access
# W0221 arguments-differ
# W0222 signature-differs
# W0223 abstract-method
# W0231 super-init-not-called
# W0233 non-parent-init-called
# W0402 deprecated-module
# W0403 relative-import
# W0511 fixme
# W0601 global-variable-undefined
# W0613 unused-argument
# W0621 redefined-outer-name
# W0622 redefined-builtin
# W0631 undefined-loop-variable
# W0641 possibly-unused-variable
# W0703 broad-except
# W0705 duplicate-except
# W0707 raise-missing-from
# W1113 keyword-arg-before-vararg
# W1510 subprocess-run-check
disable=C0103,C0114,C0115,C0116,C0302,C0325,C0415,C1801,E1101,E1102,E1111,E1121,E1128,E1134,E1135,E1136,E1305,R0201,R0401,R0801,R0901,R0902,R0904,R0911,R0912,R0913,R0914,R0915,R0916,R1702,R1704,R1705,R1706,R1708,R1710,R1717,R1718,R1721,W0108,W0122,W0123,W0201,W0212,W0221,W0222,W0223,W0231,W0233,W0402,W0403,W0511,W0601,W0613,W0621,W0622,W0631,W0641,W0703,W0705,W0707,W1113,W1510,bad-whitespace,bad-continuation
[REPORTS]
output-format=parseable
include-ids=yes
[BASIC]
no-docstring-rgx=__.*__|_.*
class-rgx=[A-Z_][a-zA-Z0-9_]+$
function-rgx=[a-zA_][a-zA-Z0-9_]{2,70}$
method-rgx=[a-z_][a-zA-Z0-9_]{2,70}$
const-rgx=(([A-Z_][A-Z0-9_]*)|([a-z_][a-z0-9_]*)|(__.*__)|register|urlpatterns)$
good-names=_,i,j,k,e,x,Run,,setUp,tearDown,r,p,s,v,fd
[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=
# 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.
generated-members=objects,DoesNotExist,id,pk,_meta,base_fields
# List of method names used to declare (i.e. assign) instance attributes
defining-attr-methods=__init__,__new__
[VARIABLES]
init-import=no
dummy-variables-rgx=_|dummy
good-names=_,i,j,k,fd
[SIMILARITIES]
min-similarity-lines=6
ignore-comments=yes
ignore-docstrings=yes
[MISCELLANEOUS]
notes=FIXME,XXX,TODO
[FORMAT]
max-line-length=160
max-module-lines=2000
indent-string=' '
[DESIGN]
max-args=10
max-locals=15
max-returns=6
max-branchs=12
max-statements=50
max-parents=7
max-attributes=7
min-public-methods=0
max-public-methods=50

View File

@ -1,13 +0,0 @@
#!/bin/bash
set -e
if [ -f /var/lib/jenkins/pylint.django.rc ]; then
PYLINT_RC=/var/lib/jenkins/pylint.django.rc
elif [ -f pylint.django.rc ]; then
PYLINT_RC=pylint.django.rc
else
echo No pylint RC found
exit 0
fi
pylint -f parseable --rcfile ${PYLINT_RC} "$@" > pylint.out || /bin/true

14
tox.ini
View File

@ -86,12 +86,17 @@ commands =
rbac,authentic: py.test {env:PYTESTOPTIONS:} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {env:SW:} {posargs:{env:TESTS} --random-group}
[testenv:pylint]
basepython = python2.7
basepython = python3
setenv =
DJANGO_SETTINGS_MODULE=authentic2.settings
SETUPTOOLS_USE_DISTUTILS=stdlib
deps =
pylint<1.8
pylint-django<0.8.1
pylint
pylint-django
psycopg2-binary
commands =
/bin/bash -c "./pylint.sh src/*/"
./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
@ -129,6 +134,5 @@ source =
authentic2_auth_saml
authentic2_idp_cas
authentic2_idp_oidc
authentic2_provisionning_ldap
django_rbac
branch = True