Skip to content

Commit 7ef8751

Browse files
committed
Fix entrypoint.sh
1 parent e680fd1 commit 7ef8751

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

entrypoint.sh

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ detekt_formatting="/opt/detekt-formatting.jar"
55
# cd or fail
66
cd "$GITHUB_WORKSPACE" || exit 1
77
# Fixes https://github.com/reviewdog/reviewdog/issues/1158
8-
git config --global --add safe.directory $GITHUB_WORKSPACE || exit 1
8+
git config --global --add safe.directory "$GITHUB_WORKSPACE" || exit 1
99

1010
if [ "$INPUT_FAIL_ON_ERROR" = true ] ; then
1111
set -o pipefail
@@ -19,33 +19,40 @@ detekt_command+="--report xml:detekt_report.xml "
1919
detekt_command+="--excludes ${INPUT_DETEKT_EXCLUDES} "
2020

2121
if [ -z "$INPUT_DETEKT_PLUGINS" ]; then
22-
detekt_command+="--plugins ${detekt_formatting} "
22+
detekt_command+=" --plugins \"${detekt_formatting}\""
2323
else
24-
detekt_command+="--plugins ${detekt_formatting},${INPUT_DETEKT_PLUGINS} "
24+
detekt_command+=" --plugins \"${detekt_formatting},${INPUT_DETEKT_PLUGINS}\""
2525
fi
2626

27+
# Baseline
2728
if [ -n "$INPUT_DETEKT_BASELINE" ]; then
28-
detekt_command+="--baseline ${INPUT_DETEKT_BASELINE} "
29+
detekt_command+=" --baseline \"${INPUT_DETEKT_BASELINE}\""
2930
fi
3031

32+
# Parallel (boolean-ish input)
3133
if [ -n "$INPUT_DETEKT_PARALLEL" ]; then
32-
detekt_command+="--parallel "
34+
detekt_command+=" --parallel"
3335
fi
3436

35-
if [ -n "$DETEKT_INPUT_BUILD_UPON_DEFAULT_CONFIG" ]; then
36-
detekt_command+="--build-upon-default-config "
37+
# Build upon default config (fixed var name)
38+
if [ -n "$INPUT_DETEKT_BUILD_UPON_DEFAULT_CONFIG" ]; then
39+
detekt_command+=" --build-upon-default-config"
3740
fi
3841

39-
if [ -n "$DETEKT_ALL_RULES" ]; then
40-
detekt_command+="--all-rules "
42+
# All rules (fixed var name)
43+
if [ -n "$INPUT_DETEKT_ALL_RULES" ]; then
44+
detekt_command+=" --all-rules"
4145
fi
4246

43-
if [ -n "$DETEKT_INPUT" ]; then
44-
detekt_command+="--input ${DETEKT_INPUT} "
47+
# Input paths (fixed var name)
48+
if [ -n "$INPUT_DETEKT_INPUT" ]; then
49+
detekt_command+=" --input \"${INPUT_DETEKT_INPUT}\""
4550
fi
4651

52+
echo "Running detekt with command:"
4753
echo "$detekt_command"
4854
eval "$detekt_command"
4955

5056
reviewdog -f=checkstyle -name="detekt" -reporter="${INPUT_REVIEWDOG_REPORTER}" \
51-
-level="${INPUT_REVIEWDOG_LEVEL}" -filter-mode="${INPUT_REVIEWDOG_FILTER}" <detekt_report.xml
57+
-level="${INPUT_REVIEWDOG_LEVEL}" -filter-mode="${INPUT_REVIEWDOG_FILTER}" \
58+
< detekt_report.xml

0 commit comments

Comments
 (0)