Skip to content

Commit 6fe5b3b

Browse files
authored
Merge pull request #2526 from DataDog/jward/local-ci-update
chore: Set the local-ci script to check for specific version of KTLint
2 parents f37baf1 + 2018601 commit 6fe5b3b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

local_ci.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ANALYSIS=0
88
COMPILE=0
99
TEST=0
1010
UPDATE_SESSION_REPLAY_PAYLOAD=0
11+
KTLINT_VERSION=0.50.0
1112

1213
export CI=true
1314

@@ -56,17 +57,34 @@ if [[ $SETUP == 1 ]]; then
5657
echo "-- SETUP"
5758

5859
echo "---- Install KtLint"
60+
INSTALL_KTLINT=false
5961
if [[ -x "$(command -v ktlint)" ]]; then
60-
echo " KtLint already installed; version $(ktlint --version)"
61-
else
62-
curl -SLO https://github.com/pinterest/ktlint/releases/download/0.50.0/ktlint && chmod a+x ktlint
62+
INSTALLED_KTLINT=`ktlint --version`
63+
echo " KtLint already installed; version $INSTALLED_KTLINT"
64+
if [[ $INSTALLED_KTLINT != $KTLINT_VERSION ]]; then
65+
echo " Upgrading to version $KTLINT_VERSION"
66+
INSTALL_KTLINT=true
67+
fi
68+
fi
69+
70+
if [[ $INSTALL_KTLINT = true ]]; then
71+
curl -SLO https://github.com/pinterest/ktlint/releases/download/$KTLINT_VERSION/ktlint && chmod a+x ktlint
6372
sudo mv ktlint /usr/local/bin/
6473
echo " KtLint installed; version $(ktlint --version)"
6574
fi
6675

76+
77+
6778
echo "---- Install Detekt"
6879
if [[ -x "$(command -v detekt)" ]]; then
6980
echo " Detekt already installed; version $(detekt --version)"
81+
read -p " Would you like to update Detekt? " -n 1 -r
82+
echo
83+
if [[ $REPLY =~ ^[Yy]$ ]]
84+
then
85+
brew upgrade detekt
86+
echo " Detekt upgraded; version $(detekt --version)"
87+
fi
7088
else
7189
brew install detekt
7290
echo " Detekt installed; version $(detekt --version)"

0 commit comments

Comments
 (0)