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.

ktlintCheck task does not fail on Windows

See original GitHub issue

Hello Ktlint-Gradle team.

I’m facing the strange issue. When I’m running the local ktlint check via ./gradlew clean ktlintCheck the “mainSourceSetCheck” task completes successfully. But when I’m running the same process in docker build environment the result is different and it fails.

I’ve found the same problem on StackOverflow: https://stackoverflow.com/questions/63863368/ktlint-check-doesnt-work-locally-anymore-it-works-tho-in-my-docker-image-buil

Versions I’m using:

  • Gradle wrapper 6.6.1-bin.zip
  • OpenJDK 14.0.2
  • Kotlin version 1.4.10
  • Ktlint-gradle plugin 9.4.0

The java --version output in the local and docker environment is the same:

openjdk 14.0.2 2020-07-14 
OpenJDK Runtime Environment (build 14.0.2+12-46) 
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

Local environment check outputs the following message [DEBUG] <...>ms / 0 file(s) / 0 error(s) whereas the docker environment outputs the [DEBUG] <...>ms / 1 file(s) / 1 error(s)

I’ve also made a minimum reproducible example. You may found it here: https://github.com/santelos/ktlint-mre


build.gradle.kts

repositories {
    mavenCentral()
}

plugins {
    kotlin("jvm") version "1.4.10"
    id("org.jlleitschuh.gradle.ktlint") version "9.4.0"
}

ktlint {
    debug.set(true)
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "14"
}

Dockerfile

FROM openjdk:14.0.2
WORKDIR /build
COPY . .
RUN java --version
RUN ./gradlew clean ktlintCheck

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

4reactions
santeloscommented, Oct 5, 2020

Thanks, @Tapchicoma The Windows community is happy now 😁

2reactions
Tapchicomacommented, Sep 30, 2020

I could reproduce it on the windows machine using sample project. Looking into it 👀

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Task 'ktlintCheck' not found in project - Stack Overflow
I can run the ktlintCheck from Gradle window in Android studio. I can run the task from command line gradlew ktlintCheck.
Read more >
Improve your code with lint checks - Android Developers
If you're not using Android Studio or Gradle, you can use the standalone ... In the lint Inspection Results window after you click...
Read more >
Ktlint
No configuration required ktlint aims to capture the official Kotlin coding conventions and Android Kotlin Style Guide. · Rule sets ·. · Disable...
Read more >
11.0.0 - GitHub
Configuration should stay the same, so, if you don't configure tasks directly, ... 2020.10.05 ### Fixed - Plugin now correctly validates files on...
Read more >
Setting up Git pre-commit/pre-push hook for Ktlint check
So, even when you are able to set this up locally on your PC by just having your pre-commit script placed directly in...
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