Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
.swiftpm/
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stream rules

--swiftversion 5.3
--swiftversion 5.10

# Use 'swiftformat --options' to list all of the possible options

Expand Down
7 changes: 0 additions & 7 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

This file was deleted.

19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions Mintfile

This file was deleted.

16 changes: 0 additions & 16 deletions Package@swift-5.7.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Package@swift-5.8.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Package@swift-5.9.swift

This file was deleted.

10 changes: 10 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tools]
git-cliff = "2.9.1"
swiftlint = "0.63.2"
swiftformat = "0.59.1"

[settings]
experimental = true

[hooks]
postinstall = "mise run install"
57 changes: 57 additions & 0 deletions mise/tasks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

set -e

echo "🔧 Installing git hooks..."

# Find git repository root
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)

if [ -z "$GIT_ROOT" ]; then
echo "❌ Error: Not a git repository"
exit 1
fi

echo "📁 Git root: $GIT_ROOT"

# Create hooks directory if it doesn't exist
mkdir -p "$GIT_ROOT/.git/hooks"

# Create pre-commit hook
cat > "$GIT_ROOT/.git/hooks/pre-commit" <<'HOOK_EOF'
#!/bin/bash

echo "🔍 Running linters..."

echo "📝 Formatting staged Swift files..."
git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do
if [[ $line == *"/Generated"* ]]; then
echo "⏭️ Skipping generated file: $line"
else
echo "✨ Formatting: $line"
mise exec swiftformat -- swiftformat "${line}"
git add "$line"
fi
done

if ! mise run lint; then
echo "❌ Lint failed. Please fix the issues before committing."
echo "💡 Tip: Run 'mise run format' to auto-fix some issues"
echo "⚠️ To skip this hook, use: git commit --no-verify"
exit 1
fi

echo "✅ All checks passed!"
exit 0
HOOK_EOF

chmod +x "$GIT_ROOT/.git/hooks/pre-commit"

echo "✅ Git hooks installed successfully!"
echo "📍 Hook location: $GIT_ROOT/.git/hooks/pre-commit"
echo ""
echo "Pre-commit hook will:"
echo " 1. Format staged Swift files (except /Generated)"
echo " 2. Run mise lint"
echo ""
echo "To skip the hook, use: git commit --no-verify"
13 changes: 13 additions & 0 deletions mise/tasks/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#MISE description="Lint the overlay-container package using SwiftLint and SwiftFormat"
#MISE usage flag "-f --fix" help="Fix the fixable issues"

set -eo pipefail

if [ "$usage_fix" = "true" ]; then
swiftformat Sources Tests
swiftlint lint --fix --strict --config .swiftlint.yml Sources Tests
else
swiftformat Sources Tests --lint
swiftlint lint --strict --config .swiftlint.yml Sources Tests
fi