Skip to content

Commit

Permalink
ci(sonarqube): pass "sonar.exclusions" in CI
Browse files Browse the repository at this point in the history
also increase the jvm size
  • Loading branch information
hfudev committed Sep 2, 2021
1 parent 61299f8 commit 5671039
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .gitlab/ci/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <space> to <comma>
- 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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 0 additions & 11 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
15 changes: 15 additions & 0 deletions tools/ci/sonar_exclude_list.txt
Original file line number Diff line number Diff line change
@@ -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/**

0 comments on commit 5671039

Please sign in to comment.