Transferred from: http://www.cnblogs.com/kiwi-wang/p/4166410.html
This article uses the IntelliJ idea version of 14.0.1, the other versions are not very different and can be installed as well.
Download Install Checkstyle-idea Plugin
There are two ways to install the plug-in, install and install the package online
(1) Online installation
File->setting->plugins to interface, search Checkstyle-idea, click Install.
(2) installation package installation
Unzip the checkstyle-idea-4.10.0.zip in the attachment and copy the Checkstyle-idea file to the Plugins folder in the IntelliJ idea 14.0.1 installation directory.
After the installation is complete, restart IntelliJ idea for the plugin to take effect.
Configure Checkstyle
File->setting->other Setting->checkstyle to interface
Click on the Red box to select the green plus sign to the upper page to add a custom check rule, select My_checks.xml,next,finish in the attachment.
Select the newly added check rule and apply.
Checking files with Checkstyle
In File->setting->editor->checkstyle, select whether to perform a real-time check.
(1) Real-time check, in real-time to the non-standard writing hints, and in the editing page color identification.
(2) After canceling the real-time check, you can right-click on the open file to select Check current file to inspect the present page, in the Checkstyle Scan shown in the non-canonical content, click on the entry to see the corresponding Error statement.
Other
If there are some necessary but do not conform to the inspection rules of the place need to ignore the check can be commented as follows
Csoff:magicnumber
Code snippets that need to be ignored
Cson:magicnumber
Where MagicNumber is a step to check, indicating that the number of magic checks, can be replaced by other inspection steps, such as to ignore the length of the paragraph, you can change the MagicNumber to LineLength.
INTELLIJ Idea Integrated Checkstyle (RPM)