Hi everyone, is there a rule that can detect error...
# ktlint
m
Hi everyone, is there a rule that can detect errors like the following? Say I have a DSL that involves using unary plus operators on strings. Like:
Copy code
createReport {
     + "Some text"
     + "Some more text"
     "More text" // this will not be included because the unary plus operator was accidentally left out
}
Note this code compiles without errors or warnings and there is no IDE warning. Yet, there is a bug because “More text” was not properly included. Is there any rule that can detect things like this, where the unary plus operator is accidentally forgotten?
a
You can create an issue for new rule proposal in detekt github
m
Why detekt and not ktlint?
a
From ktlint point of view this seems to be a fine code(if you consider only styling) but
detekt
checks covers code smell, potential bugs etc etc. But you can create an issue in
ktlint
as well
m
Ah I see, so ktlint is mainly for style bug detekt’s scope includes bugs and code smell as well? interesting
a
Kind of true. Ktlint mostly focuses on issue which doesn't require semantics of code only dealing with the PSI structure while detekt has semantics information as well
But there are few rules in Ktlint as well which does more than styling
m
I see. Thank you for the context