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

[Kotlin] Support common compiler @Suppress values to suppress issues.

    XMLWordPrintable

    Details

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

      Description

      Feedback from SonarSource community ( kotlin:S1172 Support @Suppress to ignore rules on certain cases ) and stackoverflow ( Mark unused parameters in Kotlin ) state that:

      • Unused parameters annotated with @Suppress("UNUSED_PARAMETER") are intentional and should be part of S1172 exclusions.

      E.g.:

      fun foo(a: Int, @Suppress("UNUSED_PARAMETER") b: Int) = a
      
      @Suppress("UNUSED_PARAMETER")
      fun foo(a: Int,  b: Int) {
        fun bar(c: Int) {}
      }
      
      @Suppress("UNUSED_PARAMETER")
      class Baz {
          fun foo(a: Int,  b: Int) {
              fun bar(c: Int) {}
          }
      }
      

      We should extend the issue filtering mechanism added in SONARSLANG-491 to filter rules by values used by Kotlin compiler:

      Key Sonar key
      UNUSED_PARAMETER kotlin:S1172
      UNUSED_VARIABLE kotlin:S1481
      UNUSED kotlin:S1172 
      UNUSED kotlin:S1481
      TOO_MANY_ARGUMENTS kotlin:S107
      NO_ELSE_IN_WHEN kotlin:S131  rule is not active for Kotlin

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              quentin.jaquier Quentin Jaquier
              Reporter:
              alban.auzeill Alban Auzeill
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: