Enforce pylint in CI via tox 69/98669/22
authorguillaume.lambert <guillaume.lambert@orange.com>
Wed, 24 Nov 2021 14:52:09 +0000 (15:52 +0100)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 16 Dec 2021 15:29:33 +0000 (15:29 +0000)
- 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 <guillaume.lambert@orange.com>
Change-Id: I41f218d7f33f1f620a3f3c4d442655bf1cfb4ded

tox.ini

diff --git a/tox.ini b/tox.ini
index 8e83d09f6a999b9816e56283565037d82c3da4fe..8131efd36ef5432788957a77c27a112fa60f1fac 100644 (file)
--- 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