Skip to content

Conversation

@fernandotonon
Copy link
Owner

Problem

After PR #94 (Fix missing tests) was merged to master, SonarQube started showing 0 issues, 0 duplications, and 0 coverage.

Root Cause

The SonarQube configuration had C++ file analysis disabled by setting file suffixes to -, which prevented SonarQube from analyzing any C++ code.

Solution

  • ✅ Enabled C++ file analysis by setting proper file suffixes (.cpp, .h, etc.)
  • ✅ Added cfamily configuration with compile_commands.json for better analysis
  • ✅ Ensured compile_commands.json is copied from build/ directory in CI workflow
  • ✅ Combined build-wrapper support with cfamily analysis configuration

Changes

  • sonar-project.properties: Enable C++ file suffixes and add cfamily configuration
  • .github/workflows/deploy.yml: Add cfamily parameters and ensure compile_commands.json is available

This will restore proper code analysis, duplication detection, and coverage reporting in SonarQube.

- Enable C++ file analysis by setting proper file suffixes (.cpp, .h, etc.)
- Add cfamily configuration with compile_commands.json for better analysis
- Ensure compile_commands.json is copied from build/ directory in CI
- Combine build-wrapper support with cfamily analysis configuration

This fixes the issue where SonarQube was showing 0 issues, duplications,
and coverage after PR #94 was merged, which was caused by C++ file analysis
being disabled.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +33 to +34
sonar.c.file.suffixes=.c,.h
sonar.cpp.file.suffixes=.cpp,.cc,.cxx,.c++,.hpp,.hh,.hxx,.h++,.h

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 👍 / 👎.

@fernandotonon fernandotonon merged commit 9043bbb into master Nov 13, 2025
10 checks passed
@fernandotonon fernandotonon deleted the fix-sonarqube branch November 13, 2025 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants