From e20b5bb3d83ad8630f85163df308270b1d0189cd Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 18 Dec 2020 10:58:42 +0100 Subject: [PATCH] Integrate pylint-gitlab and dependency scanning --- .gitlab-ci.yml | 4 ++++ .gitlab/gitlab-templates.yml | 2 ++ .gitlab/pylint.yml | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 .gitlab/gitlab-templates.yml create mode 100644 .gitlab/pylint.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 484d151..9a39e13 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 index 0000000..7097e5f --- /dev/null +++ b/.gitlab/gitlab-templates.yml @@ -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 index 0000000..9cffbfb --- /dev/null +++ b/.gitlab/pylint.yml @@ -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 + -- 2.39.5