-
Type:
Finding Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:None
-
Message:The XPath expression matches this piece of code.
-
List of parameters:
- Key: xpathQuery
- Description: The XPath query
- Key: message
- Description: The issue message
- Default: The XPath expression matches this piece of code
- Key: xpathQuery
-
Default Severity:Major
-
Impact:Low
-
Likelihood:High
-
Template Rule:Yes
-
Legacy Key:xpath, XPathCheck, XPathCheckPlSql, COBOL.XPath, XPath
-
Targeted languages:C#, Cobol, JavaScript, VB.Net
-
Covered Languages:Flex, PL/I, PL/SQL, Python, XML
-
Irrelevant for Languages:C, C++, Objective-C
This rule allows the definition of custom rules using XPath expressions.
Issues are created depending on the return value of the XPath expression. If the XPath expression returns:
- a single or list of AST nodes, then a line issue with the given message is created for each node
- a boolean, then a file issue with the given message is created only if the boolean is true
- anything else, no issue is created
Here is an example of an XPath expression to log an issue on each 'td' tag using the 'nowrap' deprecated attribute:
//td[@nowrap]
- is implemented by
-
CPP-707 Create Objective-C rules repository containing targeted rules
-
- Closed
-
- is related to
-
RULEAPI-248 Mark XPath rule deprecated
-
- Closed
-
- relates to
-
SONARCOBOL-1243 Deprecate the XPath rule template
-
- Closed
-
1.
|
PL/SQL | RSPEC-2423 |
|
Active | Unassigned | |
2.
|
C-Family | RSPEC-2900 |
|
Active | Unassigned | |
3.
|
Java | RSPEC-2993 |
|
Active | Unassigned | |
4.
|
Cobol | RSPEC-2994 |
|
Active | Unassigned | |
5.
|
XML | RSPEC-3089 |
|
Active | Unassigned | |
6.
|
Flex | RSPEC-3293 |
|
Active | Unassigned | |
7.
|
PL/I | RSPEC-3311 |
|
Active | Unassigned | |
8.
|
Python | RSPEC-4010 |
|
Deprecated | Unassigned |