Sonar Cloud unable to detect C/C++ code in repo

Template for a good new topic, formatted with Markdown:

  • ALM used GitHub
  • CI system not used
  • Scanner command used when applicable (private details masked)
  • Languages of the repository
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
  • Potential workaround

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

We connected the repository and enabled automatic analysis. Our repository contains C/C++ code but it is not defined.

at the root of the default branch repository we put the configuration file .sonarcloud.properties

sonar.sources=src,HSFramework,HSModules,engine,libs,utils

sonar.sourceEncoding=UTF-8

sonar.exclusions=**/*.java,**/*.wav,**/base_mm/**,**/*.wav,**/*.png,**/*.xml

sonar.python.version=3.7

sonar.cfamily.reportingCppStandardOverride=c++17

what needs to be done for sonarcloud to detect and analyze C/C++ code in the repository during automatic analysis without CI-based?

Hey there.

Can you take a look in your GitHub repo and show us what the Languages breakdown looks like?

image

This data tells us if any C or C++ code exists.

Thanks. There are no languages ​​on the github repository side, I will add them in .gitattributes and report the result

We cannot configure language detection, since our repository size is more than 100,000 files and this is beyond the limits of linguist. About repository languages - GitHub Docs

Is there another way for sonarcloud to get the available languages ​​of the repository?

Not today. I’m not even sure we were aware of this limitation in this context (choosing which flavor of Automatic Analysis gets run, which itself is a very technical detail most users don’t have to worry about).

I’m going to flag this for attention. For now, you’ll have to switch to CI-based analysis (compilation database mode)

Hello @zetilov-s ,

Thanks for pointing out this limitation, we created a ticket in our backlog to overcome this limitation.

And to round this out – in the meantime, CI-based analysis is the way to go.

1 Like