Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,17 @@ jobs:
ls -la sonar-project.properties || echo "sonar-project.properties not found"
ls -la coverage.xml coverage.lcov 2>/dev/null || echo "Coverage files not found"

# Ensure compile_commands.json is available for C++ analysis
if [ -f build/compile_commands.json ]; then
echo "Copying compile_commands.json from build/ to root"
cp build/compile_commands.json . || echo "Failed to copy compile_commands.json"
elif [ -f compile_commands.json ]; then
echo "compile_commands.json already exists in root"
else
echo "WARNING: compile_commands.json not found! C++ analysis may be limited."
fi
ls -la compile_commands.json 2>/dev/null || echo "compile_commands.json not found"

echo "=== Checking coverage file formats ==="
if [ -f coverage.lcov ]; then
echo "--- coverage.lcov (first 10 lines) ---"
Expand Down Expand Up @@ -872,9 +883,12 @@ jobs:
-Dsonar.test.inclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp \
-Dsonar.exclusions=**/OgreXML/**,**/dependencies/**,**/*_autogen/**,**/CMakeFiles/**,**/ui_files/**,**/moc_*,**/_deps/** \
-Dsonar.coverage.exclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp,tests/**/*.qml,**/*_autogen/** \
-Dsonar.c.file.suffixes=.c \
-Dsonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++ \
-Dsonar.c.file.suffixes=.c,.h \
-Dsonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++,.h \
-Dsonar.objc.file.suffixes=.m,.mm \
-Dsonar.cfamily.compile-commands=compile_commands.json \
-Dsonar.cfamily.cache.enabled=true \
-Dsonar.cfamily.threads=4 \
-Dsonar.verbose=true"

# Add build-wrapper output if it exists
Expand Down
15 changes: 9 additions & 6 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ sonar.exclusions=**/OgreXML/**,**/dependencies/**,**/*_autogen/**,**/CMakeFiles/
# Coverage exclusions - exclude test files from coverage calculation
sonar.coverage.exclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp,tests/**/*.qml,**/*_autogen/**

# Coverage settings for C++ projects without cfamily plugin
# Note: Generic coverage support in SonarQube is limited for C++
# Coverage path will be set dynamically in workflow to ensure file exists
# If coverage reporting doesn't work, you may need to use the sonar-cxx community plugin
# Coverage settings for C++ projects
# Note: Coverage path will be set dynamically in workflow to ensure file exists

# Enable C++ file analysis with build-wrapper support
# The build-wrapper provides compilation data for SonarCloud analysis
# File suffixes for C/C++ source files
sonar.c.file.suffixes=.c
sonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++
sonar.c.file.suffixes=.c,.h
sonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++,.h
Comment on lines +33 to +34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Assign .h suffix to only one language

The change now lists .h in both sonar.c.file.suffixes and sonar.cpp.file.suffixes. Sonar’s C/C++ analyzer requires every suffix to belong to exactly one language; when the same suffix is provided twice the scanner aborts with The suffix '.h' is defined for multiple languages and no analysis is produced. Instead of duplicating .h, keep it only in the language you want (typically C++) or enable header analysis via sonar.cfamily.analyze.headers. As it stands, the SonarCloud job will continue to fail before doing any analysis.

Useful? React with 👍 / 👎.

sonar.objc.file.suffixes=.m,.mm

# C++ analysis configuration using compile_commands.json for better analysis
sonar.cfamily.compile-commands=compile_commands.json
sonar.cfamily.cache.enabled=true
sonar.cfamily.threads=4
Loading