Svante Schubert created ODFTOOLKIT-416:
------------------------------------------
Summary: Automated Code Formatting during Compile Time
Key: ODFTOOLKIT-416
URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-416
Project: ODF Toolkit
Issue Type: Improvement
Reporter: Svante Schubert
Assignee: Svante Schubert
Priority: Minor
This automated code formatting feature is only a "fun" feature applicable to
any other project.
Although I am aware that formatting rules are close to a religious topic - I
still can remember the long debates of choosing TABS or SPACES - it might help
a lot if it works correctly.
THE PROBLEM:
Most Java IDEs offer automatic code formatting, unfortunately use different
code style by default.
Sometimes different developers apply automated format to the source code, which
result into "noise" during review in the versioning systems.
When I reviewed yesterday an upcoming patch, I took some time to test an
automated code formatting and would like to get some feed-back and further
suggestions.
I added to the Simple API in the pom.xml the plugin, which is triggered
implicitly during build time by "mvn compile" or "mvn install" or explicitly
via "mvn formatter:format", see as well "mvn formatter:help".
Be aware that a file have to be compiled to trigger the format, so sometimes a
"mvn clean" is helpful.
The Maven plugin is using the Eclipse Java Code formatter, uncertain if the
deployed release is already using the rewritten Code formatter from Eclipse 4.5
(Mars).
For plugin configuration see
http://code.revelc.net/formatter-maven-plugin/examples.html
As format configuration I would like to provoke as little noise as possible and
tested some defaults from the Maven project and installed Eclipse 4.5 to export
the build-in definitions of Java, Eclipse 2.1 and Eclipse 4.5.
NOTE: To download get in Eclipse 4.5 to the configuration via
Windows->Preferences->Java->Code Style->Formatter AND edit the profile to at
least change the name, otherwise the export will not work.
You may find some config files to choose and the adopted pom.xml as patch
attached.
Curious on any feed-back...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)