-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply Scalafmt to examples/
in CI
#3903
Conversation
Looks great as a first pass, some config tweaks would allow us to include the |
This comment was marked as outdated.
This comment was marked as outdated.
@myyk ah that's the parser not liking the Scala 3 syntax used in that file. I think you should be able to just skip those files, or use fileOverride config to tell ScalaFmt to use Scala 3 syntax |
@@ -254,6 +254,7 @@ object TestModuleUtilTests extends TestSuite { | |||
) | |||
) | |||
} | |||
// format: off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this because it keeps fucking up the format inside this function. format didn't seem to turn off on a llne based usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, maybe something to do with the XML literals which are pretty obscure and mayb the formatter doesn't work well with
@lihaoyi I applied all the feedback given. I'm much happier with this version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, CC @lefou in case you want to review this before we merge it
* [x] Need to merge #3903 first because it's built directly on top of it to reduce conflicts. Change 2/3 for #3829 * I updated the `PalantirFormatModule.scala` so that it didn't create a ton of noise when there's actually no issues such as no java code changing. I think this is a good thing to do, but I'm not 100% since some users might feel this change in some way. * Bugfix: The Github Action now fails on any error instead of only `./mill -i __.fix --check` (was using `;` instead of `&&`) * Added Palantir formatting into the Github Action * Removed a lot of cruft so that the example java modules could use the `PalantirFormatModule`. --------- Co-authored-by: Li Haoyi <haoyi.sg@gmail.com>
Partially completes: #3829
Tested locally by breaking format of
example/scalalib/basic/1-simple/foo/src/Foo.scala
by just adding a bunch of spaces../mill mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources
failure../mill mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources
Used
// format: off
rather than changing docstrings.style = keep to our.scalafmt.conf
since that would affect all files. There doesn't seem to be a built in way in ScalaFmt to have folder level configs or something like this. I thought it might be better to not haveexample
be an exception cases if we can avoid it. I'm not sure if the// format: off
comments break something else though.