-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlint.sh
More file actions
executable file
·50 lines (41 loc) · 1.24 KB
/
lint.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.24 KB
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
45
46
47
48
49
50
#!/bin/bash
# Function to install SwiftLint
install_swiftlint() {
echo "Installing SwiftLint..."
# Remove any existing installation
brew uninstall --force swiftlint sourcekitten 2>/dev/null || true
# Clean Homebrew cache
brew cleanup
# Install SwiftLint with specific version
brew install swiftlint@0.54.0
# Verify installation
if ! command -v swiftlint &> /dev/null; then
echo "Failed to install SwiftLint"
exit 1
fi
}
# Check if SwiftLint is installed
if ! command -v swiftlint &> /dev/null; then
install_swiftlint
fi
# Check SwiftLint version
SWIFTLINT_VERSION=$(swiftlint version)
echo "Using SwiftLint version: $SWIFTLINT_VERSION"
# Run SwiftLint with error handling
echo "Running SwiftLint..."
if ! swiftlint lint --reporter xcode; then
if [[ $? -eq 134 ]]; then
echo "SwiftLint crashed. Attempting to reinstall..."
install_swiftlint
echo "Running SwiftLint again..."
if ! swiftlint lint --reporter xcode; then
echo "SwiftLint still failed after reinstallation"
exit 1
fi
else
echo "SwiftLint found issues that need to be fixed."
exit 1
fi
fi
echo "SwiftLint completed successfully!"
exit 0