SonarQube - adding new rule for assertion checks

I’m new to SonarQube and I’m have been going through the documentation on adding custom rules on the help page here:

I had been thinking of adding a rule through XPATH which checks for assertions in a SQL file. This is the rule I have added. I have attached the xml.
sonarlint.txt (618 Bytes)

I have also attached the .json file which contains the rule key, etc for the custom rule added

sonarlint.json (279 Bytes)

I do not have access to the SonarQube server, but, I was wanting to etst the rule. I use VS Code IDE, therefore, I installed the SonarLint Extention and I was trying to Analyse my sqlx files for assertions but the rule (in the attached xml was not detected)

I placed the xml and json in the working directory and was mentioning in the json file about the location of my source files.

Can anyone please help? It will be gratefully appreciated


Hi AT,

Welcome to the community!

To make this work, I believe you’re going to need to

  • create your rule in a SonarQube instance
  • add it to a Quality Profile
  • set that Quality Profile as the default or explicitly assign it to your project
  • use connected mode to pull in your custom Quality Profile.

BTW, I assume this is for PL/SQL? That’s the only relevant language that supports XPath rules.