Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Java code Formater and Checkstyle configuration for development

daniilyar edited this page · 6 revisions

Author is Ruslan Dyachenko.

After finishing work under your new check you need format your code with Checkstyle format to avoid error messages while building Checkstyle project with your check.

STEPS:

Formatter
1. Use this formatter which is approximate to origin Checkstyle format. Run Eclipse: Windows — Properties — Java — Code Style — Formatter and import it. Apply formatter on your code.

  • Follow Checkstyle check configuration*
    1. Prerequisite, checkout checkstyle code, instruction is here first point, from this folder you will need suppress.xml, java.header, … .

2.1. Right click on project where you have written your check — Preferences — Checkstyle — ‘Local Check Configurations’ tab — New.

2.2. In opened dialog choose Type – External Configuration File. Write a Name of a new configuration. Browse Location: go to the Checkstyle project folder and choose checkstyle_checks.xml file. Download file and put in profile filesystem path. Press Additional properties… button:

2.3. Press Find unresolved properties button:

2.4. In opened dialog press Yes:

2.5. Now you need to add values for properties.

  • checkstyle.header.file property:
    Press Edit…. In Value text field paste a path to java.header file which is in Checkstyle project folder:

  • checkstyle.importcontrol.file property:
    Press Edit…. In Value text field paste a path to import-control.xml file which is in Checkstyle project folder:

  • checkstyle.suppressions.file property:
    Press Edit…. In Value text field paste a path to suppressions.xml file which is in Checkstyle project folder:

  • translation.severity property:
    Press Edit…. In Value text field write ignore:

2.6. Press Ok and return to the Checkstyle preference page. Choose Main tab, from combo list choose your new configuration. Press Ok:

2.7. Right click on your project — Checkstyle — Activate Checkstyle. Fix all checkstyle warnings.

Something went wrong with that request. Please try again.