question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QUESTION: Shouldn't formatKotlin run after lintKotlin if ignoreFailures = true?

See original GitHub issue

I’ve added kotlinter to my build script and I expected that 2 new tasks (lintKotlin and formatKotlin) would run after the rest!

But only lintKotlin runs… formatKotlin only runs if I trigger it manually with ./gradlew formatKotlin

Am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jeremymailencommented, Jun 15, 2020
1reaction
jeremymailencommented, Jun 14, 2020

For reference, this is what the pre-push look looks like when installed .git/hooks/pre-push

#!/bin/sh

##### KOTLINTER HOOK START #####
GRADLEW=/path/to/myproject/gradlew
$GRADLEW lintKotlin

status=$?
if [ "$status" != 0 ] ; then
    echo 1>&2 "\nlintKotlin found problems, running formatKotlin; commit the result and re-push"
    $GRADLEW formatKotlin
    exit 1
fi
##### KOTLINTER HOOK END #####
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fail a task after it has run? Aka how to ignoreFailures ...
I made it work using “finalizedBy” (instead of “ignoreFailures” and “dependsOn”) to chain the “test”, “testNg”, and “testReport” tasks. See ...
Read more >
Step by Step: How to setup ktlint with spotless? - SourceLevel
In this example, I use Spotless, which is a tool for formatting code according to the configuration of your Gradle script.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found