Hi <@U02R8E8EMGR> in my project we use c++ style b...
# ktlint
a
Hi @Paul Dingemans in my project we use c++ style braces style and to avoid false -ve we have disabled the rule
SpacingAroundCurlyRule
but this rule also handles the violations like below
Copy code
val foo = if(true){0}else{1}
i.e., handling of spaces around
if
. Is there any way to only disable the braces style rule and keep the spacing around
if
and
else
rule intact?
So below code should be compliant
Copy code
if (true)
{
    println("a")
}
else
{
    println("b")
}
but below code should be non-compliant
Copy code
if(true) // notice missing space here
{
    println("a")
}
else
{
    println("b")
}
p
No, not that I know. Neither, will it be supported by a toggle. The guidelines are clear about how to place braces.
a
hmm I am not saying to add a toggle rather suggesting to split the rules into two
w
the "space around if" is also pretty clear in bullet point 3 here: https://kotlinlang.org/docs/coding-conventions.html#horizontal-whitespace
a
Hi @wakingrufus yes I know.. I am suggesting to break the rule into 2 so that any one can disable braces rule while keeping the space around rule active. Currently disabling
SpacingAroundCurly
disables both(we want to disable only one)
p
Splitting the rule might solve part of the problem. But I expect that even when this is done, there will still be other rules for which the same request can/will be made once. For example the function-signature rule also rewrites the opening brace to be on the same line as the end of the signature. Having said that, we should not split this rule into separate rules for this specific reason.
w
Seems like bike shedding at that point :)