diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 00000000..bb651e21 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,11 @@ +--- +version: "2" +plugins: + pylint: + enabled: true + + shellcheck: + enabled: true + + bandit: + enabled: true diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 866a2ec8..e2c1049e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,6 @@ --- +include: + - template: Code-Quality.gitlab-ci.yml variables: pip: pip3 --timeout 100 --retries 10 @@ -222,36 +224,28 @@ lint_format_safety_bandit_checks: make pycodestyle pyflakes3 - pylint python3-dev python3-git python3-nose python3-pip python3-yaml - shellcheck - - $pip install --break-system-packages bandit safety + - $pip install --break-system-packages safety - export EXITVALUE=0 - function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; } - ./hooks/pre-commit || set_error - - bandit - -r - -ii - --ini .bandit - || set_error - safety check --full-report || set_error - - pylint --output-format=colorized --reports=n - fdroid - makebuildserver - setup.py - fdroidserver/*.py - tests/*.py - tests/*.TestCase - || set_error - - shellcheck --exclude SC2046,SC2090 --severity=warning --color tests/run-tests - || set_error - exit $EXITVALUE +code_quality: + rules: + - if: $CODE_QUALITY_DISABLED + when: never + - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Run code quality job in merge request pipelines + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run code quality job in pipelines on the default branch (but not in other branch pipelines) + - if: $CI_COMMIT_TAG # Run code quality job in pipelines for tags + + # Run all the various linters and static analysis tools. locales: image: debian:bookworm-slim