SonarCloud with ReactNative Android & iOS

Hello,

Is there anyway of using SonarCloud with ReactNative Android or iOS in DevOps?

iOS, XCode build is not recognized as MSbuild task.

I’ve tried them on Android and I get:

Task :app:compileDebugAndroidTestRenderscript NO-SOURCE

Task :app:generateDebugAndroidTestBuildConfig

Task :app:generateDebugAndroidTestSources

Task :app:javaPreCompileDebugAndroidTest

Task :app:mainApkListPersistenceDebugAndroidTest

Task :app:generateDebugAndroidTestResValues

Task :app:generateDebugAndroidTestResources

Task :app:mergeDebugAndroidTestResources

Task :app:processDebugAndroidTestResources

Task :app:compileDebugAndroidTestJavaWithJavac

Task :app:generateDebugUnitTestSources

Task :app:preDebugUnitTestBuild

Task :app:javaPreCompileDebugUnitTest

Task :app:compileDebugUnitTestJavaWithJavac NO-SOURCE

Task :app:sonarqube

WARNING: API ‘variant.getJavaCompile()’ is obsolete and has been replaced with ‘variant.getJavaCompileProvider()’.

It will be removed at the end of 2019.

For more information, see Task Configuration Avoidance.

To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.

Task :app:sonarqube FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ‘:app:sonarqube’.

Project was never analyzed. A regular analysis is required before a branch analysis.

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Hi @robertprofeanu and welcome to the community !

So, to get a bit more context, you are trying to :

  • Analyse Java and Obj-C code ?
  • With Azure DevOps Services ?
  • With our extension for Azure DevOps ?
  • How did you configure it if it’s the case ?

Thanks in advance.
Mickaël

Hi @mickaelcaro,

Java code for ReactNative Android and Swift for ReactNative iOS
Yes, we use DevOps and also your extentions from the marketplace

Prepare analysis task -> specified project key, name, organzation etc
Gradle build task, checked Run SonarCloud Analysis
Added sonarcloud in build.gradle version 2.7

Thanks,
Robert

Have you ever analyzed the master branch, or at least, the default branch of your repository ?

Yes, same error.

Is that possible for you to share the Gradle task log, with verbose mode enabled ? I can PM you if you prefer to send it privately.

Thanks.
Mickaël

error.txt (128.0 KB)

attached

thanks,
Robert

Hi Robert,

Did you already create the Project on SonarCloud’s side ? If not, you have to.

Be careful however with project key and project name, if you don’t have override them by providing corresponding sonar.projectKey and sonar.projectName properties, they are deduced from your gradle properties file, and may already be in use.

Thanks.
Mickaël

Hi @mickaelcaro,

The setup is correct in the SonarCloud portal and the keys are also provided in the gradle.properties file.

Can you please provide me an working sample of a reactNative android project?

Thanks,
Robert