Thread
#detekt
    gammax

    gammax

    3 years ago
    Czar

    Czar

    3 years ago
    Since test passes, I probably have to implement a repro-project 😞 I miss checkstyle 🙂
    gammax

    gammax

    3 years ago
    Yeah having a repro project would be ideal 🙂
    Czar

    Czar

    3 years ago
    Ha, interesting, if I remove my config, it works. I mean if I don't use detekt.yml at all
    gammax

    gammax

    3 years ago
    Are you on the latest version of Detekt?
    Czar

    Czar

    3 years ago
    1.0.0
    gammax

    gammax

    3 years ago
    Please go with 1.0.1. Also make sure you’re on Kotlin 1.3. 50
    Czar

    Czar

    3 years ago
    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.
    gammax

    gammax

    3 years ago
    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
    Czar

    Czar

    3 years ago
    Aren't they supposed to go together?
    gammax

    gammax

    3 years ago
    WildcardImport
    is a
    formatting
    rule from Detekt. Documentation is here: https://arturbosch.github.io/detekt/style.html#wildcardimport
    Czar

    Czar

    3 years ago
    That's quite counterintuitive. So basically if I want to use WildcardImport rule I have to disable NoWildcardImports rule?
    gammax

    gammax

    3 years ago
    They’re independent. You can use either one or the other or both.
    Czar

    Czar

    3 years ago
    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
    gammax

    gammax

    3 years ago
    🤔 Looking at the code of the two rules, I don’t see any connections between the two
    Czar

    Czar

    3 years ago
    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
    gammax

    gammax

    3 years ago
    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 👍
    Czar

    Czar

    3 years ago
    I've created a PR clarifying the docshttps://github.com/arturbosch/detekt/pull/1888
    s

    schalkms

    3 years ago
    @Czar thanks for submitting the PR