From 37593120109ab4e5aa9bc971cdc5f15b821b2702 Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Mon, 31 Oct 2022 15:27:32 +0300 Subject: [PATCH] Run Diktat from CLI using glob (**/*) paths (#1544) ### What's done: This change is intended to test that ktlint (0.47+) is indeed capable of parsing Ant wildcard patterns (`**/*.kt` etc.). Fixes #1397. --- .github/workflows/build_and_test.yml | 67 +++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 25af8460c6..1fb0292c04 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -76,18 +76,10 @@ jobs: - name: Run diKTat from cli continue-on-error: true - if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "examples/maven/src/main/kotlin/Test.kt" &> out.txt + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/maven/src/main/kotlin/Test.kt' &>out.txt shell: bash - - name: Run diKTat from cli on windows - continue-on-error: true - if: runner.os == 'Windows' - run: | - java.exe -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "examples/maven/src/main/kotlin/Test.kt" > out.txt 2>&1 - shell: cmd - - name: Check output run: | cat out.txt @@ -99,20 +91,73 @@ jobs: continue-on-error: true if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "$PWD/examples/maven/src/main/kotlin/Test.kt" &> out.txt + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "$PWD/examples/maven/src/main/kotlin/Test.kt" &>out.txt shell: bash - name: Run diKTat from cli on windows (absolute paths) continue-on-error: true if: runner.os == 'Windows' run: | - java.exe -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "%cd%/examples/maven/src/main/kotlin/Test.kt" > out.txt 2>&1 + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "%cd%/examples/maven/src/main/kotlin/Test.kt" > out.txt 2>&1 shell: cmd - name: Check output (absolute paths) run: | cat out.txt grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt + rm out.txt + shell: bash + + - name: Run diKTat from cli (glob paths, 1 of 4) + continue-on-error: true + run: | + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/maven/src/main/kotlin/*.kt' &>out.txt + shell: bash + + - name: Check output (glob paths, 1 of 4) + run: | + cat out.txt + grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt + rm out.txt + shell: bash + + - name: Run diKTat from cli (glob paths, 2 of 4) + continue-on-error: true + run: | + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/**/main/kotlin/*.kt' &>out.txt + shell: bash + + - name: Check output (glob paths, 2 of 4) + run: | + cat out.txt + grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt + rm out.txt + shell: bash + + - name: Run diKTat from cli (glob paths, 3 of 4) + continue-on-error: true + run: | + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/**/*.kt' &>out.txt + shell: bash + + - name: Check output (glob paths, 3 of 4) + run: | + cat out.txt + grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt + rm out.txt + shell: bash + + - name: Run diKTat from cli (glob paths, 4 of 4) + continue-on-error: true + run: | + java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard '**/*.kt' &>out.txt + shell: bash + + - name: Check output (glob paths, 4 of 4) + run: | + cat out.txt + grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt + rm out.txt shell: bash build_and_test: