@@ -12,7 +12,8 @@ show_usage() {
1212 echo " Usage: $0 [TARGET] [-p|--platforms <PLATFORM1> <PLATFORM2> ...]"
1313 echo " [TARGET] Optional. The target to validate (defaults to package name)"
1414 echo " -p, --platforms Optional. List of platforms (default: iOS macOS tvOS watchOS xrOS)"
15-
15+ echo " --swiftlint Optional. Run SwiftLint (1) or skip it (0) (default: 1)"
16+
1617 echo
1718 echo " This script will:"
1819 echo " * Validate that swiftlint passes"
@@ -23,7 +24,7 @@ show_usage() {
2324 echo " $0 "
2425 echo " $0 MyTarget"
2526 echo " $0 -p iOS macOS"
26- echo " $0 MyTarget -p iOS macOS"
27+ echo " $0 MyTarget -p iOS macOS --swiftlint 0 "
2728 echo " $0 MyTarget --platforms iOS macOS tvOS watchOS xrOS"
2829 echo
2930}
@@ -49,6 +50,7 @@ show_error_and_exit() {
4950# Define argument variables
5051TARGET=" "
5152PLATFORMS=" iOS macOS tvOS watchOS xrOS" # Default platforms
53+ SWIFTLINT=1 # Default to running SwiftLint
5254
5355# Parse command line arguments
5456while [[ $# -gt 0 ]]; do
@@ -69,6 +71,14 @@ while [[ $# -gt 0 ]]; do
6971 show_usage_error_and_exit " --platforms requires at least one platform"
7072 fi
7173 ;;
74+ --swiftlint)
75+ shift
76+ if [[ " $1 " != " 0" && " $1 " != " 1" ]]; then
77+ show_usage_error_and_exit " --swiftlint requires 0 or 1"
78+ fi
79+ SWIFTLINT=" $1 "
80+ shift
81+ ;;
7282 -h|--help)
7383 show_usage; exit 0 ;;
7484 -* )
@@ -136,19 +146,23 @@ echo
136146echo " Validating project for target '$TARGET ' with platforms [$PLATFORMS ]..."
137147
138148# Run SwiftLint
139- echo " Running SwiftLint..."
140- if ! swiftlint --strict; then
141- show_error_and_exit " SwiftLint failed"
149+ if [ " $SWIFTLINT " = " 1" ]; then
150+ echo " Running SwiftLint..."
151+ if ! swiftlint --strict; then
152+ show_error_and_exit " SwiftLint failed"
153+ fi
154+ echo " SwiftLint passed"
155+ else
156+ echo " Skipping SwiftLint (disabled)"
142157fi
143- echo " SwiftLint passed"
144158
145159# Validate git
146160echo " Validating git..."
147161run_script " $SCRIPT_VALIDATE_GIT "
148162
149163# Run unit tests
150164echo " Running unit tests..."
151- run_script " $SCRIPT_TEST " " $TARGET " -p $PLATFORMS
165+ run_script $SCRIPT_TEST $TARGET -p $PLATFORMS
152166
153167# Complete successfully
154168echo
0 commit comments