From 164ee30e30feda65246b7f0d5863efff133c314e Mon Sep 17 00:00:00 2001 From: Ghais Zaher Date: Thu, 29 Feb 2024 09:01:29 +0100 Subject: [PATCH 1/4] GH-48: deprecated code-style --- entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 5bc5e76..fc2bd12 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -36,8 +36,10 @@ export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" ktlint_version=$(ktlint --version) echo "ktlint version: $ktlint_version" +# ktlint_version > 0.49.1 if [ "$(printf '%s\n' "0.49.1" "$ktlint_version" | sort -V | head -n1)" = "0.49.1" ]; then # --code-style is deprecated since 1.0.1 and .editorconfig needs to be used: https://pinterest.github.io/ktlint/latest/rules/code-styles/ + # ktlint_version <= 1.0.0 if [ "$(printf '%s\n' "1.0.0" "$ktlint_version" | sort -V | tail -n1)" = "1.0.0" ]; then if [ "$INPUT_ANDROID" = true ]; then export ANDROID="--code-style=android_studio" @@ -51,6 +53,9 @@ else fi fi +echo "ANDROID: $ANDROID" +echo "command: ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INPUT_FILE_GLOB" + ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INPUT_FILE_GLOB | reviewdog -f=checkstyle \ -name="${INPUT_NAME}" \ From 9460489d96cdf71dedbc7142071263c04ecf2f6b Mon Sep 17 00:00:00 2001 From: Ghais Zaher Date: Thu, 29 Feb 2024 09:03:37 +0100 Subject: [PATCH 2/4] more debug --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index fc2bd12..09300dd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -38,9 +38,11 @@ echo "ktlint version: $ktlint_version" # ktlint_version > 0.49.1 if [ "$(printf '%s\n' "0.49.1" "$ktlint_version" | sort -V | head -n1)" = "0.49.1" ]; then + echo "ktlint version > 0.49.1" # --code-style is deprecated since 1.0.1 and .editorconfig needs to be used: https://pinterest.github.io/ktlint/latest/rules/code-styles/ # ktlint_version <= 1.0.0 if [ "$(printf '%s\n' "1.0.0" "$ktlint_version" | sort -V | tail -n1)" = "1.0.0" ]; then + echo "ktlint version <= 1.0.0" if [ "$INPUT_ANDROID" = true ]; then export ANDROID="--code-style=android_studio" else From 80e2f1f5bf74733968eb1b6894ab19e555026752 Mon Sep 17 00:00:00 2001 From: Ghais Zaher Date: Thu, 29 Feb 2024 09:15:08 +0100 Subject: [PATCH 3/4] try fix --- entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 09300dd..f66592e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -34,6 +34,10 @@ git config --global --add safe.directory $GITHUB_WORKSPACE export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" ktlint_version=$(ktlint --version) +# In newer ktlint versions, the command `ktlint --version` returns "ktlint version x.y.z" and we need to remove "ktlint version " from the string +ktlint_version=${ktlint_version#"ktlint version "} + + echo "ktlint version: $ktlint_version" # ktlint_version > 0.49.1 @@ -55,9 +59,6 @@ else fi fi -echo "ANDROID: $ANDROID" -echo "command: ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INPUT_FILE_GLOB" - ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INPUT_FILE_GLOB | reviewdog -f=checkstyle \ -name="${INPUT_NAME}" \ From d59d4dcfc6d36c014044454e86bf87f14232ecf6 Mon Sep 17 00:00:00 2001 From: Ghais Zaher Date: Thu, 29 Feb 2024 09:16:32 +0100 Subject: [PATCH 4/4] clean up --- entrypoint.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f66592e..0dfa572 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,16 +37,13 @@ ktlint_version=$(ktlint --version) # In newer ktlint versions, the command `ktlint --version` returns "ktlint version x.y.z" and we need to remove "ktlint version " from the string ktlint_version=${ktlint_version#"ktlint version "} - echo "ktlint version: $ktlint_version" # ktlint_version > 0.49.1 if [ "$(printf '%s\n' "0.49.1" "$ktlint_version" | sort -V | head -n1)" = "0.49.1" ]; then - echo "ktlint version > 0.49.1" # --code-style is deprecated since 1.0.1 and .editorconfig needs to be used: https://pinterest.github.io/ktlint/latest/rules/code-styles/ # ktlint_version <= 1.0.0 if [ "$(printf '%s\n' "1.0.0" "$ktlint_version" | sort -V | tail -n1)" = "1.0.0" ]; then - echo "ktlint version <= 1.0.0" if [ "$INPUT_ANDROID" = true ]; then export ANDROID="--code-style=android_studio" else