Language of file can't be decided (default language patterns sonar.lang.patterns.c and sonar.lang.patterns.objc)


(Manuyavuz Pointr) #1


Currently we are experiencing the following error in SonarCloud analyses:

INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 25.675s
INFO: Final Memory: 22M/117M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Language of file 'MyFile.h' can not be decided as the file matches patterns of both sonar.lang.patterns.c : **/*.c,**/*.h and sonar.lang.patterns.objc : **/*.h,**/*.m,**/*.mm
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

We don’t set any of sonar.lang.patterns.c and sonar.lang.patterns.objc, so I think these should be the defaults used by SonarCloud, which might be a problem.

As a workaround, where can I override them? I checked Administration > General Settings > C/C++/Objective-C but couldn’t find anything.


(Massimo Paladin) #2

Hi @manuyavuz-pointr,

I guess that you are trying to set sonar.objc.file.suffixes=.h,.m, you should add sonar.c.file.suffixes=- because sonar.c.file.suffixes is default to .c,.h.

(Manuyavuz Pointr) #3

Hi @mpaladin,

Thanks for the quick answer!

This fixed the problem, but we’ve been using -Dsonar.objc.file.suffixes=.h,.m,.mm for the whole time, never got a problem like this before. Has anything changed on Sonar side which might cause this?

(Massimo Paladin) #4

Hi @manuyavuz-pointr,

nope, nothing changed, you cannot have the same suffix on two different languages, it’s always being like that.