Details

    • 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
    • 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

      Description

      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]
      

        Attachments

          Issue Links

          1.
          PL/SQL RSPEC-2423 Language-Specification Active Unassigned
          2.
          C-Family RSPEC-2900 Language-Specification Active Unassigned
          3.
          Java RSPEC-2993 Language-Specification Active Unassigned
          4.
          Cobol RSPEC-2994 Language-Specification Active Unassigned
          5.
          XML RSPEC-3089 Language-Specification Active Unassigned
          6.
          Flex RSPEC-3293 Language-Specification Active Unassigned
          7.
          PL/I RSPEC-3311 Language-Specification Active Unassigned
          8.
          Python RSPEC-4010 Language-Specification Deprecated Unassigned

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                freddy.mallet Freddy Mallet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: