Provide explicit support for Groovy source code

Status Quo

Groovy source code files are not officially supported by Spotless.

You therefore have to hack something together like the following:

format 'groovy', {
    target '**/*.groovy'
    indentWithTabs()
    trimTrailingWhitespace()
    endWithNewline()
    licenseHeaderFile rootProject.file('src/spotless/eclipse-public-license-1.0.java'), "package "

    customReplaceRegex 'class-level Javadoc indentation fix', /^\*/, ' *'
    customReplaceRegex 'nested Javadoc indentation fix', /\t\*/, '\t *'
}

Without the custom regular expressions, Spotless will mangle Javadoc and license header comment blocks.

Proposal

  • Support Groovy scripts as a first-class citizen with built-in support for license headers and Javadoc comment blocks.