-
Notifications
You must be signed in to change notification settings - Fork 94
Feat: Adding a script to run SwiftLint locally #2095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 13 commits
5636c66
dddcd71
907bee4
75e7b2a
8044f79
54fc76c
1b80736
a3f9ad5
40ce56b
40c0635
c81ff68
646801b
4c8512c
6962ab9
98f2f91
56858cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/bin/bash | ||
| # | ||
| # lint.sh | ||
| # aws-sdk-swift | ||
| # | ||
| # Created by Felix, Anthony on 1/23/26. | ||
| # | ||
|
||
|
|
||
| # Standard brew path setup | ||
| export PATH="$PATH:/opt/homebrew/bin:/usr/local/bin" | ||
|
|
||
| # Unset AWS_SWIFT_SDK_USE_LOCAL_DEPS to use remote dependencies instead of local ones | ||
| unset AWS_SWIFT_SDK_USE_LOCAL_DEPS | ||
|
||
|
|
||
| LOG_FILE="xcodebuild.log" | ||
|
|
||
| echo "Step 1: Running standard SwiftLint..." | ||
| swiftlint lint --strict | ||
|
|
||
| echo "Step 2: Preparing minimal build for analyzer..." | ||
| # Create backup of Services directory | ||
| if [ -d "Sources/Services" ]; then | ||
| echo "Backing up Services directory..." | ||
| mv Sources/Services Sources/Services.backup | ||
| fi | ||
|
|
||
| # Create empty Services directory for CLI tool | ||
| mkdir -p Sources/Services | ||
|
|
||
| # Generate minimal package manifest without service clients | ||
| cd AWSSDKSwiftCLI | ||
| swift run AWSSDKSwiftCLI generate-package-manifest .. | ||
| cd .. | ||
|
|
||
| echo "Step 3: Building minimal project for analyzer..." | ||
| if xcodebuild -scheme aws-sdk-swift-Package -destination platform=macOS > "$LOG_FILE" 2>&1; then | ||
| echo "✅ Build completed successfully" | ||
|
|
||
| echo "Step 4: Running SwiftLint Analyze (this may take a few minutes)..." | ||
| timeout 300 swiftlint analyze --compiler-log-path "$LOG_FILE" || echo "⚠️ SwiftLint Analyze timed out after 5 minutes" | ||
|
||
| else | ||
| echo "⚠️ Build failed, skipping SwiftLint Analyze step" | ||
| echo "Check $LOG_FILE for build errors" | ||
| fi | ||
|
|
||
| # Restore Services directory | ||
| if [ -d "Sources/Services.backup" ]; then | ||
| echo "Restoring Services directory..." | ||
| rm -rf Sources/Services | ||
| mv Sources/Services.backup Sources/Services | ||
| fi | ||
|
|
||
| echo "✅ Linting complete!" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the specific changes to linter rules in this file?
Also, for simplicity, we typically keep the same linter rules in SDK and in smithy-swift. So if we do change rules here, there should be a 2nd PR to change them there as well.