vibetunnel/scripts/lint.sh
Peter Steinberger ba7d66aa88 Improve release scripts and documentation after successful beta 2 release
Major improvements:
- Add common.sh library for consistent error handling and logging
- Fix hardcoded values in scripts (signing identity, volume names, GitHub repo)
- Add comprehensive release documentation with lessons learned
- Create Sparkle key management guide
- Add clean.sh script for managing build artifacts
- Improve error handling and validation across all scripts
- Update lint.sh with proper documentation and better error handling
- Make generate-appcast.sh fail fast if private key is missing

Script improvements:
- release.sh: Add GitHub CLI auth check, remote tag validation
- notarize-app.sh: Auto-detect signing identity from keychain
- create-dmg.sh: Make volume name configurable
- generate-appcast.sh: Extract GitHub info from git remote
- All scripts: Add proper documentation headers

This ensures more reliable and maintainable release process.
2025-06-19 05:14:09 +02:00

81 lines
No EOL
2.3 KiB
Bash
Executable file

#!/bin/bash
# =============================================================================
# VibeTunnel Swift Linting and Formatting Script
# =============================================================================
#
# This script runs SwiftFormat and SwiftLint on the VibeTunnel codebase
# to ensure consistent code style and catch potential issues.
#
# USAGE:
# ./scripts/lint.sh
#
# DEPENDENCIES:
# - swiftformat (brew install swiftformat)
# - swiftlint (brew install swiftlint)
#
# FEATURES:
# - Automatically formats Swift code with SwiftFormat
# - Fixes auto-correctable SwiftLint issues
# - Reports remaining SwiftLint warnings and errors
#
# EXIT CODES:
# 0 - Success (all checks passed)
# 1 - Missing dependencies or linting errors
#
# =============================================================================
set -euo pipefail
# Source common functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
[[ -f "$SCRIPT_DIR/common.sh" ]] && source "$SCRIPT_DIR/common.sh" || true
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Change to project root
cd "$PROJECT_ROOT"
# Check if project has Swift files
if ! find . -name "*.swift" -not -path "./.build/*" -not -path "./build/*" | head -1 | grep -q .; then
print_warning "No Swift files found in project"
exit 0
fi
# Run SwiftFormat
print_info "Running SwiftFormat..."
if command -v swiftformat &> /dev/null; then
if swiftformat . --verbose; then
print_success "SwiftFormat completed successfully"
else
print_error "SwiftFormat encountered errors"
exit 1
fi
else
print_error "SwiftFormat not installed"
echo " Install with: brew install swiftformat"
exit 1
fi
# Run SwiftLint
print_info "Running SwiftLint..."
if command -v swiftlint &> /dev/null; then
# First run auto-corrections
print_info "Applying auto-corrections..."
swiftlint --fix
# Then run full lint check
print_info "Checking for remaining issues..."
if swiftlint; then
print_success "SwiftLint completed successfully"
else
print_warning "SwiftLint found issues that require manual attention"
# Don't exit with error as these may be warnings
fi
else
print_error "SwiftLint not installed"
echo " Install with: brew install swiftlint"
exit 1
fi
print_success "Linting complete!"