Our Sonar Build Environment details as follows:
* SonarQube Server Version - 5.6.6 (64-Bit).
* Sonar Client Build Operating System – Windows-7 (64-Bit).
* Sonar-scanner- Version - 3.0.3.778.
* sonar-cxx-plugin-0.9.7.jar
* sonar-csharp-plugin Version -5.11.0.1761.
* sonar-objective-c-plugin-0.5.0-SNAPSHOT.jar
* Source Code Language: C# and C++
Our SonarQube server is centralized server, So have installed (cxx-plugin, objective-c-plugin and csharp-plugin)
Current Problem:
When we scan the code, if fails with below error. Since we have multiple language (C# and C++) code, Both the language has to be scanned at a time.
ERROR: Caused by: Language of file 'workspace/HS30/baseclasses/ametex.h' can not be decided as the file matches patterns of both sonar.lang.patterns.c++ : **/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.hxx,**/*.hpp,**/*.hh,**/*.h and sonar.lang.patterns.objectivec : **/*.h,**/*.m
sonar.language=cs,c++ (Tried but didn't work)
So kindly help us to resolve the same.
This is a question of which language "claims" .h
files. Only one language can claim any given file extension and currently you have two languages claiming .h
, so the scanner can't figure out which analyzer to give those files to, and gives up.
Specifically, from your error message:
the file matches patterns of both sonar.lang.patterns.c++ : **/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.hxx,**/*.hpp,**/*.hh,**/*.h and sonar.lang.patterns.objectivec : **/*.h,**/*.m
You have both cxx
and objectivec
claiming .h
. You must remove the extension from one of those two lists.
Go to (Global) Administration > [Language] > [Language] file suffixes to edit the extensions claimed by each language, and remove .h
from one or both languages.
Make sure that you do not leave either of these fields blank. If left blank, the default value (which includes .h
) will be used.
I do sonar.lang.patterns.c=""
to empty the C extensions, and only keep the C++ ones. You need to know which one you want to keep, for instance sonar.lang.patterns.objectivec=""
to remove the objectiveC ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With