Can't create TSQL xpath custom rules, but it's possible for PLSQL

Hi, Sonar team.
Our organization recently bought SonarQube Enterprise Edition, now we have version 8.5.1.

I recently tried to create a custom rule for tsql to detect the use of cursors in stored procedures. I realized that there is a way to do that for plsql using the XPATH RULE TEMPLATE, but that template doesn’t exists for tsql.

Is it possible to add this template for tsql in next versions? If not, why is it possible to add custom xpath rules for plsql and not for tsql? Are there extra difficulties related to tsql or is just that Sonar prioritizes plsql over tsql?

Thanks a lot in advance for your answers.

Best regards,
Jorge

Hi,

We used to support XPath-based custom rules for quite a few languages. However, XPath custom rules have serious drawbacks. In particular, any given XPath custom rule may break when we have to change the grammar of our parser: that may happen when we want to fix our grammar or when we want to support a newer version of the language.

As of today, we don’t plan to add XPath custom rules to any language.
For several languages, we switched from XPath custom rules to a custom rule API. This other approach is more solid but also requires a big investment on our side.

We have XPath custom rules for PL/SQL because it’s one of our oldest analyzers. Our T-SQL analyzer is more recent and uses a parser which is based on stronger foundations but we don’t support custom rules for T-SQL.

1 Like

Thanks a lot for your explanations, Pierre.

Best regards,
Jorge