Merge branch 'ci/fix_code_quality_report' into 'master'

CI: fix code quality report

Closes IDFCI-1905

See merge request espressif/esp-idf!27988
This commit is contained in:
Fu Hanxi
2024-01-09 14:45:37 +08:00
2 changed files with 11 additions and 10 deletions

View File

@@ -298,10 +298,9 @@ variables:
before_script: before_script:
- *git_init - *git_init
- *git_fetch_from_mirror_url_if_exists - *git_fetch_from_mirror_url_if_exists
- | - git fetch origin refs/tags/"${LATEST_GIT_TAG}":refs/tags/"${LATEST_GIT_TAG}" --depth=1
git fetch origin refs/tags/"${LATEST_GIT_TAG}":refs/tags/"${LATEST_GIT_TAG}" --depth=1 - git repack -d
git repack -d - git fetch origin $PIPELINE_COMMIT_SHA --shallow-since=$(git log -1 --format=%as "${LATEST_GIT_TAG}")
git fetch origin $CI_COMMIT_SHA --shallow-since=$(git log -1 --format=%as "${LATEST_GIT_TAG}")
- *git_checkout_fetch_head - *git_checkout_fetch_head
- *common-before_scripts - *common-before_scripts
- *setup_tools_and_idf_python_venv - *setup_tools_and_idf_python_venv

View File

@@ -30,7 +30,7 @@ check_pylint:
script: script:
- | - |
if [ -n "$CI_MERGE_REQUEST_IID" ]; then if [ -n "$CI_MERGE_REQUEST_IID" ]; then
export files=$(echo $GIT_DIFF_OUTPUT | grep ".py$" | xargs); export files=$(echo "$GIT_DIFF_OUTPUT" | grep ".py$" | xargs);
else else
export files=$(git ls-files "*.py" | xargs); export files=$(git ls-files "*.py" | xargs);
fi fi
@@ -53,8 +53,10 @@ check_pylint:
.sonar_scan_template: .sonar_scan_template:
stage: build stage: build
extends: .pre_check_template extends: .pre_check_template
image: # full clone since this image does not support fetch --shallow-since-cutoff
name: $SONARQUBE_SCANNER_IMAGE # shiny runners are used for full clone
tags: [build, shiny]
image: $SONARQUBE_SCANNER_IMAGE
before_script: before_script:
- source tools/ci/utils.sh - source tools/ci/utils.sh
- export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH" - export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH"
@@ -68,7 +70,7 @@ check_pylint:
- export SONAR_SCANNER_OPTS="-Xmx2048m" - export SONAR_SCANNER_OPTS="-Xmx2048m"
variables: variables:
GIT_DEPTH: 0 GIT_DEPTH: 0
REPORT_PATTERN: clang_tidy_reports/*.txt REPORT_PATTERN: clang_tidy_reports/**/*.txt
artifacts: artifacts:
when: always when: always
paths: paths:
@@ -81,7 +83,7 @@ code_quality_check:
extends: extends:
- .sonar_scan_template - .sonar_scan_template
- .rules:patterns:static-code-analysis-preview - .rules:patterns:static-code-analysis-preview
allow_failure: true # since now it's using exit code to indicate the code analysis result, allow_failure: true # it's using exit code to indicate the code analysis result,
# we don't want to block ci when critical issues founded # we don't want to block ci when critical issues founded
script: script:
- export CI_MERGE_REQUEST_COMMITS=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py commits --src-branch ${CI_COMMIT_REF_NAME} | tr '\n' ',') - export CI_MERGE_REQUEST_COMMITS=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py commits --src-branch ${CI_COMMIT_REF_NAME} | tr '\n' ',')
@@ -104,7 +106,7 @@ code_quality_report:
extends: extends:
- .sonar_scan_template - .sonar_scan_template
- .rules:protected - .rules:protected
allow_failure: true # since now it's using exit code to indicate the code analysis result, allow_failure: true # it's using exit code to indicate the code analysis result,
# we don't want to block ci when critical issues founded # we don't want to block ci when critical issues founded
script: script:
- sonar-scanner - sonar-scanner