Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sonarcloud: Use Inclusions Property #121

Merged
merged 1 commit into from
Jul 18, 2022
Merged

Conversation

jungleraptor
Copy link
Contributor

@jungleraptor jungleraptor commented Jul 18, 2022

Fixes Code Coverage builds by switching to using the sonar.inclusions property.

Some of our build targets set their source directories in the include paths. Those paths are then emitted in the sonar-project.properties file here. The issue is that this can lead to files being indexed twice which the sonar-scanner treats as an error.

For example the generated file can look something like:

sonar.sources=
  foo/src/foo.cpp, \ # Absolute path to cpp file
  foo/src/ # Picked up from include paths. Causes scanner to scan foo.cpp twice

The inclusions property requires that we use a pattern string instead of paths, so include paths are modified with the appropriate pattern to ensure header files are included in the analysis.

See related PR for testing details:

@sonarcloud
Copy link

sonarcloud bot commented Jul 18, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@silverjam
Copy link
Contributor

silverjam commented Jul 18, 2022

Sonar cloud seems to be reporting "no coverage information" in the test PR?

@jungleraptor
Copy link
Contributor Author

Sonar cloud seems to be reporting "no coverage information" in the test PR?

That's because there weren't any c/c++ code changes. It only reports the analysis for new code.

I posted another PR link where there were cpp files added and it did the analysis correctly. I've added it to this PR as well.

@jungleraptor jungleraptor merged commit 1773f34 into master Jul 18, 2022
@jungleraptor jungleraptor deleted the itorres/fix-sonarcloud branch July 18, 2022 20:09
jungleraptor added a commit that referenced this pull request Jul 29, 2022
jungleraptor added a commit that referenced this pull request Jul 30, 2022
* Revert "sonarcloud: Use Inclusions Property (#121)"

This reverts commit 1773f34.

* Revert "Fix Sonarcloud sonar-project.properties (#120)"

This reverts commit 3550197.

Rolling back recent sonarcloud changes until we get a better grip
on how to properly configure C/C++ projects.
krisukox pushed a commit that referenced this pull request Aug 2, 2022
Fixes code coverage builds by switching to using the sonar.inclusions
property.

Some of our build targets set their source directories in the include paths.
Those paths are then emitted in the sonar-project.properties file here. The
issue is that this can lead to files being indexed twice which the sonar-scanner
treats as an error.

Using the `sonar.inclusions` property and adding pattern strings avoids this
issue.
krisukox pushed a commit that referenced this pull request Aug 2, 2022
Fixes code coverage builds by switching to using the sonar.inclusions
property.

Some of our build targets set their source directories in the include paths.
Those paths are then emitted in the sonar-project.properties file here. The
issue is that this can lead to files being indexed twice which the sonar-scanner
treats as an error.

Using the `sonar.inclusions` property and adding pattern strings avoids this
issue.
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