-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Upgrade to new spotless version for all samples #1443
Conversation
@@ -0,0 +1,9 @@ | |||
root = true | |||
|
|||
[*.{kt,kts}] |
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.
WDYT about commenting why we're adding these exceptions? I'm assuming it's so that the different linters / checkers are in sync?
compileSdk = | ||
libs.versions.compileSdk | ||
.get() | ||
.toInt() |
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 looks a bit overly optimized, are we sure we want this level of formatting?
border = BorderStroke(2.dp, borderColor) | ||
modifier = | ||
modifier | ||
.padding(8.dp), |
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.
Again here, this doesn't look very readable, WDYT?
plugins { | ||
alias(libs.plugins.gradle.versions) | ||
alias(libs.plugins.version.catalog.update) | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.kotlin.android) apply false | ||
alias(libs.plugins.kotlin.parcelize) apply false | ||
alias(libs.plugins.compose) apply false | ||
alias(libs.plugins.spotless) |
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.
One of the issues with Spotless is that it's not compatible with the Gradle configuration cache. This is why it should only be applied using an init script, rather than being part of the project build config.
Following discussion, I thought it'd be helpful to describe the process for identifying and disabling a ktlint rule which is run through spotless. To disable a ktlint rule, you need to know 2 things:
The problem is that running I ran it on the JetLagged source using To disable it, add an entry to BUT WAIT. Spotless is problematic because it doesn't work with configuration caching so you may find that it doesn't pick up the changes in |
Upgrade to version 1.3.1 of Ktlint, migrating to the standard rules where applicable. This change is the result of running the new rules - its large since it hasn't been run in a long time unfortunately.
Two rules disabled as per Compose conventions:
Composable function names, allow them to start with lowercase
Allowing PascalCase naming on constants