mirror of
https://github.com/bitwarden/ios.git
synced 2026-06-19 12:02:37 -05:00
27 lines
817 B
Bash
Executable File
27 lines
817 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Pre-commit hook that runs spell check and linting on staged files
|
|
# This hook is set up automatically by Scripts/bootstrap.sh
|
|
|
|
PATH=/opt/homebrew/bin:/usr/local/bin:$PATH
|
|
|
|
# Get the directory of this script
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
|
|
|
|
# If running from .git/hooks, find repo root
|
|
if [[ "$SCRIPT_DIR" == *".git/hooks"* ]]; then
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
else
|
|
# Running from Scripts directory
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
fi
|
|
|
|
# Run spell check on staged files
|
|
"$REPO_ROOT/Scripts/spellcheck-changes.sh" || exit 1
|
|
|
|
# Run SwiftFormat and SwiftLint on staged Swift files
|
|
"$REPO_ROOT/Scripts/lint-changes.sh" || exit 1
|
|
|
|
# Fix ellipsis sequences in .strings files
|
|
"$REPO_ROOT/Scripts/fix-ellipsis-changes.sh" || exit 1
|