Public release release-be8720d92b1c
Source commit: be8720d92b1c2795f3e5903d8c1a65d70adfd095 Public tree identity: sha256:9503bb4414b023fea6500688ef0931a7f6b4c940c509fdf96c8bf3a8950e207c
This commit is contained in:
commit
3a697fa132
221 changed files with 81070 additions and 0 deletions
27
scripts/check-code-size.sh
Executable file
27
scripts/check-code-size.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$repo_root"
|
||||
|
||||
maximum_lines=3000
|
||||
failed=0
|
||||
source_roots=(crates)
|
||||
if [[ -d private/hosted-policy/src ]]; then
|
||||
source_roots+=(private/hosted-policy/src)
|
||||
fi
|
||||
while IFS= read -r -d '' file; do
|
||||
case "$file" in
|
||||
*/tests.rs|*/tests/*) continue ;;
|
||||
esac
|
||||
lines="$(wc -l < "$file")"
|
||||
if ((lines > maximum_lines)); then
|
||||
printf '%s has %s lines; production file limit is %s\n' "$file" "$lines" "$maximum_lines" >&2
|
||||
failed=1
|
||||
fi
|
||||
done < <(find "${source_roots[@]}" -type f -name '*.rs' -print0)
|
||||
|
||||
if ((failed)); then
|
||||
exit 1
|
||||
fi
|
||||
printf 'production source file size guard passed (%s lines maximum)\n' "$maximum_lines"
|
||||
Loading…
Add table
Add a link
Reference in a new issue