I am trying to write a custom rule for the below xaml file . The rule works properly in external tools available to validate Xpath .However , it is not flagging in SonarQube. My xaml file
New Text Document.txt (5.4 KB)
xpath query : count(Activity/Sequence//ui:SendOutlookMail/ui:SendOutlookMail.Files/scg:List/InArgument[not(contains(text(),"["))]) > 0
Welcome to the community!
The custom XPath rule templates only support XPath 1.0. Is that what you used?
Yes, the rule is made up of xpath 1.0 only . It works in other sites but not with Sonarqube
Your XPath expression returns boolean. It should return nodes of the XML in order to rule to report something.
Thanks for the reply. We are creating custom rules,
we have other rules configured in the same way , i.e it returns Boolean . If a Boolean value is True , it will show that particular rule in Issues.
Removing namespaces from the xpath fixed the problem:
count(Activity/Sequence/SendOutlookMail/SendOutlookMail.Files/List/InArgument[not(contains(text(),"["))]) > 0
Not sure why it does not work with the namespaces.
Thanks a lot, I will check and confirm it back to u
It Works Elena Thanks a lot …!