export code style settings

Is there a tool and/or plugin that can export IDEA's Code Style settings for a particular language so that they can be used in an external program such as Uncrustify or AStyle.

Or alternatively how do others solve the issues of maintaining a consistent code style.
1. When not everyone uses IDEA
2. formatting code (or checking format against a standard) as a pre-commit task to VCS
3. format code as a build task (ant, maven, gradle, make, etc.)

thanks in advanced..

3 comments
Comment actions Permalink

Hi, Raleigh!

1. When not everyone uses IDEA
For this purposes, we have a plugin for IntelliJ, which allows you to use Eclipse formatter (https://plugins.jetbrains.com/plugin/6546). Also you could import code style settings directly from Eclipse and IntelliJ formatter engine will be used in such a case(https://blog.jetbrains.com/idea/2014/01/intellij-idea-13-importing-code-formatter-settings-from-eclipse/). If you don't use Eclipse, you can create an issue for desired integration (https://youtrack.jetbrains.com), or create a plugin by yourself.

2. formatting code (or checking format against a standard) as a pre-commit task to VCS
If you use git you could setup pre-commit hook in order to check for code style violations (http://stackoverflow.com/a/9414113). Also plugin could be written to check for code style violations which will be executed before commit in IDE (It will appear in "Before commit" checkboxes in commit dialog). You could ask for such a plugin/integration also in our tracker.

3. Unfortunately IntelliJ formatter is not available as a command line tool, so it is not available to use IntelliJ formatter as a build step for now.

I personally don't know about any tools importing our code style settings, but it's better to check it from tools vendors.

0
Comment actions Permalink

Thanks,
I will open a request in YouTrack, although I'm doubtful it will be worked on.

0
Comment actions Permalink

There is also a third-party Checkstyle-IDEA plugin https://plugins.jetbrains.com/plugin/1065

0

Please sign in to leave a comment.