-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetekt.sh
More file actions
33 lines (27 loc) · 804 Bytes
/
detekt.sh
File metadata and controls
33 lines (27 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -e
ROOT_FOLDER=build/bin
VERSION=1.23.8
DETEKT_JAR="$ROOT_FOLDER/detekt-cli-$VERSION-all.jar"
DETEKT_URL="https://github.com/detekt/detekt/releases/download/v$VERSION/detekt-cli-$VERSION-all.jar"
mkdir -p "$ROOT_FOLDER"
if [ ! -f "$DETEKT_JAR" ]; then
echo "Downloading Detekt..."
rm -f "$ROOT_FOLDER"/detekt-*
curl -sSL "$DETEKT_URL" -o "$DETEKT_JAR"
fi
if [ "$CI" ]; then
export REVIEWDOG_GITHUB_API_TOKEN="${GITHUB_TOKEN}"
java -jar "$DETEKT_JAR" \
--config .github/workflows/assets/detekt.yml \
--report xml:detekt_report.xml
reviewdog -f=checkstyle \
-name="detekt" \
-reporter="github-pr-review" \
-fail-level=error <detekt_report.xml
else
java -jar "$DETEKT_JAR" \
--config .github/workflows/assets/detekt.yml \
"$@"
fi
echo "Done!"