Share

Jalopy Java Source Code Formatter

Tracker: Feature Requests

5 Allow for alternatives (formatting exceptions) - ID: 1918891
Last Update: Tracker Item Submitted ( mcepek )

I have a need for just a handful of files to be formatted differently than
all the rest of the sources in our project. My fellow team members agree
that it would be best (more readable and maintainable) in this instance to
differ from the project-wide preferences for just these files.

But other than excluding these files entirely from Jalopy, it's not clear
how to accomplish this. In this case there is only one setting that needs
to be different -- all the other project formatting should still be used.

Creating a separate preferences.dat file is a brittle solution, due to the
redundancy/duplication. In this case the separate files would be identical
except for one setting. People would need to remember to edit them both if
one needed to be changed.

I can brainstorm a few possible solutions.

One would be to utilize annotations for formatting exceptions and/or
setting overrides. This seems like the cleanest solution. A new setting
to disallow this could be introduced for shops which do not want to allow
this flexibility.

Another solution would be to allow multiple convention files to be
specified, with latter files superseding the settings in earlier files.
Ideally the convention file format would allow just a subset of settings to
be specified (rather than everything), to mitigate the "brittleness"
concern raised above. It seems this would require multiple Jalopy runs
with the codebase files separated out to use the various convention files.
This is clearly a messier solution for developers to use.

Yet another solution would be to introduce some new syntax into the
convention file for conditional formatting based on filenames, directories,
packages, etc. This may be the easiest to implement.

Regardless of the implementation, the goal would be to permit sets of
"formatting exceptions" to be easily defined and applied to a subset of the
files in a project. Thanks.


MCepek ( mcepek ) - 2008-03-18 22:56

5

Open

None

Nobody/Anonymous

Core

None

Public


Comments

No follow-up comments have been posted.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.