From ec9473fcd624be70525a05a92a079451ce186d80 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Wed, 24 Nov 2021 15:52:09 +0100 Subject: [PATCH] Enforce pylint in CI via tox - ignore duplicate-code and fixme detection in pylint profile fixme comments are fine and dup warnings contain many false positives - enforce pylint with a minimal output and a score of 10 in CI - create a "pylint_full" tox profile to display complete output with duplicate-code and fixme detections - specify version requirement >=2.6.0 for a correct support of options, especially the option --fail-under= to specify minimum score allowed JIRA: TRNSPRTPCE-320 LF-JIRA: IT-23316 Signed-off-by: guillaume.lambert Change-Id: I41f218d7f33f1f620a3f3c4d442655bf1cfb4ded --- tox.ini | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 8e83d09f6..8131efd36 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ envlist = buildcontroller,testsPCE, checkbashisms pre-commit gitlint + pylint skipsdist = true setupdir = tests/ @@ -225,12 +226,19 @@ deps = autopep8 commands = autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/ +[testenv:pylint_full] +basepython = python3 +deps = pylint>=2.6.0 +whitelist_externals = find +commands = + find transportpce_tests/ -name *.py -exec pylint --fail-under=9.22 --max-line-length=120 --disable=missing-docstring --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" --reports=y --score=y --output-format=colorized \{\} + + [testenv:pylint] basepython = python3 -deps = pylint +deps = pylint>=2.6.0 whitelist_externals = find commands = - find transportpce_tests/ -name *.py -exec pylint --max-line-length=120 --disable=missing-docstring --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" --reports=y --score=y --output-format=colorized \{\} + + find transportpce_tests/ -name *.py -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring --disable=fixme --disable=duplicate-code --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" \{\} + [testenv:pyang] basepython = python3 -- 2.36.6