SonarQube Code Analysis
Summary
This document is for SonarQube code analysis and Pull Request decoration to provide code quality summary. This document will provide overview of SonarQube flow and rules used to analyze code.
Architecture
SonarQube can be accessed from following link http://sonarqube.axonator.com/.
SonarQube is deployed on a t2.small EC2 instance on AWS, packaged by Bitnami version 9.2.4 Community Edition https://bitnami.com/stack/sonarqube/cloud/aws. SonarQube is integrated with Axonator’s Github account.
Following projects are configured on SonarQube:
- ax-app-builder: Angular Project
- ax-app-container: Angular Project
- AXAppBuilder.Server.API: dot Net Project
- AXIdentity.Server.API: dot Net Project
- AXAppContainer.Server.API: dot Net Project
Sonarqube Community Branch Plugin is used to decorate Pull Requests with code analysis. Pull Request created for dev, qa and production base branches provide analysis details. GitHub Actions are triggered whenever there are changes in Pull Requests.
Note: To analyse other branches and projects, refer following doc https://docs.sonarqube.org/latest/analysis/overview/ , make sure to pass sonar.branch.name=BRANCH flag.
Code Analysis
Following metrics are used to check the code quality.
VS Code Setup
Install SonarLint and SonarQube-Rules-Synchroniser in VS Code. Refer the following document to setup SonarLint in VS Code.
Once SonarLint and SonarQube-Rules-Synchroniser setup is done, it will sync settings from SonarQube server and show problems in the code.
References
- http://sonarqube.axonator.com/
- https://docs.sonarqube.org/latest/analysis/github-integration/
- https://github.com/mc1arke/sonarqube-community-branch-plugin
- https://chiamakaikeanyi.dev/how-to-setup-sonarqube-in-vscode/
- https://docs.sonarqube.org/latest/analysis/overview/
- https://marketplace.visualstudio.com/items?itemName=frymak.sonarqube-rules-synchroniser
- https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarlint-vscode
- https://bitnami.com/stack/sonarqube/cloud/aws
0 Comments