Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CheckStyle plugin for IDEA - java way of warnings presentation and automatic fixes?

  1. Is it possible to make it present the list of warnings java/spellchecker style as opposed to a old school list of errors with line numbers?
  2. Can it automatically fix things like missed space near '=' etc?

Maybe I need a different plugin, which one then?

like image 519
Nerd Avatar asked Jun 27 '12 15:06

Nerd


People also ask

How do I automatically fix Checkstyle errors?

With Checkstyle Plugin All that remains is to activate the Code cleanup recipe. Activating that recipe in your build file and running rewrite is all you need to do to begin auto-remediating Checkstyle policy violations.

How do I fix Checkstyle warnings in IntelliJ?

Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to. Click on the gear, then 'import scheme', choose "CheckStyle Configuration" and select a corresponding CheckStyle configuration file. Click OK.

What does Checkstyle plugin do?

Checkstyle is a Open Source development tool to help you ensure that your Java code adheres to a set of coding standards. Checkstyle does this by inspecting your Java source code and pointing out items that deviate from a defined set of coding rules.


1 Answers

Try QAPlug - Checkstyle plugin. Then go Analyze - Analyze Code (not the standard Analyze!) then click "..." near Run with chosen profile select a concrete profile and press the import button.

enter image description here

In the next dialog select the checkstyle rules file and then click the OK button. That's it. Just wait for the results. I got something like this.

enter image description here

That plugin has its limitations however. For example, I didn't manage to use a file with suppressions with it.

You can also use the plugin CheckStyle-IDEA which also has good configurations and allows you to use suppressions, custom checks and displays the inspection warnings in the editor immediately, but to apply that you need to set Project Settings - Inspections - CheckStyle - Real-Time Scan in the IDE settins.

enter image description here

enter image description here

Answering the second question, I didn't find any automatical reformat capabilities in these plugins, just checks.

like image 55
Vic Avatar answered Sep 30 '22 06:09

Vic