Formatting rules

I’ve done a little PR and I’ve been asked to apply formatting rules.
The problem is that I haven’t been able to find any definition of formatting rules and I use IntelliJ and without a definition file I can’t use the Eclipse formatting plugin.
Any help? Someone that is not using Eclipse?

The style has not yet been recreated for IntelliJ unfortunately.
It seems to be a straight forward process however (if you for install Eclipse for a short moment, at least):

https://blog.jetbrains.com/idea/2014/01/intellij-idea-13-importing-code-formatter-settings-from-eclipse/

We can then import that style into the repository for everyone to use.

No, I’ve no problem is using eclipse formatting rules.
There is a plugin named Eclipse Formatter that does exactly the same formatting as internally uses eclipse code.
I’ve used it in successfully in several projects, but the problem is that I haven’t found where are the formatting rules that the project uses (the eclipse ones)
About the default importer in my experience is not a good solution, because it’s not 100% perfect and produces some differences.

They are setup by eclipse oomph and embedded in the .setup file as far as I know :confused:

It will be nice to have them clearly exported as an xml file that can be imported in IntelliJ or used in a maven plugin

1 Like

openHAB2.setup is xml, so maybe you can doing something with it?

openHAB core was just recently moved over back from Eclipse. And Eclipse never had any intention to support IntelliJ (naturally). That might change only now. That’s why I said, export the style from Eclipse, import it into IntelliJ and provide us with the style file. We would then add it to the repo.

Here you go :smile: openHAB_formatter.xml (33.4 KB)

(Or if you would have an openHAB eclipse installation you can export the formatter rules).

3 Likes

Thanks hilbrand.
It worked well, I double checked installing eclipse. Only there are some differences in imports when ussing eclipse formatting plugin.

I think that will be nice to have that file in the repository as it is very convenient for not eclipse users.
Also in a future is desired formatting could be enforced in maven build using a plugin