-
Notifications
You must be signed in to change notification settings - Fork 926
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
Reformat Kotlin code to upgrade ktlint
version
#4488
Conversation
Codecov ReportBase: 74.05% // Head: 74.03% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #4488 +/- ##
============================================
- Coverage 74.05% 74.03% -0.02%
+ Complexity 18167 18159 -8
============================================
Files 1536 1536
Lines 67378 67380 +2
Branches 8520 8520
============================================
- Hits 49894 49885 -9
- Misses 13412 13423 +11
Partials 4072 4072
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
line-gradle-script
updatektlint
version
@minwoox @ikhoon @jrhee17 |
Thanks for updating it. 😄
We use git-subrepo.
|
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.
Thanks!! 🙇♂️
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! Left a minor question. Thanks for the cleanup @ks-yim 🙇 👍 🙇
@@ -27,7 +25,7 @@ configure(projectsWithFlags('kotlin')) { | |||
disabledRules = ["import-ordering"] | |||
|
|||
filter { | |||
exclude("**/gen-src/**") | |||
exclude { it.file.path.contains("gen-src/") } |
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.
Minor Question) What kind of patterns does the updated rule filter as opposed to the original pattern?
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.
Not sure of the exact reason but the project I've recently setup won't build well without adding this directive.
It tries to lint the files in project-root/gen-src/main/kotlinGrpc/*
.
The ktlint
plugin states that this can happen for dynamically attaches sources that are located outside the project dir (ref. https://github.com/JLLeitschuh/ktlint-gradle#faq).
I will make a reproducer and share it here.
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.
That's interesting. Thanks for fixing it. 😄
I will make a reproducer and share it here.
Because it's obvious and the link clearly explains the limit, I think we don't need to check the reproducer unless you really want to share. 😆
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.
@jrhee17 @minwoox
Sorry I was late 😅. Made a reproducer at https://github.com/ks-yim/gradle-scripts-grpc-kotlin-ktlint-error-reproducer.
The build fails with the following error.
> Task :grpc-app:compileJava
Note: /Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/java/com/google/protobuf/compiler/PluginProtos.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :grpc-app:ktlintMainSourceSetCheck FAILED
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:1:1 object HelloServiceGrpcKt should be declared in a file named HelloServiceGrpcKt.kt (cannot be auto-corrected) (filename)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:27:1 Unexpected indentation (2) (should be 4) (indent)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:29:1 Unexpected indentation (2) (should be 4) (indent)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:30:1 Unexpected indentation (2) (should be 4) (indent)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:31:1 Unexpected indentation (4) (should be 8) (indent)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:33:1 Unexpected indentation (2) (should be 4) (indent)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:34:1 Unexpected indentation (4) (should be 8) (indent)
/Users/ks-yim/IdeaProjects/gradle-scripts-ktlint/grpc-app/gen-src/main/kotlinGrpc/HelloGrpcKt.kt:35:1 Unexpected indentation (4) (should be 8) (indent)
...
line/gradle-scripts#134 |
subrepo: subdir: "gradle/scripts" merged: "10ef4cfa8" upstream: origin: "https://github.com/line/gradle-scripts" branch: "master" commit: "10ef4cfa8" git-subrepo: version: "0.4.5" origin: "https://github.com/ingydotnet/git-subrepo" commit: "dbb99be"
@minwoox It looks like the original parent SHA in |
@ks-yim, thanks soooooo much! 😄 |
Motivation:
To upgrade
ktlint
version from0.36.0
toktlint-gradle
plugin's default (0.43.2
).Armeria's some kotlin code violates the new
ktlint
version's default ruleset, especially, when it comes to adding newlines.Modifications:
./gradlew ktlintFormat
task once.