Language of file can not be decided as the file matches patterns of both sonar.lang.patterns.vbnet : **/*.vb and sonar.lang.patterns.vb : **/*.vb,**/*.bas,**/*.frm,**/*.ctl,**/*.vb,**/*.bas,**/*.frm,**/*.ctl

Hi Team,

We have configured SonarQube with Jenkins and running the build,
build is failing with the below error message
`
INFO: EXECUTION FAILURE

INFO: ------------------------------------------------------------------------
INFO: Total time: 13.295s
INFO: Final Memory: 25M/270M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Language of file ‘Data.Business\DataSearch.vb’ can not be decided as the file matches patterns of both sonar.lang.patterns.vbnet : /.vb and sonar.lang.patterns.vb : **/.vb,/.bas,**/.frm,/*.ctl,/.vb,**/.bas,/*.frm,/.ctl
ERROR: The SonarScanner did not complete successfully
`
As i am not global administrator,so tried to fix at project level,but didn’t work
SonarScanner.MSBuild.exe begin /k:“Something” /d:sonar.lang.patterns.vb="
.bas"

Please suggest how can we fix this issue or if there is any way to focus on only specific lang like c# and vb

Hi @DewanganA ,

Your idea is a correct solution if you cannot change the project settings. I’m personally using this, can you try it like that?

/d:sonar.lang.patterns.vb="*.bas"

The difference is the * in the pattern. I’m not sure if that could be the reason why it didn’t work for you, but the variant with * works for my usual testing purposes.

1 Like

Hi @Pavel_Mikula,
I tried with * too, but it didn’t work.

Can you take a look inside

  • .sonarqube\conf\SonarQubeAnalysisConfig.xml after begin step
  • .sonarqube\out\sonar-project.properties after end step
    to see if the configured value is present?

The error suggests that your setting was not applied, not even with your original value.

Yes, configured values i can in file “SonarQubeAnalysisConfig.xml” and “sonar-project.properties”.

Is there any key value i should specifically check?

Search for the sonar.lang.patterns.vb to see if it is set and propagated.

didn’t find it anywhere.

If I execute

SonarScanner.MSBuild.exe begin /k:“Something” /d:sonar.lang.patterns.vb=".bas"

I see this in SonarQubeAnalysisConfig.xml

  <LocalSettings>
    <Property Name="sonar.lang.patterns.vb">.bas</Property>
  </LocalSettings>

If you don’t see it, there’s something wrong with the way you pass the parameter.

What Scanner version do you have?
In what environment do you start it?
How exactly do you start it?

Hello @DewanganA

Did you manage to fix the problem in the meantime?

Hi @Caba_Sagi ,

Yes, solution given by @Pavel_Mikula worked for me, i tried below code
SonarScanner.MSBuild.exe begin /k:“Something” /d:sonar.lang.patterns.vb=’*.bas’

The only difference is instead of ".bas" i used '.bas’

Thanks,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.