spotless icon indicating copy to clipboard operation
spotless copied to clipboard

ScalaFmt takes filepath into consideration.

Open SimY4 opened this issue 2 years ago • 1 comments

ScalaFmt extension takes the file path into account to get the fileOverride scalafmt.conf section to work correctly.

SimY4 avatar Oct 10 '23 04:10 SimY4

Looks like this breaks the integration tests, not sure why.

nedtwigg avatar Oct 29 '23 17:10 nedtwigg

@nedtwigg took me almost a year to come back to it finally. I figured it out.

ScalaFmt treats certain files specially, i.e. .scala files are treated as source files and .sc files are treated and worksheets or ammonite shell scripts. What's relevant for spotless is that they have a slightly different syntax rules and therefore they can be formatted slightly differently.

Once I've started feeding real file path into scalafmt, this difference become apparent. In maven test suite there's a test that checks whether .scala and .sc files can be formatted but the check assumed that they both would be formatted the same way. And that was no longer the case.

SimY4 avatar May 23 '24 04:05 SimY4

Thanks for coming back!

nedtwigg avatar May 23 '24 07:05 nedtwigg

lol after all that I delete the actual fix, lol. Thanks for checking and fixing!

nedtwigg avatar May 23 '24 17:05 nedtwigg