Rule kotlin:s125 undetected

  • Operating system: macOS 12.4
  • SonarLint plugin version: org.sonarlint.idea 6.8.0.55884
  • IDE: Intellij IDEA 2021.3.3 (Build #IU-213.7172.25)
  • Kotlin: 213-1.6.21-release-334-IJ6777.52
  • Is connected mode used: no

And a thorough description of the problem / question:
Commented-out Kotlin source code is not detected in Kotlin file.

Source file Main.kt:

fun main(args: Array<String>) {
    println("Hello World!")

//    println("This")
//    println("is")
//    println("commented-out")
//    println("code")
//    println("but")
//    println("undetected")

    // Try adding program arguments via Run/Debug configuration.
    // Learn more about running applications: https://www.jetbrains.com/help/idea/running-applications.html.
    println("Program arguments: ${args.joinToString()}")
}

Log is:

Creating container for module 'Module: 'kotlin_s125_test.test''
Creating container for module 'Module: 'kotlin_s125_test.main''
Trigger: EDITOR_OPEN
[Editor open] 1 file(s) submitted
0 entries removed from the store
Configuring analysis with org.sonarlint.intellij.java.JavaAnalysisConfigurator
Analysing 'Main.kt'...
Starting analysis with configuration:
[
  baseDir: /Users/a309023/src/kotlin_s125_test
  extraProperties: {sonar.java.target=11, sonar.java.source=11, sonar.java.libraries=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/lib/jrt-fs.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.21/eeb4d60d75e9ea9c11200d52974e522793b14fba/kotlin-stdlib-jdk8-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.21/568c1b78a8e17a4f35b31f0a74e2916095ed74c2/kotlin-stdlib-jdk7-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.21/11ef67f1900634fd951bad28c53ec957fabbe5b8/kotlin-stdlib-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.21/5e5b55c26dbc80372a920aef60eb774b714559b8/kotlin-stdlib-common-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar, sonar.java.jdkHome=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home, sonar.java.test.libraries=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/lib/jrt-fs.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.6.21/eeb4d60d75e9ea9c11200d52974e522793b14fba/kotlin-stdlib-jdk8-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.6.21/568c1b78a8e17a4f35b31f0a74e2916095ed74c2/kotlin-stdlib-jdk7-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.21/11ef67f1900634fd951bad28c53ec957fabbe5b8/kotlin-stdlib-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.21/5e5b55c26dbc80372a920aef60eb774b714559b8/kotlin-stdlib-common-1.6.21.jar,/Users/a309023/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar}
  moduleKey: Module: 'kotlin_s125_test.main'
  excludedRules: []
  includedRules: [kotlin:S5867, kotlin:S105]
  ruleParameters: {}
  inputFiles: [
    file:///Users/a309023/src/kotlin_s125_test/src/main/kotlin/Main.kt (UTF-8)
  ]
]

Start analysis
Index files
Language of file 'file:///Users/a309023/src/kotlin_s125_test/src/main/kotlin/Main.kt' is detected to be 'Kotlin'
1 file indexed
'JavaSensor' skipped because there is no related files in the current project
'Ruby Sensor' skipped because there is no related files in the current project
'XML Sensor' skipped because there is no related files in the current project
Execute Sensor: Sonar Secrets Detection Sensor
Execute Sensor: HTML
'Python Sensor' skipped because there is no related files in the current project
Execute Sensor: Kotlin Sensor
Couldn't get a connected engine to sync quality profiles: Project is not bound to a SonarQube project
1 source file to be analyzed
1/1 source file has been analyzed
'PHP sensor' skipped because there is no related files in the current project
'Analyzer for "php.ini" files' skipped because there is no related files in the current project
'JavaScript analysis' skipped because there is no related files in the current project
'TypeScript analysis' skipped because there is no related files in the current project
Done in 1761ms

Processed 0 issues
Found 0 issues

Hello @marcuse7,

Thanks for the report! S125 was disabled a while ago due to performance issues with the rule’s logic. You are completely correct in assuming that this should not be a permanent situation, however.

I have created a ticket to make sure we re-enable this rule while ensuring that it does not impact the performance of the analysis negatively.

1 Like

Is this rule deactivated internally in SonarQube?
Our Developer edition(9.6.0.59041) UI shows as this rule is active but it doesn’t detect any Kotlin violations

Hello @akhilbabuv,

The rule is still present in the UI indeed. It is disabled “behind the scenes” though

It’s better to disable the rule in UI as well to make it transparent.
From the UI, it feels like the RULE is active but doesn’t detect the issues.

1 Like

A small update on this topic. We reworked the rule and re-enabled it. It should now work better than ever and is already available on SonarCloud. It will be available on SonarQube and SonarLint in their next releases.

Thanks for bringing this to our attention. Feel free to open a new thread if you have any feedback on the rule once you have had a chance to use it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.