Boost Code Quality with SonarLint, SonarQube, and Alibaba Code Style Plugin
This guide walks you through installing and using SonarLint for on‑the‑fly code smell detection, setting up SonarQube as a centralized quality platform, integrating it with Maven via the sonar‑maven‑plugin, and applying Alibaba's coding standards to achieve measurable improvements in code health.
1. SonarLint
SonarLint is a code‑quality inspection plugin that helps detect code smells directly in the IDE.
Download and install the plugin, then right‑click a file or project and choose Analyze → Analyze with SonarLint , or select files/directories and use the menu Analyze → Analyze with SonarLint .
You can also disable specific rules.
When custom rules need to be synchronized, bind SonarLint to a SonarQube server.
2. SonarQube
SonarQube is an open‑source code‑quality management platform.
Download, unzip, and start the server:
unzip sonarqube-7.7.zip
cd sonarqube-7.7
bin/[OS]/sonar.sh consoleAfter a successful start, open http://localhost:9000 and log in with the default admin credentials (admin/admin).
To send analysis results to the server, configure a SonarQube Scanner. Add the sonar-maven-plugin to your Maven pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
</plugins>
</build>Run the analysis with: mvn clean compile sonar:sonar Successful execution shows analysis results in the SonarQube web UI.
3. Alibaba Code Style Plugin
Alibaba’s coding standards are widely used. The plugin enforces these rules, helping to keep code consistent and clean.
4. Documentation
For further details, refer to the official documentation:
SonarQube Home
SonarSource Community Edition
SonarLint
SonarQube Setup Overview
Maven Scanner Examples
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
