]> kaliko git repositories - mpd-sima.git/commitdiff
Integrate pylint-gitlab and dependency scanning
authorkaliko <kaliko@azylum.org>
Fri, 18 Dec 2020 09:58:42 +0000 (10:58 +0100)
committerkaliko <kaliko@azylum.org>
Fri, 18 Dec 2020 11:41:05 +0000 (12:41 +0100)
.gitlab-ci.yml
.gitlab/gitlab-templates.yml [new file with mode: 0644]
.gitlab/pylint.yml [new file with mode: 0644]

index 484d151867bd9cd06251ba50fc37e946a5f33acd..9a39e1364c31a060204e4d5b3ec30eff895c7922 100644 (file)
@@ -2,6 +2,10 @@
 # https://hub.docker.com/_/python
 image: python:3
 
+include:
+  - local: .gitlab/gitlab-templates.yml
+  - local: .gitlab/pylint.yml
+
 variables:
   #XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
   PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
diff --git a/.gitlab/gitlab-templates.yml b/.gitlab/gitlab-templates.yml
new file mode 100644 (file)
index 0000000..7097e5f
--- /dev/null
@@ -0,0 +1,2 @@
+include:
+    - template: Dependency-Scanning.gitlab-ci.yml
diff --git a/.gitlab/pylint.yml b/.gitlab/pylint.yml
new file mode 100644 (file)
index 0000000..9cffbfb
--- /dev/null
@@ -0,0 +1,24 @@
+pylint:
+  stage: test
+  image: python:3.7-slim
+  before_script:
+    - mkdir -p public/badges public/lint
+    - echo undefined > public/badges/$CI_JOB_NAME.score
+    - pip install pylint_gitlab
+  script:
+    - pylint --exit-zero --output-format=text sima | tee /tmp/pylint.txt
+    - sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/$CI_JOB_NAME.score
+    - pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter sima > codeclimate.json
+    - pylint --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter sima > public/lint/index.html
+  after_script:
+    - anybadge --overwrite --label $CI_JOB_NAME --value=$(cat public/badges/$CI_JOB_NAME.score) --file=public/badges/$CI_JOB_NAME.svg 4=red 6=orange 8=yellow 10=green
+    - |
+      echo "Your score is: $(cat public/badges/$CI_JOB_NAME.score)"
+  artifacts:
+    expire_in: 30 days
+    paths:
+      - public
+    reports:
+      codequality: codeclimate.json
+    when: always
+