Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How fix all check style issues with Intellij Idea?

I have an xml configuration file for maven checkstyle plugin. I have installed Intellij Idea plugin and see all checkstyle violation. Is there a way to fix most of them automatically? For example auto formatting setting? Is there a way to setup Intellij Idea to autoformat from checktyle config file?

like image 528
Cherry Avatar asked Nov 13 '13 11:11

Cherry


People also ask

How do I fix Checkstyle issues in IntelliJ?

There are two ways: Right click on the java file in Package Explorer or whatever, and select 'Apply Checkstyle Corrections'. Click on the error in the problems view, and select 'Quick fix'. This corrects the problem.

How do I ignore Checkstyle errors in IntelliJ?

Disable an inspection in the settingsIn the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Inspections. Locate the inspection you want to disable, and clear the checkbox next to it.

How do I fix errors in IntelliJ?

Apply fixes in the Problems tool window icon on the toolbar or in the context menu. You can also press Alt+Enter and select a suitable fix from the popup menu.


1 Answers

There is an option now.

checkstyle-IDEA since 4.24.0 features import of checkstyle config.

Please install CheckStyle-IDEA plugin (http://plugins.jetbrains.com/plugin/1065?pr=idea), it can be found via plug-in repository (Settings|Plugins|Browse repositories). 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. At the end you will see a message "CheckStyle configuration settings were imported to ... scheme".

If you encounter any problems, you can create a new issue for the CheckStyle plug-in here: https://github.com/jshiell/checkstyle-idea/issues. This issue is actually a duplicate of https://github.com/jshiell/checkstyle-idea/issues/126.

CheckStyle plug-in version where the feature is available is 4.24.0

Copied from https://youtrack.jetbrains.com/issue/IDEA-61520#comment=27-1292600. Copied the answer from here

Edit: Quote has been changed for clarity and to meet the current UI design.

like image 146
Ajay Yadav Avatar answered Oct 24 '22 19:10

Ajay Yadav