Skip to content

Commit

Permalink
ci: pylint with codeclimate
Browse files Browse the repository at this point in the history
  • Loading branch information
hfudev committed Aug 15, 2023
1 parent c2c402f commit 28c9953
Show file tree
Hide file tree
Showing 5 changed files with 462 additions and 433 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ variables:
QEMU_IMAGE: "${CI_DOCKER_REGISTRY}/qemu-v5.2:2-20230522"
TARGET_TEST_ENV_IMAGE: "$CI_DOCKER_REGISTRY/target-test-env-v5.2:2"

SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:3"
SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:5"

PRE_COMMIT_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-pre-commit:1"

Expand Down
12 changes: 3 additions & 9 deletions .gitlab/ci/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,19 @@ check_pylint:
extends:
- .pre_check_template
- .rules:patterns:python-files
- .before_script_minimal
image: $SONARQUBE_SCANNER_IMAGE
artifacts:
when: always
paths:
- pylint-report.txt
reports:
codequality: pylint.json
expire_in: 1 week
script:
- export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
- |
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
export files=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py files ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} | grep ".py");
else
export files=$(find . -iname "*.py" -print);
fi
- pylint --rcfile=.pylintrc $files -r n --output-format=parseable > pylint-report.txt || exit 0
- run_cmd pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:pylint.json $files

# build stage
# Sonarqube related jobs put here for this reason:
Expand Down Expand Up @@ -83,7 +80,6 @@ check_pylint:
expire_in: 1 week
dependencies: # Here is not a hard dependency relationship, could be skipped when only python files changed. so we do not use "needs" here.
- clang_tidy_check
- check_pylint

code_quality_check:
extends:
Expand All @@ -107,7 +103,6 @@ code_quality_check:
-Dsonar.gitlab.ref_name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
-Dsonar.host.url=$SONAR_HOST_URL
-Dsonar.login=$SONAR_LOGIN
-Dsonar.python.pylint.reportPath=pylint-report.txt

code_quality_report:
extends:
Expand All @@ -124,4 +119,3 @@ code_quality_report:
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
-Dsonar.host.url=$SONAR_HOST_URL
-Dsonar.login=$SONAR_LOGIN
-Dsonar.python.pylint.reportPath=pylint-report.txt
Loading

0 comments on commit 28c9953

Please sign in to comment.