IntelliJ Idea Integrated Checkstyle

Source: Internet
Author: User
Tags checkstyle


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.