Sonarqube 8.6 Scanning React-native gradle project

I am using sonarqube 8.6 developer edition, and I would like to scan a project containing react-native code which outputs both iOS and Android Apps (android app is generated via gradle), I am facing a couple of problems:

  1. How can I integrate sonarqube to after a specific task only in config?
  2. right now I am able to scan swift code and react native (Javascript) indepent to the gradle scan, is it possible to join them both under the same project?

Hi @Shay_Gold ,

See Task dependencies for Gradle sonar scanner. Example:

// build.gradle
project.tasks["sonarqube"].dependsOn "anotherTask"

Yes, it is possible, but you’ll need to experiment with defining the source.sources and sonar.tests analysis parameters. Suppose Gradle owns the scan process, then take a look at this post:

sonarqube {
  properties {
    property 'sonar.sources', 'src/main/java,src/main/webapp'
    property 'sonar.tests', 'src/test/java,src/frontend/test'

You may need to ensure the scope of your folders/files are within the right directory if you intend on the the Gradle scanner “owning” the scan process.

Alternatively, assuming you only have Swift and not Objective-C code (if you do, then you’ll need to use the build-wrapper), you could go the opposite direction and scan the entire project with just the pure Sonar scanner CLI and make sure to define the and etc. parameters (see Java analysis parameters for more details).