Don’t you mind opening an issue <@U0CP8EBRV>? Appa...
# detekt
g
c
Since test passes, I probably have to implement a repro-project 😞 I miss checkstyle 🙂
g
Yeah having a repro project would be ideal 🙂
c
Ha, interesting, if I remove my config, it works. I mean if I don't use detekt.yml at all
g
Are you on the latest version of Detekt?
c
1.0.0
g
Please go with 1.0.1. Also make sure you’re on Kotlin 1.3. 50
c
1.3.50, it's too new to be used in prod unfortunately
Ok, I verified with 1.0.1 issue is still present, both with Kotlin 1.3.41 and 1.3.50. I also found out why it "works" without my config. That's only because I have 0 permitted issues in it, in fact the import warning is still issues without config it just does not fail the check.
g
The only way to circumvent this problem I’ve found is to disable the check completely:
Please note that you are mixing up two rules:
NoWildcardImports
and
WildcardImport
NoWildcardImports
is a
style
rule and a wrap of a KtLint rule. Documentation of the rule is here: https://arturbosch.github.io/detekt/formatting.html#nowildcardimports
c
Aren't they supposed to go together?
g
WildcardImport
is a
formatting
rule from Detekt. Documentation is here: https://arturbosch.github.io/detekt/style.html#wildcardimport
c
That's quite counterintuitive. So basically if I want to use WildcardImport rule I have to disable NoWildcardImports rule?
g
They’re independent. You can use either one or the other or both.
c
If
NoWildcardImports
is not disabled
WildcardImport
exclusions are completely ignored by detekt and it is failing
NoWildcardImports
check on
java.util.*
That is why test passes, it checks
WildcardImport
in isolation
g
🤔 Looking at the code of the two rules, I don’t see any connections between the two
c
and that's exactly the problem,
NoWildcardImport
effectively tramples
WildcardImport
Maybe it's more of a documentation issue, it should be stated somewhere, that it does not matter what exclusions are configured for the latter, if the former is enabled. If one needs more permissive check,
NoWildcardImport
should be disabled and
WildcardImport
may then do the checking according to its configuration
g
I see your point. I think the confusion arise from the fact that Detekt wraps over KtLint and the ktlint rule (
NoWildcardImport
) is not configurable.
Anyway I edited my messages above with links to the documentation 👍
s
@Czar thanks for submitting the PR