Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: migrate to 0.49.0" #41

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ if [ ! -z "$INPUT_BASELINE" ]; then
export BASELINE="--baseline=${INPUT_BASELINE}"
fi

if [ "$INPUT_ANDROID" = true ]; then
export ANDROID=--android
fi

if [ "$INPUT_CUSTOM_RULE_PATH" ]; then
export CUSTOM_RULE_PATH="--ruleset=${INPUT_CUSTOM_RULE_PATH}"
fi
Expand All @@ -37,20 +41,7 @@ git config --global --add safe.directory $GITHUB_WORKSPACE

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

ktlint_version=$(ktlint --version)
echo "ktlint version: $ktlint_version"

if [ "$(printf '%s\n' "0.49.0" "$ktlint_version" | sort -V | head -n1)" = "0.49.0" ]; then
if [ "$INPUT_ANDROID" = true ]; then
export ANDROID="--code-style=android_studio"
else
export ANDROID="--code-style=intellij_idea"
fi
else
if [ "$INPUT_ANDROID" = true ]; then
export ANDROID=--android
fi
fi
Comment on lines -40 to -53

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On one hand --code-style=android_studio is what ktlint is saying to use with ktlint 0.49.0 but apparently this paramter has no effect (neither on CI, nor locally)

On the other hand --android is throwing error

ERROR com.pinterest.ktlint.cli.internal.KtlintCommandLine - Option '--android' / '-a' is deprecated and replaced with option '--code-style=android_studio'. Setting '.editorconfig' property 'ktlint_code_style=android_studio' might be a better idea for a project that is always to formatted with this code style.

but still seems to work just fine.

If this --code-style parameter really does not work with ktlint 0.49.0 (which was released few days ago) I would expect 0.49.1 to appear soon, meaning it would make more sense probably to keep action-ktlint as is hoping that problems will be solved soon on ktlint side

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I raised an issue pinterest/ktlint#1982
Let's see if it can get fixed soon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue will be fixed in next ktlint version. I will close the PR and raise another one to apply these changes starting v0.49.1

echo ktlint version: "$(ktlint --version)"

ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INPUT_FILE_GLOB |
reviewdog -f=checkstyle \
Expand All @@ -59,4 +50,3 @@ ktlint --reporter=checkstyle $CUSTOM_RULE_PATH $RELATIVE $ANDROID $BASELINE $INP
-level="${INPUT_LEVEL}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}"