How to fix all design problems in Intellij Idea?

I have an xml configuration file for the maven checkstyle plugin. I installed the Intellij Idea plugin and see all the checkstyle violations. Is there a way to fix most of them automatically? For example, setting automatic formatting? Is there a way to configure Intellij Idea in autoformat from the checktyle configuration file?

+6
source share
2 answers

Now there is an option.

checkstyle-IDEA since 4.24.0 contains the import of the checkstyle configuration.

Please install the CheckStyle-IDEA plugin ( http://plugins.jetbrains.com/plugin/1065?pr=idea ), it can be found through the repository plugin (Settings | Plugins | Repository overview). Go to Options | Editor | Code Style, select the code style that you want to import CheckStyle Configuration for. Click Manage ... | Import .., select "CheckStyle Configuration" and select the appropriate CheckStyle configuration file. Click OK. At the end you will see the message "CheckStyle configuration settings were imported into ... schema."

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

The version of the CheckStyle plugin where this function is available is 4.24.0

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

+2
source

I have the same problem. As far as I know, the rules used for reformatting cannot be imported from the Checkstyle configuration. You can configure the Checkstyle rules in the Idea code style configuration (File -> Settings -> Code Style) , and then reformat the code (Code -> Reformat Code [Ctrl+Alt+L]) according to the rules (you can apply it to the whole code base right away).

0
source

Source: https://habr.com/ru/post/957985/


All Articles