tox.ini: separate pylint target and run it with jenkins only (#58764)

This commit is contained in:
Benjamin Dauvergne 2021-11-19 14:08:03 +01:00
parent b54524187b
commit 2db82bc66d
4 changed files with 126 additions and 114 deletions

View File

@ -1,85 +0,0 @@
[MASTER]
profile=no
persistent=yes
ignore=migrations,south_migrations
cache-size=500
load-plugins=pylint_django
[MESSAGES CONTROL]
# C0111 Missing docstring
# I0011 Warning locally suppressed using disable-msg
# I0012 Warning locally suppressed using disable-msg
# W0704 Except doesn't do anything Used when an except clause does nothing but "pass" and there is no "else" clause
# W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments.
# W0212 Access to a protected member %s of a client class
# W0232 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
# W0613 Unused argument %r Used when a function or method argument is not used.
# W0702 No exception's type specified Used when an except clause doesn't specify exceptions type to catch.
# R0201 Method could be a function
disable=C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,C0330
[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,qs,pk,setUp,tearDown
[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,WSGIRequest
# 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,context
# List of method names used to declare (i.e. assign) instance attributes
defining-attr-methods=__init__,__new__,setUp
[VARIABLES]
init-import=no
dummy-variables-rgx=_|dummy
[SIMILARITIES]
min-similarity-lines=6
ignore-comments=yes
ignore-docstrings=yes
[MISCELLANEOUS]
notes=FIXME,XXX,TODO
[FORMAT]
max-line-length=160
max-module-lines=500
indent-string=' '
[DESIGN]
max-args=10
max-locals=15
max-returns=6
max-branchs=12
max-statements=50
max-parents=14
max-attributes=7
min-public-methods=0
max-public-methods=50

View File

@ -1,13 +1,4 @@
#!/bin/sh
#!/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
pylint -f parseable --rcfile tox.ini "$@" | tee pylint.out; test $PIPESTATUS -eq 0

9
test-requirements.txt Normal file
View File

@ -0,0 +1,9 @@
psycopg2-binary<2.9
pytest
pytest-cov
pytest-django
pytest-freezegun
httmock
django-webtest
django-mellon
uwsgidecorators

133
tox.ini
View File

@ -1,27 +1,30 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/barbacompta/{env:BRANCH_NAME:}
envlist = py3-pylint,code-style
envlist = py3,code-style
[tox:jenkins]
envlist =
code-style
py3
py3-pylint
[testenv]
setenv =
DJANGO_SETTINGS_MODULE=eo_gestion.settings
BARBACOMPTA_SETTINGS_FILE=tests/settings.py
deps =
psycopg2-binary<2.9
pytest
pytest-cov
pytest-django
pytest-freezegun
httmock
pylint
pylint-django
django-webtest
django-mellon
pdbpp
uwsgidecorators
-rtest-requirements.txt
commands =
py.test {posargs: --junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=eo_gestion/ tests/}
pylint: ./pylint.sh eo_gestion/
#
# pytest config
#
[pytest]
filterwarnings=
ignore:Using or importing the ABCs from
junit_family=xunit2
[testenv:manage]
setenv =
@ -36,7 +39,101 @@ deps =
commands =
pre-commit run --all-files --show-diff-on-failure
[pytest]
filterwarnings=
ignore:Using or importing the ABCs from
junit_family=xunit2
[testenv:pylint]
deps =
-rtest-requirements.txt
pylint
pylint-django
commands =
./pylint.sh eo_gestion/ tests/
#
# pylint config
#
[MASTER]
profile=no
persistent=yes
ignore=migrations,south_migrations
cache-size=500
load-plugins=pylint_django
[MESSAGES CONTROL]
# C0111 Missing docstring
# I0011 Warning locally suppressed using disable-msg
# I0012 Warning locally suppressed using disable-msg
# W0704 Except doesn't do anything Used when an except clause does nothing but "pass" and there is no "else" clause
# W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments.
# W0212 Access to a protected member %s of a client class
# W0232 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
# W0613 Unused argument %r Used when a function or method argument is not used.
# W0702 No exception's type specified Used when an except clause doesn't specify exceptions type to catch.
# R0201 Method could be a function
disable=C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,C0330
[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,qs,pk,setUp,tearDown
[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,WSGIRequest
# 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,context
# List of method names used to declare (i.e. assign) instance attributes
defining-attr-methods=__init__,__new__,setUp
[VARIABLES]
init-import=no
dummy-variables-rgx=_|dummy
[SIMILARITIES]
min-similarity-lines=6
ignore-comments=yes
ignore-docstrings=yes
[MISCELLANEOUS]
notes=FIXME,XXX,TODO
[FORMAT]
max-line-length=160
max-module-lines=500
indent-string=' '
[DESIGN]
max-args=10
max-locals=15
max-returns=6
max-branchs=12
max-statements=50
max-parents=14
max-attributes=7
min-public-methods=0
max-public-methods=50
>>>>>>> 489da9b (tox.ini: separate pylint target and run it with jenkins only (#58764))