Kotlin source files still not being scanned

SonarLint plugin for IntelliJ Idea processes Kotlin source files just fine, but running ./gradlew sonar and using SonarSource/sonarcloud-github-action in Github Workflow doesn’t index any source files.

For example:

NFO: Preprocessing files...
INFO: 0 languages detected in 0 preprocessed files
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Loading plugins for detected languages
INFO: Load/download plugins
INFO: Load/download plugins (done) | time=0ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=329ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Included sources: **/*.kt
INFO:   Excluded sources: **/build-wrapper-dump.json
INFO: **0 files indexed**


uses: SonarSource/sonarcloud-github-action@master
  GITHUB_TOKEN: ${{ secrets.PAT }}
  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

For reference, project page at SonarCloud.io is here.

I’ve also tried to configure inclusions and language at SonarCloud.io, still not picking up any source code.

Any help would be appreciated. Thanks!

Hello @NorseDreki,

Thanks for teaching out.

As far as I can see, your project is multiplatform, and we only started supporting Kotlin multiplatform recently. So you should use the latest sonar gradle plugin and apply it in your build configuration: Gradle - Plugin: org.sonarqube

Then you will need to run ./gradlew sonar after building your project to get the results. If this is not working, I encourage you to provide the logs and your configuration here.

As for github action, it is not recommended to be used for Gradle/Mave, so if you look here: sonarcloud-github-action/entrypoint.sh at master · SonarSource/sonarcloud-github-action · GitHub, you’ll notice that the action should fail for Gradle. However, you’re able to successfully execute it, because we’re missing the check of build.gradle.kts.

So from your side you should:

  • remove analysis from Github actions
  • add latest sonar Gradle plugin
  • run the analysis after building and running tests of your project
  • get back to us if this scenario is not working

From my side, I’ll report that the build.gradle.kts is not detected by our GitHub action and triggers the analysis.


1 Like

Hello @Margarita_Nedzelska , thank you for getting back.

I’ve migrated my pipeline to use the latest Sonar Gradle Plugin, as you suggested, and it’s working now, source code gets scanned.

Maybe it might be beneficial to leave a note at SonarSource/sonarcloud-github-action’s page on GH Marketplace mentioning Gradle is not fully supported at the moment.

Thank you for your help!

1 Like

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