Language of file can not be decided error

  • versions used
    SonarQube : Enterprise Edition Version 8.2 (build 32929)
    Scanner: 3.1.0.1141
    Plugin: Flow
    webMethods Flow plugin 1.0
    & XML

  • error observed
    ERROR: Error during SonarQube Scanner execution
    ERROR: Language of file 'ns//flow.xml’ can not be decided as the file matches patterns of both sonar.lang.patterns.xml : /*.xsd,/*.xsl,/.xml and sonar.lang.patterns.flow : **/.xml,**/*.ndf

We need a help on a plugin which we are trying to enable for our Webmethods team here. The issue we are facing is that this “Flow” plugin claims the files with extension “.xml” which is being claimed by SonarXML rule as well. This is causing a collision and causing our scan to fail if both the rules are active.

This was posted in Sonar Community and the solution provided was to disable either of the rule. This is not feasible for us as the Enterprise Sonar is used by all teams and we cannot disable one rule while using the other rule.

As a workaround, we had tried to change the extension for Flow plugin and then renaming the source files for Flow to the changed extension. This works but its not a desired approach as it requires change of code.

Looking for a way to select/exclude a language during scan. Like even though two plugins are using same extension, during the scan I can define which language to select/exclude

File suffixes and the languages they’re associated with can be adjusted at the project-level.

A Project Administrator can navigate to Project Settings > Languages > XML on an individual project, where they can remove .xml so that Flow “owns” the suffix instead.

At the global administration level, you’ll want to let one a single language own .xml by default.

(I don’t know anything about the Flow plugin since it’s a community-supported plugin, but I assume they allow file suffixes to be adjusted in the UI as well)

Thanks Colin. This works in GUI

Also , using scripts I was able to achieve this using the below settings in sonar-project.properties
“”"
#Disable XML for this project
sonar.lang.patterns.xml=flowxml

#Enable Flow for this project
sonar.flow.file.suffixes=xml
“”"

Hi, I am using Sonar-flow plugin, it is not scanning the.ndf files of webmethod project. Can you please help ?

Hey @aniruddha87

Instead of bumping a 2-year old thread, I welcome you to create a new thread with all the details (however, we will probably just have to tell you to reach out to the maintainer of the community-supported plugin you’re using: GitHub - I8C/sonar-flow-plugin: A sonarqube plugin to analyse webmethods flow code)

I will close this thread.

1 Like