Skip to content

Commit

Permalink
Run Diktat from CLI using glob (**/*) paths (#1544)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
0x6675636b796f75676974687562 authored Oct 31, 2022
1 parent ccff37d commit 3759312
Showing 1 changed file with 56 additions and 11 deletions.
67 changes: 56 additions & 11 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 3759312

Please sign in to comment.