Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA code format from checkstyle configuration

I've decided to contribute to android maven plugin.

They use quite specific code style format. It will take some time for me to modify IDEA code format rules to satisfy their requirements.

Fortunately there is checkstyle configuration. I've already installed check-style plugin for IDEA and immediately see where my current formatting is wrong.

Unfortunately I didn't find way to import checkstyle configuration into IDEA formatting rules.

I'm interested if it's possible.

like image 717
Eugen Martynov Avatar asked Jan 26 '13 17:01

Eugen Martynov


People also ask

How do I format a code automatically in IntelliJ?

If you choose Code | Reformat Code from the main menu or press Ctrl+Alt+L , IntelliJ IDEA tries to reformat the source code of the specified scope automatically.

What is code formatting?

Source Code Format means a form of computer program, or any portion thereof, written in a programming language employed by computer programmers that must be compiled or otherwise translated before it can be executed by a computer. Sample 1.


1 Answers

finally there is something:

checkstyle-IDEA since 4.24.0 features import of checkstyle config.

A solution is available now:

  1. 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).

  2. Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to.

  3. Click Manage...|Import.., 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

like image 196
helt Avatar answered Sep 19 '22 15:09

helt