spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Allow spotless greclipse.properties to be selected via configuration

Open Slooz opened this issue 3 years ago • 1 comments

The default formatting configuration of greclipse isn't very standard or desirable. However, spotless configures greclipse.properties in a much more standard way.

For example, compare the default formatting of googleJavaFormat to greclipse. They're very different.

If you Google site:github.com "greclipse.properties", you will find that many projects simply copied this file as defined by spotless.

Instead of having to copy greclipse.properties into every project, it'd be sweet if we could just select this formatting configuration by spotless via configuration, for example:

<greclipse>
  <formatterConfiguration>spotless</file> <!-- default value: eclipse? -->
</greclipse>

EDIT: Unfortunately, I spoke too soon. I didn't realize spotless's greclipse.properties sets the following (I assume for testing):

groovy.formatter.braces.start=next
groovy.formatter.braces.end=same

These settings aren't very typical. I propose the following settings to stay consistent with googleJavaFormat as well as with examples on the Groovy style guide:

groovy.formatter.braces.end=next
groovy.formatter.braces.start=same
groovy.formatter.longListLength=100
groovy.formatter.multiline.indentation=4
groovy.formatter.remove.unnecessary.semicolons=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2

Slooz avatar Jul 27 '21 19:07 Slooz

I'm open to a PR for this. Can't change the default because we don't want to break anyone relying on the default.

nedtwigg avatar Jul 27 '21 20:07 nedtwigg