XPath working on SSLR toolkit but not working on SonarQube


(Durga madhaba nanda) #1
  • versions used (SonarQube(7.4), Scanner SonarQube Scanner 3.2.0.1227, SSLR tool kit (sslr-plsql-toolkit-3.3.0.2273)

Below code and Xpath working on SSLR toolkit but not working on Sonarqube UI , SOnarqube application not detecting it as a error based on Xpath query. Its causing our rules not working properly

CREATE TABLE Persons11111111111111111111111111111111111111 (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);

//*[contains(@tokenValue,‘TABLE’)]/following-sibling::BIN_IDENTIFIER[(string-length(@tokenValue) > 29)]

Regards
Durga


(Pierre-Yves Nicolas) #2

The documentation lists what you should do to set up your custom rule.
Did you activate the rule in a quality profile?
Did you configure your project to use your quality profile which contains the custom rule?
Did you re-run the analysis after that?


(Durga madhaba nanda) #3

yes , we had done these steps .Others are working but this one not working mostly where following:siblings involved


(Pierre-Yves Nicolas) #4

I set up your rule and analyzed it on the exact code you gave, and I got an issue.
As the SSLR Toolkit was unable to parse the original XPath query, I changed the strange quotes around ‘TABLE’. That’s the only thing I had to change to make it raise an issue.


(Durga madhaba nanda) #5

can you please share which change you made with table . may be we are not able to catch it


(Pierre-Yves Nicolas) #6

Here’s the XPath query which I used:

//*[contains(@tokenValue,'TABLE')]/following-sibling::BIN_IDENTIFIER[(string-length(@tokenValue) > 29)]

It seems that discourse (the software which powers this web site) transforms single quotes to ‘’ unless you also use backticks…