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

[Scala] S1764 should not raise an issue on anonymous function with wildcards

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5
    • Component/s: None
    • Labels:
      None

      Description

      S1764 is raising an issue on the following snippet of Scala code, while in an anonymous function with wildcards in Scala, two wildcards does not refers to the same variable.

      val grades = Map("Kim" -> 90,
           |   "Al" -> 85,
           |   "Melissa" -> 95,
           |   "Emily" -> 91,
           |   "Hannah" -> 92
           | )
      grades.toSeq.sortWith(_._1 < _._1)
      grades.toSeq.sortWith(_._1 > _._1)
      

      Reference:

      Examples on SonarCloud:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quentin.jaquier Quentin Jaquier
                Reporter:
                alexandre.gigleux Alexandre Gigleux
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: