kotlinter-gradle icon indicating copy to clipboard operation
kotlinter-gradle copied to clipboard

Opt-out of lint task on `check`

Open joshmsamuels opened this issue 3 years ago • 2 comments

The README for this project states that kotlinter-gradle automatically makes the check task dependent on the lint task. Is there a way to opt out of this behaviour? My team does not want builds to fail because of linter errors and removing tasks is deprecated as of gradle 6.

Are there any other ways to opt-out of linting on check?

joshmsamuels avatar Jan 21 '22 22:01 joshmsamuels

Need to test, but I believe there should be a way in the gradle DSL. Might want to use afterEvaluate to edit the dependsOn of the check tasks. https://stackoverflow.com/questions/68800375/gradle-how-to-remove-task-dependency

jeremymailen avatar Jan 28 '22 08:01 jeremymailen

I can throw a couple of ideas as well:

  1. You can exclude lint by calling ./gradlew check -x lintKotlin which will run the check task without running codestyle check on it.
  2. Knowing most of codestyle offences can be autocorrected, then maybe: ./gradlew formatKotlin check would be a solution for you? It doesn't do precisely what you asked, but will reduce the number of builds failed because of linter errors.
  3. Depending on what's your goal for check task, you can register your own checkDev task and configure it to run a subset of all checks you have registered in the project

mateuszkwiecinski avatar Jan 28 '22 09:01 mateuszkwiecinski

I believe it is possible to opt out of check being dependent on lintKotlin with the available gradle DSL config options, so closing for now.

jeremymailen avatar Oct 08 '23 02:10 jeremymailen