David Kubecka
09/17/2024, 9:27 AMfun fetchStandingOrdersAuths(info: RequestOriginInfo, productHashedId: String): CustomerRelevantOperationsResponse =
fetchStandingOrdersAuths(info, setOf(productHashedId))
But once I "annotate" that with context(Raise<ApiError>)
like this
context(Raise<ApiError>)
fun fetchStandingOrdersAuths(info: RequestOriginInfo, productHashedId: String): CustomerRelevantOperationsResponse =
fetchStandingOrdersAuths(info, setOf(productHashedId))
it reports that "First line of body expression fits on same line as function signature (standard:function-signature" rule is violated.David Kubecka
09/17/2024, 12:03 PMnuhkoca
09/18/2024, 4:28 PMktlint
to a composite builds? ideally build-logic
Rob Elliot
10/06/2024, 4:02 PMPaul Dingemans
10/24/2024, 7:19 PM1.4.0
has been released.
https://github.com/pinterest/ktlint/releases/tag/1.4.0Rahul kumar
10/26/2024, 6:28 AMJohan
10/29/2024, 8:38 PMmax-line-length
set to off
for intellij-idea settings?
https://pinterest.github.io/ktlint/1.4.0/rules/standard/#max-line-length
With 1.4.0, intellij-idea
or max-line-length set to off changes
private fun erReellArbeidssøker(periode: SummertInfotrygdPeriodeDto): Boolean =
periode.aktivitet == InfotrygdAktivitetstype.TILMELDT_SOM_REELL_ARBEIDSSØKER
To a long one-liner, is that as expected?Paul Dingemans
10/29/2024, 8:42 PMRafs
10/30/2024, 10:47 AMRahul kumar
11/03/2024, 10:04 AMSteven Zeck
11/04/2024, 6:48 PM.editorconfig
in Android Studio?David Kubecka
11/05/2024, 12:13 PMDieter Vaesen
11/07/2024, 12:53 PMconfigure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
filter {
exclude { it.file.path.contains("generated") }
}
}
ansman
11/12/2024, 2:12 PMfoo
.bar {
...
}.baz {
...
}
whereas I want to format like this (so that you can remove an operator without affecting the closing }
):
foo
.bar {
...
}
.baz {
...
}
I can disable the "Chain method continuation" rule but then you get no enforcement at all. Has anyone solved the same issue?Piotr Krzemiński
11/29/2024, 11:26 AMJames
12/05/2024, 8:22 AM.
in a chain to be on a newline instead of after )
or }
?
I'm not sure I see a way to do this in Chain method continuationPaul Dingemans
12/05/2024, 8:31 AMwakingrufus
12/08/2024, 4:23 PMatticus
12/20/2024, 11:41 AMclass Test(
val test1: String,
val test2: String, // comment
val test3: String
)
And I received the error: 'A comment in a 'value_parameter_list' is only allowed when placed on a separate line (cannot be auto-corrected).'
I want to write the code like this. How can I disable this rule?Mez Pahlan
12/20/2024, 6:34 PM// Assume that the last allowed character is at the X character on the right X
internal open class OkHttpClientAdapter(private val url: String, private val httpClient: OkHttpClient = OkHttpClient()) : HttpClientAdapter {
... // Some code of no interest.
}
Which, when formatted, turns into this:
// Assume that the last allowed character is at the X character on the right X
internal open class OkHttpClientAdapter(private val url: String, private val httpClient: OkHttpClient = OkHttpClient()) :
HttpClientAdapter {
... // Some code of no interest.
}
I'm using ktlint_code_style = intellij_idea
and would like something that does the following when format:
// Assume that the last allowed character is at the X character on the right X
internal open class OkHttpClientAdapter(
private val url: String,
private val httpClient: OkHttpClient = OkHttpClient(),
) : HttpClientAdapter {
... // Some code of no interest.
}
I can achieve this (sort of) by setting ktlint_standard_class-signature = disabled
along with the code style, but unless I go round and fix all instances of the first formatting I can't benefit from an autofix in any way. It's fine once it is formatted but Ktlint doesn't automatically format in this way. IntelliJ has the ability to do this with the Put parameters on separate lines
autofix and I was wondering if Ktlint could do something similar if it detects the max character count has been exceeded?
In plain words:
• For a class signature.
• Whose character limit has been exceeded.
• Put all parameters on separate lines.
• With the closing class constructor bracket on the next line.
• And ensure the supertype is on the same line as the closing class bracket.
Is there some way I can achieve this via Ktlint? Thanks again for your time 🐱 .Paul Dingemans
12/20/2024, 8:12 PMeygraber
01/02/2025, 5:57 PMdroidrcc
02/14/2025, 5:50 PMif (something == ABC
) {
...
} else {
...
}
) {
should be on the same line of the if statement...
if (something == ABC) {
Do you have any insight?andrew
02/20/2025, 1:58 AM.editorconfig
changes when using spotless?Blaž Vantur
02/20/2025, 9:00 AMmax_line_length
for specific methods that are Annotated with @Test
?
We are using back ticks for naming and we like having our names descriptive. But because of that the line length always exceed our defined limit for max_line_length
. Is there a way to ignore it in some other global way without a need of adding suppress annotation directly where it happens?Aditya Bhaskar
03/03/2025, 12:45 PMktlint
related)
Does anyone know of any migration notes or discussions when updating to 5.0.x
of Kotlinter-gradle?
I just made the update and the lintKotlin
task is throwing 100s of lint errors. I’ve confirmed it’s not a ktlint issue by changing the ktlintVersion
to previously working version.
The release notes don’t suggest anything that could impact this.
I have a feeling that the .editorconfig
is not being used.
As an example, one frequent error is due to the function-signature
rule saying “First line of body expression fits on same line as function signature”. But that seems to ignore max-line-length
set to 100 in editorconfig.Klitos Kyriacou
03/03/2025, 6:25 PMMalte
03/27/2025, 7:49 AMelse
branch for when
that have an enum as subject? i.e. i want to make ktlint recognize when(someEnum) {else -> … }
- and raise an issue of coursezt
04/10/2025, 11:07 PMpublic class Hook(public override val replyUserData: Long) : MpvEvent, Reply
into this
public class Hook(public override val replyUserData: Long) :
MpvEvent,
Reply
I cannot figure out what rule is doing this. There really should be an easier way to just quickly see a list of violations in the IDEKlitos Kyriacou
05/02/2025, 2:24 PM[standard:import-ordering]
if I have 100 imports and the 50th one is out of order, it gives the message "Imports must be ordered in lexicographic order" at the start of the first line of import. It would be very useful if it put the message on the first line that was out of order.