1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-21 04:10:37 +02:00

Compare commits

...

26 Commits

Author SHA1 Message Date
proletarius101
1c3eb6ec46 Merge branch 'use-codeclimate-for-linting-tests' into 'master'
ci: use GitLab Code Quality for linting tests

See merge request fdroid/fdroidserver!1443
2024-06-07 11:02:25 +00:00
Hans-Christoph Steiner
24b3b0957f Merge branch 'safety-false-positive' into 'master'
safety: ignore false positive

See merge request fdroid/fdroidserver!1492
2024-06-07 10:15:32 +00:00
Hans-Christoph Steiner
6e489b78b3
safety: ignore false positive
jinja2 is not used by fdroidserver, nor any dependencies I could find via
debtree and pipdeptree.
2024-06-07 12:04:12 +02:00
Hans-Christoph Steiner
e7ff344f2b Merge branch 'gradle' into 'master'
gradle 8.8

See merge request fdroid/fdroidserver!1489
2024-06-05 15:00:19 +00:00
linsui
41e90e5ee7 gradle 8.8 2024-06-01 16:24:26 +08:00
proletarius101
ff823c228c ci: remove code_quality_html 2024-02-15 13:25:18 +00:00
proletarius101
1339578fd1 ci: disable code quality debug status 2024-02-15 13:25:18 +00:00
proletarius101
54fb779be9 fix shellcheck findings left in run-tests 2024-02-15 13:25:18 +00:00
proletarius101
488b707fcb fix shellcheck findings left in run-tests 2024-02-15 13:25:18 +00:00
proletarius101
d152c59726 ci: exclude B322 as it doesn't apply to python3 2024-02-15 13:25:18 +00:00
proletarius101
ca354335a4 ci: disable shellcheck checks absent in the version provided by debian 2024-02-15 13:25:18 +00:00
proletarius101
850a7f2ecd ci: disable shellcheck checks absent in the version provided by debian 2024-02-15 13:25:18 +00:00
proletarius101
0775fa6858 ci: disable shellcheck checks absent in the version provided by debian 2024-02-15 13:25:18 +00:00
proletarius101
bd7b2880d3 ci: only raise major issues in shellcheck
To align with the "warning" severity level in the previous setting.
2024-02-15 13:25:18 +00:00
proletarius101
a6836ddaa4 ci: move .bandit to .bandit.yaml
As the codeclimate engine only supports .bandit.yaml: https://github.com/noqcks/codeclimate-bandit/?tab=readme-ov-file#todo
2024-02-15 13:25:18 +00:00
proletarius101
6ec2a9e7bd ci: enable code climate debug mode 2024-02-15 13:25:18 +00:00
proletarius101
14eca1cd7e ci: use a larger machine type for the code quality jobs 2024-02-15 13:25:18 +00:00
proletarius101
ceb0fa7be9 ci: disable shellcheck checks that we currently don't use 2024-02-15 13:25:18 +00:00
proletarius101
882a3b1dcf ci: fix error: externally-managed-environment 2024-02-15 13:25:18 +00:00
proletarius101
8d96811c11 ci: fix syntax error 2024-02-15 13:25:18 +00:00
proletarius101
d7c26611fa ci: fix pylint doesn't run in MR pipelines 2024-02-15 13:25:18 +00:00
proletarius101
4619c9d1ec ci: use upstream pylint as codeclimate-pylint is deprecated and doesn't support pyproject.toml 2024-02-15 13:25:18 +00:00
proletarius101
87bfe5218b ci: limit the linted files to what we are linting now 2024-02-15 13:25:18 +00:00
proletarius101
7525e88d14 ci: disable linters we didn't use 2024-02-15 13:25:18 +00:00
proletarius101
a895f9e11c ci: add html output for code quality linter 2024-02-15 13:25:18 +00:00
proletarius101
6cf678a4fc 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.
2024-02-15 13:25:18 +00:00
7 changed files with 93 additions and 23 deletions

View File

@ -1,3 +0,0 @@
[bandit]
skips: B110,B404,B408,B410,B603,B607
targets: .

2
.bandit.yaml Normal file
View File

@ -0,0 +1,2 @@
skips: [B110, B404, B408, B410, B603, B607, B322]
targets: .

47
.codeclimate.yml Normal file
View File

@ -0,0 +1,47 @@
---
version: "2"
plugins:
shellcheck:
enabled: true
channel:
# Only include tests/run-tests
exclude_patterns:
- "**/*"
- "!tests/run-tests"
checks:
SC2046:
enabled: false
SC2090:
enabled: false
# Disable as the followings are absent in the shellcheck version provided by debian
# https://gitlab.com/fdroid/fdroidserver/-/merge_requests/1443#note_1769237096
SC2086:
enabled: false
SC2129:
enabled: false
SC2006:
enabled: false
SC2126:
enabled: false
SC1007:
enabled: false
SC1001:
enabled: false
SC2016:
enabled: false
SC2181:
enabled: false
SC2103:
enabled: false
SC2089:
enabled: false
bandit:
enabled: true
# Disable as they are not among the array of linters we used previously
duplication:
enabled: false
structure:
enabled: false

View File

@ -1,4 +1,6 @@
---
include:
- template: Code-Quality.gitlab-ci.yml
variables:
pip: pip3 --timeout 100 --retries 10
@ -213,7 +215,7 @@ gradlew-fdroid:
# Run all the various linters and static analysis tools.
lint_format_safety_bandit_checks:
lint_format_safety_checks:
image: debian:bookworm-slim
variables:
LANG: C.UTF-8
@ -228,34 +230,52 @@ 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
- 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
tags:
- saas-linux-medium-amd64
pylint:
rules:
- 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
image: debian:bookworm-slim
script:
- apt-get update
- apt-get -y install --no-install-recommends
python3-pip
pylint
- $pip install --break-system-packages pylint-gitlab
- pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter
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
tests/*.TestCase > pylint-report.json
artifacts:
reports:
codequality: pylint-report.json
# Run all the various linters and static analysis tools.

View File

@ -23,3 +23,6 @@ security:
67599:
reason: Only affects pip when using --extra-index-url, which is never the case in fdroidserver CI.
expires: '2026-05-31'
70612:
reason: jinja2 is not used by fdroidserver, nor any dependencies I could find via debtree and pipdeptree.
expires: '2026-05-31'

View File

@ -200,6 +200,7 @@ get_sha() {
'8.5') echo '9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026' ;;
'8.6') echo '9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c' ;;
'8.7') echo '544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d' ;;
'8.8') echo 'a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612' ;;
*) exit 1
esac
}
@ -220,7 +221,7 @@ d_gradle_plugin_ver_k=(8.4 8.3 8.2 8.1 8.0 7.4 7.3 7.2.0 7.1 7.0 4.2 4.1 4.0 3.6
d_plugin_min_gradle_v=(8.6 8.4 8.2 8.0 8.0 7.5 7.4 7.3.3 7.2 7.0.2 6.7.1 6.5 6.1.1 5.6.4 5.4.1 5.1.1 4.10.1 4.6 4.4 4.1 3.3 2.14.1 2.14.1 2.12 2.12 2.4 2.4 2.3 2.2.1 2.2.1 2.1 2.1 1.12 1.12 1.12 1.11 1.10 1.9 1.8 1.6 1.6 1.4 1.4)
# All gradle versions we know about
plugin_v=(8.7 8.6 8.5 8.4 8.3 8.2.1 8.2 8.1.1 8.1 8.0.2 8.0.1 8.0 7.6.4 7.6.3 7.6.2 7.6.1 7.6 7.5.1 7.5 7.4.2 7.4.1 7.4 7.3.3 7.3.2 7.3.1 7.3 7.2 7.1.1 7.1 7.0.2 7.0.1 7.0 6.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3.2 3.1 3.0 2.14.1 2.14 2.13 2.12 2.11 2.10 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2.1 2.2 2.1 2.0 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 0.9.2 0.9.1 0.9 0.8 0.7)
v_all=${plugin_v[@]}

View File

@ -142,7 +142,7 @@ fi
# allow the location of aapt to be overridden
if [ -z "$aapt" ]; then
aapt=`ls -1 $ANDROID_HOME/build-tools/*/aapt 2> /dev/null | sort | tail -1`
aapt=$(find "$ANDROID_HOME/build-tools/*/aapt" 2> /dev/null | sort | tail -1)
fi
# try to use GNU sed on OSX/BSD cuz BSD sed sucks
@ -745,7 +745,7 @@ if [ -e .git/config ]; then
REPOROOT=`create_test_dir`
cd $REPOROOT
tar xzf `ls -1 $WORKSPACE/dist/fdroidserver-*.tar.gz | sort -n | tail -1`
tar xzf "$(find "$WORKSPACE"/dist/fdroidserver-*.tar.gz | sort -n | tail -1)"
cd $REPOROOT
# shellcheck disable=SC2211
./fdroidserver-*/fdroid init
@ -1303,7 +1303,7 @@ if which wget; then
mv $REPOROOT/index-v1.json repo/index-v1.json
port=321${RANDOM:3}
test $(printf $port | wc -m) -le 3 && port=52734 # when $RANDOM doesn't work
test "${#port}" -le 3 && port=52734 # when $RANDOM doesn't work
timeout 5m python3 -m http.server $port --bind 127.0.0.1 > $REPOROOT/http.server.log 2>&1 &
http_server_pid=$!