Sapling/Scripts/lint.sh

25 lines
459 B
Bash
Raw Permalink Normal View History

2026-05-29 15:34:15 +02:00
#!/bin/sh
set -eu
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$ROOT_DIR"
FILES=$(find Package.swift Sources Tests -type f -name '*.swift' | sort)
if [ -z "$FILES" ]; then
echo "No Swift files found."
exit 0
fi
if grep -n '[[:blank:]]$' $FILES; then
echo "Trailing whitespace found."
exit 1
fi
if grep -n "$(printf '\t')" $FILES; then
echo "Tabs found; use spaces for Swift source indentation."
exit 1
fi
echo "Lint passed."