This repository was archived by the owner on Nov 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathlint.sh
More file actions
executable file
·57 lines (47 loc) · 1.57 KB
/
lint.sh
File metadata and controls
executable file
·57 lines (47 loc) · 1.57 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
51
52
53
54
55
56
57
#!/bin/bash
set -e
# Script to format and lint Swift code in the codebase
# Now runs both SwiftFormat and SwiftLint for a complete code quality check
echo "Running Swift format and lint on CodeLooper macOS app..."
# Ensure we're in the right directory
script_dir="$(dirname "$0")"
if ! cd "$script_dir"; then
echo "Error: Failed to change directory to $script_dir"
exit 1
fi
# Make sure scripts are executable
chmod +x ./run-swiftlint.sh ./run-swiftformat.sh 2>/dev/null || true
# Verify scripts exist
if [ ! -x "./run-swiftlint.sh" ]; then
echo "Error: run-swiftlint.sh not found or not executable"
exit 1
fi
if [ ! -x "./run-swiftformat.sh" ]; then
echo "Error: run-swiftformat.sh not found or not executable"
exit 1
fi
# First run SwiftFormat to format the code
echo "Step 1/2: Running SwiftFormat..."
./run-swiftformat.sh --format
format_exit_code=$?
# Then run SwiftLint with fix mode and continue flag
echo "Step 2/2: Running SwiftLint..."
if [ $# -eq 0 ]; then
# Default to fix mode with continue flag if no arguments are provided
./run-swiftlint.sh --fix --continue
else
# Pass all arguments to run-swiftlint.sh
./run-swiftlint.sh "$@"
fi
# Check exit code
swiftlint_exit_code=$?
# Check overall exit code
if [ $format_exit_code -eq 0 ] && [ $swiftlint_exit_code -eq 0 ]; then
echo "✅ Swift formatting and linting completed successfully!"
exit 0
else
echo "⚠️ Swift format/lint completed with warnings."
echo " Some issues may require manual fixes."
# We still exit with 0 since the --continue flag was used
exit 0
fi