Skip to content

Traversing the directory hierarchy is broken on Windows as of version 0.47 #1600

@0x6675636b796f75676974687562

Description

Expected Behavior

Running ktlint w/o specifying any input files previously made it search for *.kt and *.kts files, starting from the current directory, e. g.:

$ ./ktlint
14:54:01.402 [main] INFO com.pinterest.ktlint.internal.KtlintCommandLine - Enable default patterns [**/*.kt, **/*.kts]
10:56:53.905 [main] DEBUG com.pinterest.ktlint.internal.KtlintCommandLine - 6821ms / 14 file(s) / 167 error(s)

This behaviour still holds when ktlint is run from the command line on Linux or Mac OS X.

Observed Behavior

Yet, using just the very same command line switches on Windows (i. e. when running ktlint from Git Bash) results in no input files being found:

15:01:09.889 [main] INFO com.pinterest.ktlint.internal.KtlintCommandLine - Enable default patterns [**\\*.kt, **\\*.kts]
15:01:10.457 [main] ERROR com.pinterest.ktlint.internal.KtlintCommandLine - No files matched [**\\*.kt, **\\*.kts]

This is a clear regression against version 0.46.1 and, apparently, has been caused by the recent changes which re-enable (sort of — see #1601) the parsing of Ant-like path patterns (e.g.: **/*.kt) — which was broken in version 0.46.1.

Steps to Reproduce

  1. Download the fat JAR from https://github.com/pinterest/ktlint/releases/tag/0.47.0.
  2. Run the far JAR against any non-empty codebase on Windows:
    java -Xmx512m --add-opens java.base/java.lang=ALL-UNNAMED -jar ktlint

Your Environment

  • Version of ktlint used: 0.47
  • Relevant parts of the .editorconfig settings: none
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): CLI
  • Version of Gradle used (if applicable): N/A
  • Operating System and version:
    • MINGW64_NT-10.0-19043 unit-725 3.3.4-341.x86_64 2022-05-09 11:56 UTC x86_64 Msys
    • Linux unit-725 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliktlint command line interface

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions