Colton Idle
04/24/2020, 1:19 AMColton Idle
04/29/2020, 6:42 AMI am proposing to deprecate current IntellijIDEA integration. Problem with it:
- writes IDEA specific configuration xml files that could not be used by other editors
- is detached from used rules and not configurable. Only generic style is written to configuration file.The project readme makes it seem like it is perfect?
. with IntelliJ IDEA
While this is not strictly necessary it makes Intellij IDEA's built-in formatter produce 100% ktlint-compatible codeWorth opening up a bug about the README, or am I misinterpreting something.
Justin Tuchek
05/12/2020, 10:48 PM./ktlint check <git-commit-range>
and returns back an exit code of 0/1 based on the files in the diff. Maybe somebody has a better way for handling this? Or a solution already exist I’m unaware 🤔
Incremental would be great to minimize build impact, running with --format takes ~25 sec. If it was fast enough would consider just leaving it in to catch environments that haven’t set up hooks yet and post a comment on the PRBElluu
06/01/2020, 2:26 PMgradle ktlintCheck
command in Gitlab-CI, which returns some irregularities to me. I fix them and restart CI - again I get linter errors. Can something be done to get linter to display all the irregularities the first time? It is a bit tiring when linter returns warnings in batches.Steff Nicolas
06/08/2020, 10:10 PMPaul Woitaschek
06/09/2020, 10:40 AMimport java.time.LocalDate
import java.time.temporal.ChronoUnit
fun test() {
val lastActive = LocalDate.now()
if (lastActive != null && ChronoUnit.DAYS.between(
lastActive,
LocalDate.now()
) > 30
) {
println("hello")
}
}
And then ktlint complains because it wants to have two less spaces before the argument ChronoUnit.DAYS.between
Can someone confirm this?akshay
07/01/2020, 6:50 AMi.e. create_foo(/* fooParam= */ 1, ...)
Where ktlint should only throw an error for constants.bbaldino
07/08/2020, 4:41 PMExecutorService.submit
(and friends) in favor of our own safeSubmit
since submit
swallows all exceptions by default.rsetkus
07/14/2020, 3:11 PMtapchicoma
07/17/2020, 3:03 PMkhalil
07/31/2020, 11:50 AMktlint
to ktlintFormat
but doesnt work and I got this error xargs: ktlintFormat: No such file or directory
mp
08/03/2020, 10:15 AMkhalil
08/10/2020, 5:46 PM--android
and without on a Android kotlin codejames current
08/31/2020, 9:43 PMno-wildcard-imports
format that I can use to disable certain rules.victorlai
09/10/2020, 10:15 PMsrc/main/resources/META-INF/services/com.pinterest.ktlint.core.RuleSetProvider
file? Would appreciate if there were any recipes I could be pointed to! 🙂nbadal
09/13/2020, 10:35 PMRob Elliot
09/14/2020, 3:45 PMbrandonmcansh
09/18/2020, 5:11 PMRob Elliot
09/22/2020, 9:14 AMfun Configuration.isDeprecated() = this is DeprecatableConfiguration && resolutionAlternatives != null
tasks.register("downloadDependencies") {
doLast {
configurations
.filter { it.isCanBeResolved && !it.isDeprecated() }
.forEach { it.resolve() }
}
}
Idea is I run that task with a network connection, then go offline to run the actual build to prove my build will now run without a network connection.
However, using the org.jlleitschuh.gradle.ktlint
plugin I’m still getting a failure running the offline build on a clean box when it tries to download ktlint:0.36.0
(I’m setting the version explicitly to 0.39.0
).
Does the plugin contribute its dependencies to a configuration that I could resolve up front?danieeh
09/23/2020, 4:31 PMfun interfaces
like I found here.
So I added the maven repository
maven { url "<https://oss.sonatype.org/content/repositories/snapshots>" }
and changed the version to:
ktlint {
version = "1.4-M2-kotlin-dev-SNAPSHOT"
}
is the version correct? thanks in advance 🙂elye
09/24/2020, 3:20 PM./ktlint -F app/src/**/*.kt
from my Android project root directory. All works and it corrected the file format. However it is not following AndroidStudio default rule. So I tried ./ktlint --android applyToIDEA -F app/src/**/*.kt
, but it crashes as below.
Exception in thread "main" picocli.CommandLine$UnmatchedArgumentException: Unknown options: -F, app/src/androidTest/java/com/example/pdfreader/ExampleInstrumentedTest.kt, app/src/main/java/com/example/pdfreader/FileDownloader.kt, app/src/main/java/com/example/pdfreader/MainActivity.kt, app/src/main/java/com/example/pdfreader/PageAdaptor.kt, app/src/main/java/com/example/pdfreader/PageHolder.kt, app/src/main/java/com/example/pdfreader/PdfReader.kt, app/src/test/java/com/example/pdfreader/ExampleUnitTest.kt
at picocli.CommandLine$Interpreter.parse(CommandLine.java:7283)
at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:7357)
at picocli.CommandLine$Interpreter.parse(CommandLine.java:7257)
at picocli.CommandLine$Interpreter.parse(CommandLine.java:7147)
at picocli.CommandLine.parseArgs(CommandLine.java:836)
at com.pinterest.ktlint.Main.main(Main.kt:55)
What did I do wrong? I tried remove the -F
, it is not working as well? I think I might have miss something…. any help? 🙏Colton Idle
09/28/2020, 8:55 PMfilea.kt:266:21: Unexpected indentation (expected 16, actual 20)
fileb.kt:267:17: Unexpected indentation (expected 12, actual 16)
filec.kt:281:21: Unexpected indentation (expected 16, actual 20)
filed.kt:282:17: Unexpected indentation (expected 12, actual 16)
What's the easiest way to resolve all of these?
I'm assuming it either
Opt out
or
Auto format via ./gradlew ktlintFormat
or intellij?
Note: I'm using editorConfig (Not sure if that changes things)
I tried auto formatting view ktlint and via intellij to no avail. Am I missing something?Joao Birk
09/29/2020, 6:04 PMktlint
it tells me that the following import
is not being used therefore I should remove it:
import org.mockito.Mockito.`when` as _when --- THIS LINE IS THE PROBLEM
@Before
@CallSuper
override fun setup() {
super.setup()
_when(...).thenReturn(...)
}
is this a known issue?sreekumar_droid
10/07/2020, 2:48 AMdaniel
10/08/2020, 12:32 PMkotlin_imports_layout
to allow idea and ascii import ordering (so not the whole repo needs to change it’s order but we can still use the idea built in import order)?Giovani Guerra
10/09/2020, 12:28 PMMarek Kubiczek
10/12/2020, 9:17 AMdylangreenuk
10/12/2020, 5:49 PMTextInputLayoutMatchers.kt:3:1: Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end
funny, spotless didnt report the numerous other warnings eg
unexpected indentation (28) (should be 24)
Missing newline before ")"
etc
Slackbot
10/13/2020, 6:07 PMXabier Gorostidi
10/25/2020, 1:29 PMif (records.containsKey(AdvRecord.TYPE_UUID128) && Arrays.equals(
Config.MYOWN_GATT_SERVICE_RAW, // <-- Unexpected indentation (expected 12, actual 16)
AdvRecord.getServiceUUID128(records[AdvRecord.TYPE_UUID128]!!) // <-- Same as above
) // <-- Unexpected indentation (expected 8, actual 12)
) {
...
}
However, if I change manually to the expected result, ktlintFormat
complains about the same lines to be changed into the previous code indentation again. I don't understand anything. What I'm trying to achieve is Android Studio IDE code reformat fits with ktlint criteria, and somehow they're unsynced now. I'm using the latest gradle plugin:
id "org.jlleitschuh.gradle.ktlint" version "9.4.1"
I have even tried to run ktlint --android applyToIDEAProject
to apply project specific code style, but the problem persist. Any idea how to solve this guys?Xabier Gorostidi
10/25/2020, 1:29 PMif (records.containsKey(AdvRecord.TYPE_UUID128) && Arrays.equals(
Config.MYOWN_GATT_SERVICE_RAW, // <-- Unexpected indentation (expected 12, actual 16)
AdvRecord.getServiceUUID128(records[AdvRecord.TYPE_UUID128]!!) // <-- Same as above
) // <-- Unexpected indentation (expected 8, actual 12)
) {
...
}
However, if I change manually to the expected result, ktlintFormat
complains about the same lines to be changed into the previous code indentation again. I don't understand anything. What I'm trying to achieve is Android Studio IDE code reformat fits with ktlint criteria, and somehow they're unsynced now. I'm using the latest gradle plugin:
id "org.jlleitschuh.gradle.ktlint" version "9.4.1"
I have even tried to run ktlint --android applyToIDEAProject
to apply project specific code style, but the problem persist. Any idea how to solve this guys?tapchicoma
10/26/2020, 2:11 PMArrays.equals(
to next line?romtsn
10/26/2020, 6:55 PM/* ktlint-disable parameter-list-wrapping */
... your snippet ...
/* ktlint-enable parameter-list-wrapping */
Xabier Gorostidi
10/27/2020, 11:28 AMArray.equals
remains on the same line, it works. However, moving that statement to the next line, the suppression doesn't affect.