Continuous integration/SonarQube Scanner

wmf-sonar-scanner
The Code_Health_Group/projects/Code_Health_Metrics working group maintains an integration with the static analysis code tool, SonarQube.

To use it, run "check experimental" on MediaWiki core or any extension (example). The link to the generated report will be output in the build logs for the "wmf-sonar-scanner" job.

You can read more about in this blog post.

Coming soon:


 * post a comment in gerrit with the link to the SonarQube analysis report
 * ingest code coverage from JS/PHP/Java projects
 * Other ideas: https://phabricator.wikimedia.org/project/view/3621/

Debugging
You can test out the scanner locally, if you have an API key. Then you can execute `/run.sh -X  -Dsonar.host.url= https://sonarcloud.io -Dsonar.organization=wmftest -Dsonar.projectKey=mediawiki-extensions-Examples -Dsonar.projectName=mediawiki-extensions-Examples`

This is useful if you want to make modifications to run.sh and copy them into the container without rebuilding the Docker image.

You can also run the scanner like this:

Sonar Lint
The SonarLint tool is a useful complement to SonarQube, as it runs many of the same checks locally in your IDE.