Skip to content

Running check within a Docker container does not find all violations #417

@brianhuber

Description

@brianhuber

When I run the check goal on v1.10.2 locally (not within a Docker container) using the following command:

./mvnw -s /usr/share/maven/ref/settings.xml -Dmaven.repo.local=./.m2 com.github.gantsign.maven:ktlint-maven-plugin:check

It fails on the following errors:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.abc:pricing-service >--------------------
[INFO] Building pricing-service 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- ktlint-maven-plugin:1.10.2:check (default-cli) @ pricing-service ---
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:3:1: Wildcard import
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:6:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:6:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:7:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:7:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:8:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:8:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:9:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:9:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:10:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:10:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:11:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:11:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:12:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:12:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:13:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:13:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:14:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:14:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:15:1: Unexpected indentation (16) (should be 4)
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:15:17: Unexpected indentation (expected 4, actual 16)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:52:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:53:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:55:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:56:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:57:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:58:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:59:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:60:1: Unexpected indentation (12) (should be 4)
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:262:68: Unnecessary semicolon
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:1407:18: Missing newline after "("
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:1411:9: Missing newline before ")"
[ERROR] src/test/kotlin/com/abc/pricing/unit/customrates/CustomRateServiceTest.kt:2056:1: Needless blank line(s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.936 s
[INFO] Finished at: 2021-09-03T11:53:23-06:00
[INFO] ------------------------------------------------------------------------

When I run the same check goal against the same project within a Docker container locally or in CI, it only fails on the wildcard import error:

[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.abc:pricing-service >--------------------
[INFO] Building pricing-service 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- ktlint-maven-plugin:1.10.2:check (default-cli) @ pricing-service ---
[ERROR] src/main/kotlin/com/abc/pricing/common/objects/PricingDetailsPark.kt:3:1: Wildcard import
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  22.976 s
[INFO] Finished at: 2021-09-02T22:49:58Z
[INFO] ------------------------------------------------------------------------

If I fix the wildcard import error, running check succeeds without error despite the other errors still existing:

[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.abc:pricing-service >--------------------
[INFO] Building pricing-service 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- ktlint-maven-plugin:1.10.2:check (default-cli) @ pricing-service ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  22.721 s
[INFO] Finished at: 2021-09-02T21:53:30Z
[INFO] ------------------------------------------------------------------------

All of the configuration is the same between the Docker and non-Docker runs other than the container itself. Not sure how to proceed in getting the Docker run to find the same errors as the non-Docker run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions