spotless icon indicating copy to clipboard operation
spotless copied to clipboard

` removeSemicolons()` should not be applied to multiline strings in groovy

Open AlexeyKuznetsov-DD opened this issue 3 weeks ago • 2 comments

I have Groovy code like this:

        '''
          function (doc, meta) {
             if (doc._class == "springdata.Doc") {
               emit(meta.id, null);
             }
          }
        '''.stripIndent()

and when I use removeSemicolons() with my spotless Gradle plugin it removes ; for emit(meta.id, null);

That is not expected. Is that possible to fix?

AlexeyKuznetsov-DD avatar Dec 04 '25 17:12 AlexeyKuznetsov-DD

Yeah, this should be fixed.

Goooler avatar Dec 05 '25 01:12 Goooler

It also remove ; from comments :) kind of not expected too...

AlexeyKuznetsov-DD avatar Dec 05 '25 01:12 AlexeyKuznetsov-DD

Thanks for the detailed report given.


This seems to fix the issue:

  • https://github.com/diffplug/spotless/pull/2792

Pankraz76 avatar Dec 17 '25 10:12 Pankraz76

Thanks! Will test once it will be released.

AlexeyKuznetsov-DD avatar Dec 17 '25 18:12 AlexeyKuznetsov-DD