gammax

    gammax

    5 months ago
    Just saw question about "running detekt on a single file" on my notifications. I came here to answer, but the message is gone 😅 Anyway, you can use the
    --input
    arg. More on this here https://detekt.dev/docs/gettingstarted/git-pre-commit-hook
    Bruno Pérez Motter

    Bruno Pérez Motter

    4 months ago
    does this also work for the gradle plugin? Any plans on adding it?
    gammax

    gammax

    4 months ago
    Yes it works for the Gradle Plugin as well. Though you have to create your own task probably
    Bruno Pérez Motter

    Bruno Pérez Motter

    4 months ago
    Thanks for the response! May i ask how can i run the gradle detekt plugin with certain input files? I’ve tried
    ./gradlew detekt --input my_file.kt
    but i get
    Unknown command-line option ‘--input’.
    Though you have to create your own task probably
    is there an example??
    gammax

    gammax

    4 months ago
    Bruno Pérez Motter

    Bruno Pérez Motter

    4 months ago
    thank you!! 🙌
    gammax

    gammax

    4 months ago
    You can't just
    ./gradlew detekt --input my_file.kt
    though. You'll have to use a property or so.
    If you run detekt on a single file, use the CLI