Play eclipse-Automatic code specification Check tool checkstyle__ static Check tool

Source: Internet
Author: User
Tags naming convention checkstyle

http://blog.csdn.net/jmyue/article/details/11110857


Big projects need to be done by more than one group, but everyone has their own coding habits, and even a lot of them are incorrect. So how do you make all of your team's developers follow certain coding specifications to ensure that your project code style is consistent? It would be a tedious and time-consuming task to require each developer to check their code against the coding specifications before submitting the code. Checkstyle is an open source code analysis tool that can help developers ensure that their code follows certain code specifications. Checkstyle, by constantly checking your code, immediately prompts for violations of defined code specifications so that developers can discover and modify irregular code in a timely fashion. The Checkstyle plug-in in Eclipse is Eclipse-cs. 1. Install Checkstyle plugin

On the Eclipse menu bar, select Help-> Install New Software ... to enter the following installation interface:


Click "Add ..." to open the Add Repository dialog box and click "OK" to enter name and location.
Select the jautodoc you just added and click "Next >" until the installation is complete. 2. Configure Checkstyle

On the Eclipse menu bar, select Window-> Preferences-> Checkstyle to enter the following settings interface:


In the Global Check configurations box, lists the check configurations that you can select (check Configuration), and the default bar, which is marked as the defaults for the tick.

If you want to configure your own check options, you can click the "New ..." button to create a new configuration and enter the following check configuration interface:


Check the type of configuration, you can have a variety of options. The Internal configuration type is to check that the configuration exists within Eclipse, and that the External configuration type is equivalent to importing an existing XML configuration file. The Checkstyle configuration is an XML file.

If you want to modify an existing configuration, you can click the "Configure ..." button to open the Checkstyle Configuration dialog box and modify it as needed. 3. Use of Checkstyle

Checkstyle will constantly check code specifications during code development, including: Javadoc annotation naming convention header Import size white space modifier code class design

Following this code after Checkstyle check, the code does not conform to the specification, the background will be marked as light yellow to hint. Clicking on the cue tag of the wardrobe will show you where the specific specifications are not met. Examples are shown in the following illustration:




Reference

        Checkstyle website
        Checkstyle Eclipse Plugin website

Related Article

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.