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

Hi,

Currently we are experiencing the following error in SonarCloud analyses:

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
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: 
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.

Best

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.

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?

Hi @manuyavuz-pointr,

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