-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Specify exact files to process in ktlint run #4201
Conversation
Thanks! |
): Command[Unit] = Task.Command { | ||
ktlintAction( | ||
KtlintArgs(format = false, check = check.value), | ||
KtlintArgs(format = false, check = false), |
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.
Just a guess, but isn't this a typo? Shouldn't this be
KtlintArgs(format = false, check = true),
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.
good catch, it is a copy-paste typo here. #4247
): Command[Unit] = Task.Command { | ||
ktlintAction( | ||
KtlintArgs(format = true, check = check.value), | ||
KtlintArgs(format = true, check = true), |
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.
Just a guess, but isn't this a typo? Shouldn't this be
KtlintArgs(format = true, check = false),
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.
no, because check
flag controls exit code handling (see
mill/kotlinlib/src/mill/kotlinlib/ktlint/KtlintModule.scala
Lines 136 to 140 in d2df820
if (ktlintArgs.check) { | |
throw new RuntimeException(s"ktlint exited abnormally with exit code = $exitCode") | |
} else { | |
ctx.log.error(s"ktlint exited abnormally with exit code = $exitCode") | |
} |
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.
Oh, I see, cool, thank :)
Fix small typo made in #4201 - `checkFormalAll` task should fail in case of formatting violations. Co-authored-by: 0xnm <[email protected]>
This PR improves
ktlint
support: it explicitly specifies the files to process.Without that current
mill.kotlinlib.ktlint.KtlintModule/checkFormatAll
run, for example, will go through the files under theout
folder, which is useless and pollutes logs.Also this PR removes redundant flags from
reformatAll
andcheckFormatAll
: former will always be withformat=true
by definition, the latter will always be withformat=false
.