I am running sonarqube where I am configuring the cxx plugin by running sonar.cppcheck.reportpaths=./test.xml
this is what my sonar.properties file looks like:
# Project identification
sonar.projectKey=sonar
sonar.projectName=sonarqube_project
sonar.projectVersion=1.0
# Leave sonar.sources empty
sonar.sources=test
#sonar.language=cpp
sonar.language=cxx
sonar.sourceEncoding=UTF-8
sonar.cxx.file.suffixes=.c,.h
sonar.cppcheck.reportPaths=./test.xml
#sonar.cxx.compiler.parser=MSBuild
#sonar.cxx.compiler.reportPath=*.log
#sonar.cxx.compiler.charset=UTF-8S
I would like to have the cppcheck results be published on the sonarqube website.
Currently, what I see on the website is that it is scanning over the python and html files but not c files. I am wondering what I am doing wrong.
Here is the remote pipeline that calls the sast scan.
#version: v4.3.2
variables:
SAST_IMAGE: "cdn.harbor.global.lmco.com/lmc.eo.asap/lmco-security/static-code-scanner:latest"
ENABLE_SAST_SCANS: "true"
SAST_ALLOW_FAIL: "false"
# See documentation for additional variables https://pipeline-cSatalog.global.lmco.com/#/pipelines/sast-scans/docs/sast-basic.md
# variable for tracking pipeline usage
SWF_PIPELINE_METRICS_MODULES_SAST_SONARQUBE: "true"
.sonarqube-scan:
image: $SAST_IMAGE
stage: sast
variables:
SAST_SCAN: "sonarqube"
NEXUS_URL: "https://nexus.global.lmco.com"
before_script:
- echo -e " -- Docs -- n pipeline_module n - modules/sast-sonarqube.gitlab-ci.yml n expected files n - none n variables n - ADDITIONAL_PATH ttt ${ADDITIONAL_PATH} n - ENFORCE_RELEASE_GATE tt ${ENFORCE_RELEASE_GATE} n - SCAN_RESULTS_REVIEWERS_NTIDS ${SCAN_RESULTS_REVIEWERS_NTIDS} n - ENABLE_RESULTS_EMAIL tt ${ENABLE_RESULTS_EMAIL} n"
- "if [ -z ${CI_PROJECT_NAME+x} ]; thenn echo "**********************************************************************************************************"n echo -e "\e[91mYou appear to be missing variables normally provided by GitLab. If you are executing \e[0m" n echo -e "\e[91myour pipeline from Jenkins, variable mapping documentation can be found here: \e[0m"n echo -e "\e[34mhttps://docs.us.lmco.com/display/CASAP/ASAP-General-008+-+How+to+Configure+Security+Scanning+for+Bitbucket \e[0m"n echo "**********************************************************************************************************"n exit 1nfin"
- >
if [ -n "${ADDITIONAL_PATH}" ] && [ "$ADDITIONAL_PATH" != "." ]; then
FILE="${ADDITIONAL_PATH}/sonar-project.properties"
if [ -f "$FILE" ];
then
echo "Copying sonar-project.properties to repo root."
cp "$FILE" "./sonar-project.properties"
fi
fi
script:
- python /static-code-scan.py
artifacts:
paths:
- sonarqubescan-metrics.json
when: always
sonarqube-scan:
extends: .sonarqube-scan
rules:
- if: '$ENABLE_SAST_SCANS == "false"'
when: never
- if: '$SAST_ALLOW_FAIL=="true"'
allow_failure: true
- if: '$SAST_ALLOW_FAIL=="false"'
allow_failure: false