1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-13 02:30:11 +01:00

ci: use codeclimate for linting tests

Codeclimate is [integrated](https://docs.gitlab.com/ee/ci/testing/code_quality.html#customizing-scan-settings) into GitLab. Thus the UI is more intuitive from the web gui.
This commit is contained in:
proletarius101 2024-02-12 15:36:51 +08:00
parent 35c373a473
commit 6cf678a4fc
2 changed files with 23 additions and 18 deletions

11
.codeclimate.yml Normal file
View File

@ -0,0 +1,11 @@
---
version: "2"
plugins:
pylint:
enabled: true
shellcheck:
enabled: true
bandit:
enabled: true

View File

@ -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