From 5671039154585048372d5b94ca1be2cd031e01c4 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Mon, 30 Aug 2021 17:39:40 +0800 Subject: [PATCH] ci(sonarqube): pass "sonar.exclusions" in CI also increase the jvm size --- .gitlab/ci/static-code-analysis.yml | 11 +++++++++++ sonar-project.properties | 11 ----------- tools/ci/sonar_exclude_list.txt | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.gitlab/ci/static-code-analysis.yml b/.gitlab/ci/static-code-analysis.yml index 3239dddc56..cdcabfd758 100644 --- a/.gitlab/ci/static-code-analysis.yml +++ b/.gitlab/ci/static-code-analysis.yml @@ -67,6 +67,14 @@ check_pylint: - source tools/ci/utils.sh - export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH" - fetch_submodules + # Exclude the submodules, all paths ends with /** + - submodules=$(get_all_submodules) + # get all exclude paths specified in tools/ci/sonar_exclude_list.txt | ignore lines start with # | xargs | replace all to + - custom_excludes=$(cat $CI_PROJECT_DIR/tools/ci/sonar_exclude_list.txt | grep -v '^#' | xargs | sed -e 's/ /,/g') + # Exclude the report dir as well + - export EXCLUSIONS="$custom_excludes,$submodules" + - export SONAR_SCANNER_OPTS="-Xmx2048m" + variables: GIT_DEPTH: 0 REPORT_PATTERN: clang_tidy_reports/*.txt @@ -95,8 +103,10 @@ code_quality_check: -Dsonar.analysis.mode=preview -Dsonar.branch.name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME -Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN + -Dsonar.exclusions=$EXCLUSIONS -Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID -Dsonar.gitlab.commit_sha=$CI_MERGE_REQUEST_COMMITS + -Dsonar.gitlab.merge_request_discussion=true -Dsonar.gitlab.ref_name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN @@ -112,6 +122,7 @@ code_quality_report: - sonar-scanner -Dsonar.branch.name=$CI_COMMIT_REF_NAME -Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN + -Dsonar.exclusions=$EXCLUSIONS -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.host.url=$SONAR_HOST_URL diff --git a/sonar-project.properties b/sonar-project.properties index 4dfd721db6..e7dddab4ed 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,16 +5,6 @@ sonar.projectVersion=4.4 sonar.sources=. sonar.sourceEncoding=UTF-8 -# exclude list for sonarqube -# Here're some examples: (relative with the idf_path) -# test/**/* -# test/*/*.c -sonar.exclusion=\ - components/freertos/*.c,\ - components/freertos/include/freertos/*.h,\ - components/wpa_supplicant/src/**/*,\ - components/wpa_supplicant/include/**/* - sonar.inclusions=\ **/*.c,**/*.cpp,**/*.h,**/*.hpp,\ **/*.py @@ -33,5 +23,4 @@ sonar.cxx.file.suffixes=.cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h ####################### sonar.gitlab.failure_notification_mode=exit-code -sonar.gitlab.merge_request_discussion=true sonar.gitlab.project_id=103 diff --git a/tools/ci/sonar_exclude_list.txt b/tools/ci/sonar_exclude_list.txt index e69de29bb2..a91e445f52 100644 --- a/tools/ci/sonar_exclude_list.txt +++ b/tools/ci/sonar_exclude_list.txt @@ -0,0 +1,15 @@ +# exclude list for sonarqube +# Here're some examples: (relative with the idf_path) +# test/** +# test/*/*.c +# test.c +# +# lines start with # will be ignored + +# FreeRTOS upstream code (don't include our port files here) +components/freertos/*.c +components/freertos/include/freertos/*.h + +# wpa_supplicant upstream code +components/wpa_supplicant/src/** +components/wpa_supplicant/include/**