Xml file extension is binded to multiple Language

  • SonarQube Version 7.9.1.27448
  • error observed
Error during SonarQube Scanner execution
 xxxx.xml' can not be decided as the file matches patterns of both sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl and sonar.lang.patterns.mule : **/*.xml 
  • steps to reproduce -
    set xml as default profile and mule language profile to have a non default value.
    and run the sonarqube for ReactJS or AzureSQL sonarqube scan
  • potential workaround
    we need to exclude mule language explicitly like below
    sonar.lang.patterns.mule=-
    sonar.excludePlugins=mule
    #bug:fp

Sorry, what’s your question?

It seems that the problem you hit is caused by a “mule” plugin. There’s no such plugin in the SonarQube distributions which are provided by SonarSource.

We have mule code which scan against the sonar and the mule rule for scanning against the xml profile and the xml rules for scanning againt the xml profile is conflicting even after setting xml values as default values in the sonarqube server.
mule plugin details GitHub - mulesoft-catalyst/mule-sonarqube-plugin: The Mule SonarQube Plugin provides the capability to do code inspecting and taking project metrics from a mule project using SonarQube.

What’s your question?

I hope you have understood the problem here. and the question is that we can avoid this conflict by mentioning sonar.lang.patterns.mule=- sonar.excludePlugins=mule parameters in the sonar command. but we want to avoid the file extension binding to multiple languages from the sonarQube server settings instead of doing it in command for each Project scan.

I’m not sure I understood your problem.

What I can say is that the SonarQube menu “Administration” > “Languages” can be used to associate file suffixes for each language/plugin at server level.

Please keep in mind that this mule plugin is not supported by SonarSource. You may try to ask support to the authors of the plugin.

Please try to under the error that i posted so at least you will understand the problem statement. all the options mentioned by you, we are aware of but we need an extra feature to be added from the sonarqube in order to avoid the dule extension binding issue. solution could be giving an option to make xml plugin to scan against all xml files even if there are any external 3rd party plugin added to scan against it, and that plugin need to be called from the sonar command in order to make the 3rd party plugin as a default. please let us know if you need much more clarification on to it. we will be ready to explain in much more detail.

I think the main problem is that the “mule” plugin, which is not provided by SonarSource, does not support what you want to achieve. This plugin is kind of incompatible with SonarSource XML analyzer: that’s explicitly stated by their documentation where they mention that “SonarQube already comes with an XML plugin”.

The SonarQube API already makes it possible for a plugin to raise issues on any source file without requiring users to associate all possible file suffixes to this plugin. I suppose that the authors of the mule plugin are not aware of that. As a user of this plugin, you should explain your problem to them. SonarSource cannot fix the mule plugin.

We have found solution for this issue, to avoid multiple language binding issue we need to mention “-” parameter as a extension suffix at sonarqube server level. i.e. for mule we have to mention like below screenshot. and to scan against mule again we can mention the parameter explicitly in the while running the sonar command for that project like " sonar.mule.file.suffixes = **/*.xml


anyways thanks for the reply

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