Skip to content

Commit

Permalink
Update ktlint to 0.43.0-SNAPSHOT
Browse files Browse the repository at this point in the history
### What's done:
* Disable gradle tests with absolute paths on Windows
* Add CLI tests with absolute paths
  • Loading branch information
petertrr committed Aug 9, 2021
1 parent 651bb15 commit 0073239
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
os: [ ubuntu-latest, windows-latest, macos-latest ]

steps:
- uses: actions/checkout@v2
- name: Setup environment variables
run: |
cat pom.xml | grep "<version>.*</version>" | head -1 | awk -F'[><]' '{ printf "DIKTAT_VERSION=%s\n",$3 }' >> $GITHUB_ENV
Expand All @@ -67,7 +68,7 @@ jobs:
continue-on-error: true
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: |
./ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "examples/maven/src/main/kotlin/Test.kt" &> out
./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
Expand All @@ -80,9 +81,30 @@ jobs:
- name: Check output
id: cli-check
run: |
if [ -f out.txt ]; then mv out.txt out; fi
cat out
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out
cat out.txt
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt
rm out.txt
shell: bash

- name: Run diKTat from cli (absolute paths)
continue-on-error: true
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: |
./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
shell: cmd

- name: Check output (absolute paths)
id: cli-check
run: |
cat out.txt
grep -E "\[VARIABLE_NAME_INCORRECT_FORMAT\]" out.txt
shell: bash

build_and_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class DiktatGradlePluginFunctionalTest {
}

@Test
@DisabledOnOs(OS.WINDOWS, disabledReason = "Because of short directory notation")
fun `should execute diktatCheck with absolute paths`() {
val path = testProjectDir.root
.resolve("src/**/*.kt")
Expand Down

0 comments on commit 0073239

Please sign in to comment.