Language of file 'filename.dev.js' can not be decided as the file matches patterns of both sonar.lang.patterns.cs : **/*.cs,**/*.js and sonar.lang.patterns.js : **/*.js,**/*.jsx,**/*.mjs,**/*.vue
When I inspect the Languages in the project settings (screenshot below), I can see that in the C# patterns there is only .cs files. But I do see as well that the keys don’t match : the key in the project settings is sonar.cs.file.suffixes and the key in the error is sonar.lang.patterns.cs. Any idea what might be the issue?
We don’t set .js as a C# pattern, so this is probably coming from analysis parameters. The first thing I’d do is:
remove your sonar.lang.patterns.cs setting
add sonar.scanner.dumpToFile=[path to file]
To see exactly what analysis is getting. You’ll see in here a conflation of things explicitly set at the four levels described at the top of this page. (Yes, those are the SonarQube docs, and you’ve tagged this SonarCloud. It should be the same for both, but I’m not sure where that hierarchy ended up in the reorganized SC docs.) That will accomplish confirming (or not!) that somewhere else that file suffix is being set.
And then the question becomes tracking down where.
I tried to add the below property in the sonar cloud scanner analysis parameters, but the file is not being created. The path in the property is the exact path in the Azure DevOps agent, but the file is not being created there. Is there an example on how to properly use this property in Azure DevOps?
There was indeed a C# misconfigured rule in the UI at the project level, matching .js files. But in another project! I couldn’t find it at first, because I was using the same key for the two projects. It is fixed now