Install and use the IntelliJ IDEA development tool plug-in Alibaba Java Coding Guidelines

P3c is an Ali code specification checking tool, the plug-in is developed by the Alibaba P3C project team

This plug-in was officially released by Alibaba at the Hangzhou Yunqi Conference in October 2017

The code is open source on GitHub, GitHub: https://github.com/alibaba/p3c
Introduction article: https://mp.weixin.qq.com/s/IbibsXlWHlM59kfXJqRvZA#rd

Support version number

The minimum supported IDEA version is 14.1 (buildNumber 141.0), and students who use IDEA14 are best upgraded to 14.1.7

The plug-in is packaged based on JDK1.7, so if the JDK version used when IDEA starts is 1.6, it will report an exception of Unsupported major.minor version 51.0.

Ali code development specifications have a great influence on the Internet industry in China. This plug-in is based on the Huangshan version of the PDF, and the specifications on the PDF are converted into plug-ins, which is more conducive to developers to check whether their codes are standardized in their daily work.

Installation method (based on MAC version)

Select Preferences in the IntelliJ IDEA menu, and the following box pops up

Select 1, 2, and 3 marked in the above picture in turn. Because I have already installed it, the third step is to restart the tool. If it is the first installation, the third step shows Install

Finally, click Apply and OK to restart IntelliJ IDEA, and the installation is successful.

How to use

The plug-in supports real-time inspection and manual inspection. If the inspection is checked when submitting, it will be checked when submitting. If there is any non-compliant code, a pop-up prompt will be given. Let's take a look at these functions together.

real-time check

Real-time inspection will check the current file and remind you in the form of highlighting, and supports Quick Fix, and the inspection function is enabled by default. You can turn off the real-time inspection function by selecting a folder or file, right-clicking, and the following dialog box pops up. The following configuration

manual inspection 

Manual inspection is divided into 2 situations, one is to check all the files in the directory, the other is to check a certain file, select it and right-click, a dialog box will pop up, select the encoding protocol scan, as shown in the figure above, after the scan is completed, it will be shown in the figure below Show

submit code review 

Code inspection can also intercept code submission. When we check the option in the picture below, then when submitting, it will check whether the code is not in compliance. A prompt box will pop up, as shown in the figure below:

plug-in portal

Generate entity class GsonFormat plug-in through JSON format data

Guess you like

Origin blog.csdn.net/zanpengfei/article/details/124456262