diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 30e8f39..d150ced 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 \ @@ -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" + 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" diff --git a/sonar-project.properties b/sonar-project.properties index b68be84..2f5b001 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -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