question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide explicit support for Groovy source code

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:22 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
fvghcommented, Feb 20, 2017

Hi. I am unfortunately also not a groovy expert. Actually I just wanted to know more about gradle, so I also had a look at Groovy. When I started to write my first dummy plugins, I searched for a better way to format code automatically (still used ANT…), so I found spotless and try to learn from its source how to write gradle plugins. Since I found the p2.asmaven provided by @nedtwigg fascinating, I started to write a formatter step using the GrEclipse plugin. Anyhow, I am cleaning up my prove-of-concept and committing it step by step to my fork. Maybe (with some help 😉 ) I can manage to push it to a usable state within a few week(end)s.

0reactions
nedtwiggcommented, May 12, 2017

Travis is working again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Groovy Language Documentation
provides the ability to statically type check and statically compile your code for robustness and performance. supports Domain-Specific Languages and other ...
Read more >
Style guide - The Apache Groovy programming language
Groovy provides native syntax constructs for data structures like lists, maps, regex, or ranges of values. Make sure to leverage them in your...
Read more >
Groovy reference documentation
This chapter covers the operators of the Groovy programming language. 1.2.1. Arithmetic operators. Groovy supports the usual familiar arithmetic operators you ...
Read more >
Object orientation - The Apache Groovy programming language
Inheritance in Groovy resembles inheritance in Java. It provides a mechanism for a child class (or subclass) to reuse code or properties from...
Read more >
Syntax - The Apache Groovy programming language
In addition, Groovy supports Runtime Groovydoc since 3.0.0, i.e. Groovydoc ... provided you have installed the Groovy distribution and the groovy command is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found