Hello Team,
WE tried but not able to identify .
We need this Xpath rule for PLSQL plugin.
We need Xpath query to identify Capital and small letters . This will help me in more rule creation.
Example :Between SELECT and select
Thanks
Hello Team,
WE tried but not able to identify .
We need this Xpath rule for PLSQL plugin.
We need Xpath query to identify Capital and small letters . This will help me in more rule creation.
Example :Between SELECT and select
Thanks
Hi. It’s not possible.
Using the sslr-plsql-toolkit-3.3.0.2273.jar you can see that a code like select * from dual;
generates this XML:
<COMPILATION_UNIT tokenValue="SELECT" tokenLine="1" tokenColumn="0">
<COMPILATION_UNIT tokenValue="SELECT" tokenLine="1" tokenColumn="0">
<SELECT_WITH_SEMICOLON tokenValue="SELECT" tokenLine="1" tokenColumn="0">
<SELECT tokenValue="SELECT" tokenLine="1" tokenColumn="0">
<SUBQUERY tokenValue="SELECT" tokenLine="1" tokenColumn="0">
<QUERY_BLOCK tokenValue="SELECT" tokenLine="1" tokenColumn="0">
<SELECT tokenValue="SELECT" tokenLine="1" tokenColumn="0"/>
<SELECT_LIST tokenValue="*" tokenLine="1" tokenColumn="7">
As you can see, even with the “select” keyword written in lower case, in the XML we’ll have the following: <SELECT tokenValue="SELECT" tokenLine="1" tokenColumn="0">
Therefore, there’s no way to distinguish between upper and lower cases in a XPATH rule.
Edit: this is a duplicate of To indentify english capital and small letter
Thank you so much for the detailed explanation.
Is there any way we can implement it as its our one of the rule in custom PLSQL that we want to create.
Below is our rule which we want to implement .
• Use all UPPER case for keywords/reserved words (including your own), and all lower case for database table and column names and PL/SQL variables.
• Do not use mixed case.
Your feedback will be highly appreciated…
Regards
Durga Nanda
There’s a rule to check is the keywords are written in uppercase: SonarCloud
But as far as I know, there’s no rule to check for lower case tables/columns/variables (and you can’t write one). Now I’ll let SonarSource answer you, it’s their commercial plugin after all.
There’s a rule to check is the keywords are written in uppercase: https://sonarcloud.io/explore/issues?languages=plsql&resolved=false&rules=plsql%3AUpperCaseReservedWordsCheck
do you have xpath for it ?
Regards
Durga
As Scott wrote, it’s not possible to write a XPath custom rule for that.
The rule which checks reserved words is a built-in one, it doesn’t use XPath.
We will add a rule to check identifiers such as table names or variables: SONARPLSQL-714