track metrics from pylint job in CI
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 10 Mar 2021 04:41:47 +0000 (20:41 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 17 Mar 2021 00:13:59 +0000 (17:13 -0700)
This replicates the metric tracking from some other CI jobs for the pylint task.
This should make the number of pylint warnings appear in the metrics section of
MRs, allowing us to track whether MRs increase or reduce the number of pylint
warnings.

.gitlab-ci.yml

index 8716ebab08099580bda2114ba8b3ed06bce2c097..0761cc0cd4c97eb2b62a18067505ba1ced664a69 100644 (file)
@@ -813,4 +813,13 @@ lint_pylint:
   needs:
     - docker_build_ubuntu-20.10
   script:
-    - python3 -m pylint --rcfile=.pylintrc `find . -name '*.py' | xargs` --exit-zero
+    - logfile=`mktemp`
+    - python3 -m pylint --rcfile=.pylintrc `find . -name '*.py' | xargs` --exit-zero |& tee $logfile
+    - echo "$CI_JOB_NAME-warnings `egrep -c '\<[CEW][[:digit:]]{4}\>' $logfile`" > metrics.txt
+    - rm $logfile
+    - cat metrics.txt
+  artifacts:
+    when: on_success
+    expire_in: 1 week
+    reports:
+        metrics: metrics.txt