Search code examples
objective-cswiftsonarqubesonar-runnersonarqube-scan

Analyze iOS/Swift mobile apps with SonarQube


Well, in my company we develop some projects with some languages. Now we are migrating all from SVN to GitLab and we started to use Jenkins and SonarQube with Ubuntu Server for CI.

All is fine with Java projects (everything runs with linux slaves), but now we wanna use SonarQube to analyze app with Objective-C and Swift.

To analyze the projects (mobile apps) we gonna buy the developer edition to use Swift and Objective-C plugins (open source plugins are discarded).

So, my question is, we need to move SonarQube from Ubuntu to Mac? Or is possible to analyze with Mac slave?

By the way, I read all plugins documentation but don's say anything about that.

Thanks!!


Solution

  • You can host SonarQube on whatever platform you like because it's a Java application. Similarly, you can analyze most languages wherever you'd like because analysis for most languages is handled with Java too. This is certainly the case for Swift; anywhere you can use Java, you can run analysis.

    For Objective-C, you need first to build your code using the Build Wrapper before you run the analysis. The Build Wrapper is written in C++ but compiled for Windows, Linux and Mac, so you can essentially run it wherever you like. That means that your only real constraint is the platform required to compile your C, C++, or Objective-C code.

    Explicitly, you can run analysis on a slave of any flavor, and specifically on a Mac one. Analysis will produce a report, which will be submitted to the server, queued and handled in the order in which it was received.

    N.B. Because this is hinted at in your question, I want to make a specific expansion: Where you analyze your code should have no bearing on where your SonarQube instance is hosted. In particular, it's not a good idea to run analysis on the same machine that hosts your SonarQube instance. You should really have at least three servers: one for SonarQube, one for the database, and one for Jenkins. For more on that, see the docs.