Use custom sensor for XML file based on file pattern , not by file extension


i want to develop a new Sensor (let’s call it "FooLintSensor) which implements Sensor
i defined a new Language (FooLanguage) which does not rely on file extensions, but rather on file patterns.

When i deploy my plugin in sonarqube, it is ok … i see my rules, and quality profile.
But when i run a scan via (maven sonar:sonar) … i have the following message

The file Foobar-498af65f9876qgqt963qd.xml is indexed with language ‘xml’

That’s ok, but i also want the file to be indexed by my custom Sensor
My sensor cannot rely on XML file extensions, but on file pattern , like “Foobar-\p{Alnum}.xml”

Is that possible ?
If so , how to proceed ?
Thanks in advance.


Hi @paissad

There is no strict requirement for a Sensor to depends on a language. Even without a plugin providing a language, all project files under source directories will be indexed (with no language for those having unknown extension). It doesn’t prevent any other Sensor to query the Filesystem API for the files you want to analyze (using a pattern predicate).

One interesting thing to know is that even if all project files are indexed, files with no detected language are only published lazily to the server if at least one Sensor is saving some data for them (measure, issues, highlighting, …).

If the files you are analyzing contain no issues/measures/…, but you still want to see them on server side, you can call the special method markForPublishing.


I managed to do what i wanted.
I inspired from SonarXML plugin to do the job