diff --git a/README.md b/README.md index 065c057767e01d95c1f6ce744741517798ba3c04..115703a7f866c2c7b029e9f2662074c7617b9d80 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ It is bound to the `build` stage, and uses the following variables: This job produces the following artifacts, kept for one day: * Code quality json report in code climate format. +* Pylint report for SonarQube (if `SONAR_URL` is defined). ### Test jobs diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml index a63957e62521bbdee4e14e9c3458f7f8d92274e1..bc75751be16f13622dca123a27e12a263b5d9c31 100644 --- a/templates/gitlab-ci-python.yml +++ b/templates/gitlab-ci-python.yml @@ -599,6 +599,12 @@ py-lint: # success: generate empty codeclimate report (required by GitLab :( ) echo "[]" > reports/pylint-codeclimate.json fi + - | + if [ -n "$SONAR_URL" ] + then + # SonarQube is configured, export analysis report + _run pylint --ignore=.cache --output-format=parseable ${PYLINT_ARGS} ${PYLINT_FILES:-$(find -type f -name "*.py")} > reports/pylint.txt + fi artifacts: name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" expire_in: 1 day