You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is present in only Kotlin/Kotlin (Gradle) file source sets that I know of with the ktlint formatter.
When a source file is changed, the license doesn't reflect the changes and marks the file as an OK state, which should update the license content if it was changed.
/** * some example of license content here * Copyright (c) 2023*/importkotlin.TODOfunmain(args:Array<String>) {
println(
"we do a little"+"trolling",
)
TODO("this function is a work in progress!")
}
Actual Result
importkotlin.TODOfunmain(args:Array<String>) {
println(
"we do a little"+"trolling",
)
TODO("this function is a work in progress!")
}
Gradle: 7.6 ~ 8.0.1
Spotless: 6.14.0 ~ 6.16.0
Operating System (from uname -a): Linux [redacted] 6.1.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 14 Feb 2023 22:08:08 +0000 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered:
A workaround is to move the licenseHeaderFile to the bottom of the kotlin block. But this indicates a deeper bug where the ktlint integration is violating Spotless' composability contract. Thanks for reporting, this is a medium-deal bug in the ktlint formatter which we will definitely fix.
nedtwigg
changed the title
License(s) not being updated in Kotlin / Kotlin Gradle files
ktlint appears to be reading from the File not the StringFeb 28, 2023
This issue is present in only Kotlin/Kotlin (Gradle) file source sets that I know of with the ktlint formatter.
When a source file is changed, the license doesn't reflect the changes and marks the file as an OK state, which should update the license content if it was changed.
A reproduction repository can be seen in auguwu/spotless-kotlin/repro. Just run
./gradlew spotlessApply
.Expected Result
Actual Result
uname -a
):Linux [redacted] 6.1.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 14 Feb 2023 22:08:08 +0000 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: