15 lines
439 B
Bash
15 lines
439 B
Bash
#!/bin/sh
|
|
# Fails if any *.rs file under ROOT/crates has more than 500 lines.
|
|
# Files under any target/ directory are ignored. Test files count.
|
|
ROOT="${1:-.}"
|
|
|
|
bad=$(find "$ROOT/crates" -type f -name '*.rs' ! -path '*/target/*' \
|
|
-exec awk 'END { exit !(NR > 500) }' {} \; -print 2>/dev/null)
|
|
if [ -n "$bad" ]; then
|
|
echo "$bad" | while read -r f; do
|
|
[ -n "$f" ] && echo "check-lines: $f" >&2
|
|
done
|
|
exit 1
|
|
fi
|
|
exit 0
|