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
25 changes: 22 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,17 @@ jobs:
fi

echo "=== Running SonarCloud analysis ==="
# Check if build-wrapper output exists
BUILD_WRAPPER_OUTPUT="${{ env.BUILD_WRAPPER_OUT_DIR }}bw-output"
if [ -d "$BUILD_WRAPPER_OUTPUT" ] && [ -f "$BUILD_WRAPPER_OUTPUT/build-wrapper-output.json" ]; then
echo "Build-wrapper output found at: $BUILD_WRAPPER_OUTPUT"
ls -la "$BUILD_WRAPPER_OUTPUT" | head -5
else
echo "WARNING: Build-wrapper output not found at $BUILD_WRAPPER_OUTPUT"
echo "Checking for alternative locations..."
find . -name "build-wrapper-output.json" -type f 2>/dev/null | head -5 || echo "No build-wrapper-output.json found"
fi

# Build scanner command base
SCANNER_CMD="sonar-scanner \
-Dsonar.projectKey=fernandotonon_QtMeshEditor \
Expand All @@ -861,11 +872,19 @@ 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=- \
-Dsonar.cpp.file.suffixes=- \
-Dsonar.objc.file.suffixes=- \
-Dsonar.c.file.suffixes=.c \
-Dsonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++ \
-Dsonar.objc.file.suffixes=.m,.mm \
-Dsonar.verbose=true"

# Add build-wrapper output if it exists
if [ -d "$BUILD_WRAPPER_OUTPUT" ] && [ -f "$BUILD_WRAPPER_OUTPUT/build-wrapper-output.json" ]; then
echo "Adding build-wrapper output to analysis"
SCANNER_CMD="$SCANNER_CMD -Dsonar.cfamily.build-wrapper-output=$BUILD_WRAPPER_OUTPUT"
Comment on lines 872 to +883

Choose a reason for hiding this comment

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

P1 Badge Build-wrapper detection looks for non-existent path/file

The build-wrapper step earlier in this workflow runs with --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} where the env var is ./, so the wrapper writes its build-wrapper-dump.json directly under the repository root. The new analysis step hardcodes BUILD_WRAPPER_OUTPUT="${{ env.BUILD_WRAPPER_OUT_DIR }}bw-output" and checks for build-wrapper-output.json. Neither the directory nor the file name matches what the wrapper actually produces (build-wrapper-dump.json in ./). As a result the script always skips adding -Dsonar.cfamily.build-wrapper-output, causing SonarCloud’s C/C++ analysis to run without the required compilation database and the scan will fail or be ineffective. The detection should align with the actual output path/name used when running the wrapper.

Useful? React with 👍 / 👎.

else
echo "WARNING: Skipping build-wrapper output (not found). Analysis will proceed without compilation database."
fi

# Only add coverage if file exists and is not empty
if [ -f coverage.lcov ] && [ -s coverage.lcov ]; then
echo "Using LCOV format for coverage"
Expand Down
12 changes: 6 additions & 6 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ sonar.coverage.exclusions=**/*_test.cpp,**/test_*.cpp,tests/**/*.cpp,tests/**/*.
# 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

# Disable C++ file analysis since we don't have cfamily plugin
# This prevents SonarQube from trying to analyze C++ code
# We only use SonarQube for coverage reporting via generic coverage format
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
# 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.objc.file.suffixes=.m,.mm
Loading