-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Autoformat Java examples #3919
Autoformat Java examples #3919
Conversation
example/javalib/linting/2-checkstyle/src/InputWhitespaceCharacters.java
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
a34ac09
to
99194b5
Compare
@lihaoyi I think this one is ready for a review when you get a chance. Update: I'm not sure how to update the linecounts in the failing tests. I'm having trouble understanding how those are run. |
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 great, I think just need to update the test cases and we're good to go
Looks like a bunch of |
So PalantirJavaFormat does not provide any builtin flags to ignore files or folders, instead Mill manages the listing of files to pass to the tool. mill/scalalib/src/mill/javalib/palantirformat/PalantirFormatModule.scala Lines 173 to 181 in 4c05156
So we likely need to add some logic in Mill to allow To do this, I suggest we overload |
I had actually already implemented skipping some files from the .mill side
but I guess I missed something.
…On Sat, Nov 9, 2024, 15:40 Li Haoyi ***@***.***> wrote:
So PalantirJavaFormat does not provide any builtin flags to ignore files
or folders, instead Mill manages the listing of files to pass to the tool.
https://github.com/com-lihaoyi/mill/blob/4c05156ccd8eca733411139b40886af7fcc485dc/scalalib/src/mill/javalib/palantirformat/PalantirFormatModule.scala#L173-L181
So we likely need to add some logic in Mill to allow
PalantirJavaFormatModule to ignore particular globs, and then use that in
Mill's own build (after rebootstrapping) to ignore the files and roll out
enforcement internally.
To do this, I suggest we overload PalantirFormatModule.formatAll to take
an additional optional parameter excludedGlobs: Seq[String]. We can then
plumb those through to the java-file-listing above and use it to ignore
files matching a glob (may need to find a glob-matching implementation
online). We'd need to preserve the current formatAll signature for binary
compatibility, but it can be a dumb forwarder to the new implementation
—
Reply to this email directly, view it on GitHub
<#3919 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAP4ANE3JV22YFYEZLKXVLLZ7W355AVCNFSM6AAAAABRLLUVESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGEYDIMBQGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The glob solution seems like a good way to go but I'm not sure when I can
do it. Kotlin needs a similar mechanism and I think it would be good to
have all the linter modules have roughly the same interface (where
possible) which they don't currently.
…On Sat, Nov 9, 2024, 15:43 Myyk Seok ***@***.***> wrote:
I had actually already implemented skipping some files from the .mill side
but I guess I missed something.
On Sat, Nov 9, 2024, 15:40 Li Haoyi ***@***.***> wrote:
> So PalantirJavaFormat does not provide any builtin flags to ignore files
> or folders, instead Mill manages the listing of files to pass to the tool.
>
>
> https://github.com/com-lihaoyi/mill/blob/4c05156ccd8eca733411139b40886af7fcc485dc/scalalib/src/mill/javalib/palantirformat/PalantirFormatModule.scala#L173-L181
>
> So we likely need to add some logic in Mill to allow
> PalantirJavaFormatModule to ignore particular globs, and then use that
> in Mill's own build (after rebootstrapping) to ignore the files and roll
> out enforcement internally.
>
> To do this, I suggest we overload PalantirFormatModule.formatAll to take
> an additional optional parameter excludedGlobs: Seq[String]. We can then
> plumb those through to the java-file-listing above and use it to ignore
> files matching a glob (may need to find a glob-matching implementation
> online). We'd need to preserve the current formatAll signature for
> binary compatibility, but it can be a dumb forwarder to the new
> implementation
>
> —
> Reply to this email directly, view it on GitHub
> <#3919 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAP4ANE3JV22YFYEZLKXVLLZ7W355AVCNFSM6AAAAABRLLUVESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGEYDIMBQGI>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Ah I just noticed your skipping code in Mill's own build. Not sure why it's not working |
Noticed this issue when working on #3919. Added a test case to the unit tests to cover it
Oh interesting. I see you changed the |
@myyk yeah, previously we only used By re-using the name |
That all makes sense. Oh, I think I fixed some of that in the next change #3923 and didn't back port it because I thought it was working enough in this PR. Sorry about that. But also, I wasn't sure about fully redefining |
examples/
in CI #3903 first because it's built directly on top of it to reduce conflicts.Change 2/3 for #3829
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../mill -i __.fix --check
(was using;
instead of&&
)PalantirFormatModule
.