Idea integrates sonarLint and idea integrates sonarlint
1. Objectives
Idea integrates sonar code check to check your code before submitting the code, instead of submitting the code before checking.
Sonar can detect code quality from the following seven dimensions, and as a developer, it must handle at least the first five code quality problems.
1.Does not comply with code standardsSonar can be standardized and written through code rule detection tools such as PMD, CheckStyle, Findbugs, etc.
2.Potential DefectsSonar can detect potential defects through code rule detection tools such as PMD, CheckStyle, and Findbugs.
3.Poor complexity DistributionFiles, classes, methods, etc. If the complexity is too high, it will be difficult for developers to understand them, and if there is no automated unit test, changes to any component in the program may result in a comprehensive regression test.
4.RepeatedObviously, code containing a large number of copies and pastes in the program is of low quality, and sonar can demonstrate serious duplicates in the source code.
5.Insufficient or excessive commentsWithout comments, the Code may become less readable, especially when personnel changes are inevitable, the readability of the program will be greatly reduced, and too many comments will make the developer spend too much effort on reading the comments, which violates the original intention.
6.Lack of Unit TestsSonar allows you to conveniently calculate and display unit test coverage.
7.Poor DesignSonar can be used to identify loops, display the dependency between packages, classes, and classes, and detect custom architecture rules. sonar can be used to manage third-party jar packages, LCOM4 can be used to detect the application of a single task rule and coupling.
2. Prerequisites
- Sonarqube has been set up.
- JDK 8 Environment)
3. Install the plug-in
Set --> plug-ins to find and install the sonarLint plug-in.After the installation is complete, restart IDEA.
4. configuration items
1) Configure the server
Here is a pop-up window opened in the form of editing. When adding the screen for the first time, you need to add your own sonar platform address,Generally, it is the internal address of the company.
2) Select a project
After the server information is configured, the project information is obtained as follows:
After the configuration is complete, you can see the sonar extension in the lower left corner of the idea in the current project environment:
5. Run
Thank you! Thank you for your patience!