Closed Vampire closed 8 months ago
I can not reproduce the problem. In your example the problem is highlighted as "warning" which is really unexpected because the beta version of the plugin shows everything as error.
For me the error is correctly highlighted.
Can you try with code sample below:
class ExtensionContainer
class Foo {
private inline fun <reified T> ExtensionContainer.maybeCreate(name: String): T =
// do not use findByType as then the name-check is missing
// if something is found by name, the cast ensures it is of the correct type
(findByName(name) as T?) ?: create(name)
fun <T> create(name: String): T {
TODO("Not yet implemented")
}
fun findByName(name: String): Any = 42
}
If the sample above still shows the same problem, then please provide your .editorconfig
. The .editorconfig
is used, was:
root = true
[*.{kt,kts}]
# ktlint_code_style = android_studio
# ktlint_code_style = ktlint_official
ktlint_code_style = intellij_idea
ktlint_standard=enabled
# ktlint_experimental=enabled
In your example the problem is highlighted as "warning" which is really unexpected because the beta version of the plugin shows everything as error.
Only if the plugin is enabled. ;-) In that case it was "unconfigured" .
Can you try with code sample below:
Sure, as soon as #399 is resolved, because right now I don't get any findings displayed with beta-5
@Vampire I am assuming this is resolved in 0.20.0
version of the plugin. Please let me know when it is not resolved, so that I can reopen the issue.
On 0.20.0-beta-4 with this code:
The second comment line is highlighted as being wrongly indented with 4 instead of 8 spaces, though the line above is the culprit. Formatting with ktlint correctly fixes it: