SonarQube Code Analysis
SonarQube is an open-source platform that analyzes code quality and detects coding issues like bugs and security vulnerabilities. Using SonarQube with your Unity game ensures a higher standard of code quality, maintainability, and adherence to coding standards.
Before using SonarQube, you must identify the targeted .NET implementation of your Unity game:
- Open the Unity Editor for your game.
- From the Edit menu, select Project Settings and then click Player.
- Under the Player settings, expand the Other Options dropdown.
- Locate Api Compatibility Level in the Configuration section.
Unity supports two scripting runtime versions, .NET Standard and .NET Framework. If the Api Compatibility Level shows:
.Net Standard x.x
where x.x is a version number, it means your target is .NET Core.NET Framework
, means your target is .NET Framework.
Setting up SonarQube
All developers need a Big Fish email address and be granted permission to SonarQube in Okta. If you are unable to access SonarQube's dashboard, contact your Big Fish producer.
To set up SonarQube in your project, expand the instructions for your .NET implementation below:
.NET Framework
To set up SonarQube, your project must contain a .sln
file.
If a .sln
file exists in the project's root directory, no further action is needed. SonarQube will scan your project and upload the scan results to the SonarQube dashboard.
If your project does not contain a .sln
file, generate one using Unity Commands. Once you have a .sln
file, SonarQube will scan your project and upload the scan results to the SonarQube dashboard.
The SonarQube dashboard for your game will be located at the following URL. Replace the placeholder <game-repo-name>
with the correct repository for your game.
https://quality.aristocrat.com/dashboard?id=bfg-<game-repo-name>
.NET Core
To set up SonarQube, your project must contain a .sln
file. However, Unity for .NET Core projects does not support the generation of .sln
files.
To work around this, you will need to maintain your own .sln
file in the root of the game's repository. If the game has multiple projects, organize them in separate folders, create a unified .sln
file at the root level of the directory, and ensure that it references all necessary projects.
Once you have set up the .sln
file, run a scan from SonarQube. It will upload the scan results to the SonarQube dashboard.
The SonarQube dashboard for your game will be located at the following URL. Replace the placeholder <game-repo-name>
with the correct repository for your game.
https://quality.aristocrat.com/dashboard?id=bfg-<game-repo-name>