forked from duckduckgo/iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint.sh
executable file
·44 lines (35 loc) · 843 Bytes
/
lint.sh
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
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
FIX=false
if [[ "$1" == "--fix" ]]; then
FIX=true
fi
if [[ -n "$CI" ]] || [[ -n "$BITRISE_IO" ]]; then
echo "Skipping SwiftLint run in CI"
exit 0
fi
# Add brew into PATH
if [[ -f /opt/homebrew/bin/brew ]]; then
eval $(/opt/homebrew/bin/brew shellenv)
fi
if test -d "$HOME/.mint/bin/"; then
PATH="$HOME/.mint/bin/:${PATH}"
fi
export PATH
SWIFTLINT_COMMAND="swiftlint lint"
if $FIX; then
SWIFTLINT_COMMAND="swiftlint lint --fix"
fi
if which swiftlint >/dev/null; then
if [ "$CONFIGURATION" = "Release" ]; then
$SWIFTLINT_COMMAND --strict
if [ $? -ne 0 ]; then
echo "error: SwiftLint validation failed."
exit 1
fi
else
$SWIFTLINT_COMMAND
fi
else
echo "error: SwiftLint not installed. Install using \`brew install swiftlint\`"
exit 1
fi