SonarQube Set Up

There are different ways to set up and use SonarQube, it’s an enterprise level product for analysing source code to maintain code quality.

OppiaMobile Server

We use the sonar-scanner tool on the command line to analyse the Oppia server source code and submit the results to SonarCloud.

First we create the test coverage report, using the Coverage tool, using:

$ coverage erase
$ coverage run --branch --source=activitylog,api,av,content,gamification,integration,oppia,profile,quiz,reports,summary,viz test
$ coverage xml -i

Then copy the generated django-oppia/coverage.xml file into the django-oppia/tests/ directory.

Then we run the sonar-scanner using:

/sonar-scanner \
  -Dsonar.projectKey=django_oppia \
  -Dsonar.organization=alexlittle-github \
  -Dsonar.sources=. \ \
  -Dsonar.login=<login id> \
  -Dsonar.exclusions=docs/_build/**/*,tests/**/*,oppiamobile/ \

If you are running with your own SonarCloud account, you’ll need to use a different projectKey and organisation.

OppiaMobile Android App

The Oppia app source code analysis can be found at:

To run the analysis for the app, from the root of the app code directory, run:

./gradlew sonarqube \
        -Dsonar.organization=alexlittle-github \ \
        -Dsonar.login=<login id>


To be completed - adding the coverage report