-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Lint Kotlin examples #3923
Lint Kotlin examples #3923
Conversation
test("testSimple") { | ||
generateHtml("hello") shouldBe "<h1>hello</h1>" | ||
} | ||
class FooTest : |
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.
this doesn't look like a reasonable change, but I don't know ktfmt
default rules. Overall, in the Kotlin ecosystem ktlint
is much more popular than ktfmt
.
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.
This is just the default ktfmt
as there's no configuration. I'm guessing it's better to any formatter in place and we can let which the formatter battle to happen in parallel since it should then be a fairly easy switch.
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.
Then why not use ktlint
(as it is proposed in #3829) provided by KtlintModule
? It will require some changes to the run in the module-independent manner, but it will be easy to do by looking on KtfmtModule
.
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 yeah, it is ktlint
in the issue. I misread that. Forgive me, I am actually dyslexic.
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 worries, let's try ktlint
and see how it looks. Then we can pick the one that looks better.
I noticed KtlintModule
does not have the companion object extends External Module
that the other autoformatters do, making it more annoying to use ad-hoc. We should probably add such an companion external module. KtfmtModule
, ScalafmtModule
, and PalantirFormatModule
can be used as a reference as to how it is done
I think I need to adjust the linter tests bc I've changed the implementation. Or change the default to not see the status code. |
066b120
to
e9724c4
Compare
.editorconfig
Outdated
ktlint_standard_no-wildcard-imports = disabled | ||
ktlint_standard_no-consecutive-blank-lines = disabled | ||
ktlint_standard_final-newline = disabled | ||
ktlint_standard_filename = disabled | ||
ktlint_standard_property-naming = disabled | ||
ktlint_standard_class-naming = disabled | ||
ktlint_standard_no-consecutive-comments = disabled | ||
ktlint_standard_import-ordering = disabled | ||
ktlint_standard_function-naming = disabled | ||
ktlint_standard_backing-property-naming = disabled | ||
ktlint_standard_no-empty-file = disabled |
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.
what is the need for disabling so many defaults?
Also, to have a less of the change in this PR due to re-formatting you can change the default style intellij_idea
(see https://pinterest.github.io/ktlint/latest/rules/configuration-ktlint/#code-style), because Intellij IDEA built-in formatter was used for the majority of Kotlin files in this repo.
There's failures in here because
|
It should be working, it was added quite a time ago in |
@0xnm, yeah, I saw that too about it being added in This is true while directly calling Update: #3966 could fix this |
The reason i disabled all the rules was mostly to just focus on formatting, rather than other linters since thats what our other autoformatters do. I don't mind turning them back on if @0xnm prefers, it would just mean a bit more work to fix up the code to compliance |
#3967 should pull in the latest changes to |
Looks like we need to revert the expected broken ktlint code and ignore it in .editorconfig like for ktfmt test examples. |
|
For now I skipped the |
Your finding is another interesting one. |
@myyk it appears we're not the only one to hit issues https://www.reddit.com/r/Kotlin/comments/1gdlc73/ktlint_alternatives/, but I guess it's the standard so that's not our problem to fix. |
@lihaoyi yeah, I agree. |
Going to call this done and close out the bounty over PayNow |
KtlintModule
Last change I think needed for #3829
Overview:
KtfmtModule
to set the error code when there's changes like is true of the other formatters.example/package.mill
based on similarities with Java/Kotlin.