Rule to verify empty line after XML elements with certain name

Hi,

I am using SonarQube 7.7 Community.

We have a requirement that for readability purposes we have an empty line break after xml elements with a certain name, for instance flow.

This should be considered OK.

<?xml version="1.0" encoding="ISO-8859-1"?>
<parent>
<flow>test</flow>

<flow>test</flow>

</parent>

The following should be considered code smell.

<?xml version="1.0" encoding="ISO-8859-1"?>
<parent>
<flow>test</flow>
<flow>test</flow>
</parent>

How do I create a rule for this? I tried with the XML/XPATH plugins but there you don’t have acces to where there are linebreaks/empty lines in an xml.

Thank you for your help!

Christiaan

Hi,

Unfortunately I don’t think there is a way to implement it as a custom rule. Also this use case seems limited and formatting-related, so it’s unlikely we will include it in XML analyzer.