Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-334

FP due to dynamic code evaluation and string interpolation

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8
    • Component/s: Apex, Ruby, Scala
    • Labels:
      None

      Description

      In some languages, dynamic evaluation is possible.
      Ex:
      Apex

      ...
      Integer col1Value = 100;
      Database.query('SELECT id FROM table1 WHERE col1 = :col1Value');
      // or "search.query" or "search.find"
      ...
      

      Ruby

      x = 1
      eval 'x + 2'
      

      Rules such as unused variable/parameters may yield FP because of these dynamic code evaluation.

      The same applies for string interpolation.

      Rules should be able to ignore part of code (method/functions) when dynamic evaluation is present in order to avoid FP.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              andrei.epure Andrei Epure
              Reporter:
              christophe.zurn Christophe Zurn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: