Same File applied different rules in different projects

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension):
    Enterprise Edition Version 10.4.1 (build 88267)
  • how is SonarQube deployed: in our cloud environment

I have two projects in SonarQube which are related to the same repository in git. The two projects have some shared source code files. I use compile_commands.json as a parameter for SonarQube scanner.
It is strange that for the shared source file a.c Sonarqube reported a cpp rule warning in project A

But this doesn’t happen in project B.

I don’t know why a cpp rule is applied to a C language file and why only project A has this problem.


Hi @jiaoli ,

you should check the compiler invocation argument for a.c in the compile_commands.json of the two projects, those arguments are used to configure the analyzer. It is likely that in one of the projects you are compiling a.c in C++. Could you please verify if it is the case?