SonarQube Cloud
SonarQube Cloud analyses code for issues such as bugs, vulnerabilities, code smells, and duplication. At CRUK, it is enabled on onboarded repositories and reports analysis results on pull requests. Use its findings as another source of feedback alongside tests and code review.
Access
Sign in to SonarQube Cloud using SSO. You must be added to the organisation and have access to the relevant project.
If you are a CRUK user and need access to an onboarded project, raise a work request and post the ticket number in #ask-sonarqube-admins. External users should contact their CRUK Contract Manager and confirm that they are in the appropriate Entra ID group.
Using SonarQube Cloud in a pull request
- Wait for the SonarQube analysis check to complete, then open its results from the pull request.
- Review findings on the changed code. Fix genuine issues as part of the change, prioritising security vulnerabilities and bugs.
- Use your judgement when reviewing code smells and duplication. A finding is a prompt to review the code, not proof that the implementation is incorrect.
- If a finding appears to be a false positive, or an analysis rule does not fit the repository, discuss it with your team and ask in
#ask-sonarqube-admins. Include the repository, pull request, finding or rule, and relevant file paths.
Do not ignore findings because a check is currently non-blocking. The quality gate and branch protection configuration can differ between repositories and may change over time. Do not bypass a failing check or change shared rules to get a pull request merged; work with your team and the SonarQube admins to resolve it.
Security findings may be subject to centrally managed evaluation rules. Review and address vulnerabilities rather than dismissing them solely to pass a quality gate. If you believe a security finding is incorrect, raise the specific rule and finding with your team and the admins.
Analysis problems
An analysis failure means SonarQube could not complete its scan; a failed quality gate means the scan completed and reported findings that did not meet the repository's configured criteria.
If the analysis is still pending or appears stuck, check the pull request's check details and GitHub Actions run before retrying. If SonarQube says the project does not exist or you do not have access, confirm that the repository is onboarded and that you have project access. If the issue remains unresolved, ask in #ask-sonarqube-admins with the repository, pull request, check status, and any relevant error message. Avoid including secrets or sensitive data in the channel.
If a repository is not available in SonarQube Cloud, discuss onboarding with the admins. Internal or external user-facing services recorded as production services should be onboarded. Discuss other potential candidates with the admins.
Requests to exclude files or change how a repository is analysed should also go through #ask-sonarqube-admins. Include the paths and a brief explanation; do not make exclusions or suppressions just to clear a quality gate.
Coverage
Coverage is useful when it reflects meaningful tests, but a percentage alone does not demonstrate test quality. Do not add tests that do not verify behaviour just to increase a metric. Check your repository's configured coverage expectations and discuss thresholds with your team.
IDE integration
SonarQube's IDE tooling can provide feedback while you work. See the SonarQube for IDE documentation for supported editors and setup options. IDE findings complement, but do not replace, the analysis results in your pull request.
References & Further Reading
- SonarQube Cloud documentation
#ask-sonarqube-adminson Slack for access, onboarding, analysis configuration, and troubleshooting