ws-cleanup: type diagnostics 1109 -> 94 unique; lint gate against tools/lint_types_baseline.txt
ws/cleanup-types (merged before) annotated Types, init, core, codecs, containers, ops, host and the formats; this commit fixes the rest in the modules ws-cleanup added (AudioOps, Resample, Vorbis / FLAC / Opus encoders). tools/lint.sh now counts unique diagnostics (the analyzer printed every required src module twice: master's '2499' was 1109 unique) and fails when the count rises above tools/lint_types_baseline.txt (94); LINT_TYPES_UPDATE=1 lowers it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
b77660343a
commit
dca1130324
7 files changed
+39
-24
No files matched your search
+19
-5
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Lint (bash tools/lint.sh):
|
||||
# 1. GLOBALS: unknown globals (luau-analyze), a local used before its declaration compiles fine but reads a nil
|
||||
# global at runtime. Roblox globals are allowed (the library runs in Roblox, luau and LuaJIT). Other type errors
|
||||
# are counted and printed with LINT_TYPES=1, but do not fail the lint (absorbed code predates --!strict).
|
||||
# global at runtime. Roblox globals are allowed (the library runs in Roblox, luau and LuaJIT).
|
||||
# TYPES: the other type diagnostics are counted (unique lines: the analyzer reports a required module once per
|
||||
# path spelling) and printed with LINT_TYPES=1. The count may not rise above tools/lint_types_baseline.txt; when
|
||||
# it drops, lower the baseline (LINT_TYPES_UPDATE=1 writes the current count), so it only goes down.
|
||||
# 2. HEADER, REQUIRE, NATIVE (native code never throws: it crashes Roblox Studio), LAYERS, DEPS, CONTRACT:
|
||||
# tools/lint_rules.py (its header lists the rules; docs/STYLE.md explains them).
|
||||
# 3. The generated registry / docs/FORMATS.md are up to date (tools/gen_registry.py --check), and tools/build.py's
|
||||
@@ -19,12 +21,24 @@ if [ -n "$bad" ]; then
|
||||
echo "lint: unknown globals (a local used before it is declared?)"
|
||||
fail=1
|
||||
fi
|
||||
ntype=$(echo "$report" | grep -c "Error:")
|
||||
[ -n "$LINT_TYPES" ] && echo "$report" | grep -v "Unknown global"
|
||||
types=$(echo "$report" | grep "Error:" | grep -v "Unknown global" | sed "s#^$PWD/#./#" | sort -u)
|
||||
ntype=$(if [ -n "$types" ]; then echo "$types" | wc -l; else echo 0; fi)
|
||||
[ -n "$LINT_TYPES" ] && echo "$types"
|
||||
baseline=$(cat tools/lint_types_baseline.txt 2>/dev/null || echo 0)
|
||||
if [ -n "$LINT_TYPES_UPDATE" ]; then
|
||||
echo "$ntype" > tools/lint_types_baseline.txt
|
||||
baseline=$ntype
|
||||
fi
|
||||
if [ "$ntype" -gt "$baseline" ]; then
|
||||
echo "lint: $ntype type diagnostics, more than the baseline $baseline (tools/lint_types_baseline.txt); LINT_TYPES=1 lists them"
|
||||
fail=1
|
||||
elif [ "$ntype" -lt "$baseline" ]; then
|
||||
echo "lint: $ntype type diagnostics, below the baseline $baseline: lower it (LINT_TYPES_UPDATE=1 bash tools/lint.sh)"
|
||||
fi
|
||||
python3 -I tools/lint_rules.py || { echo "lint: structure rules failed (see tools/lint_rules.py)"; fail=1; }
|
||||
python3 -I tools/gen_registry.py --check > /dev/null || { python3 -I tools/gen_registry.py --check; fail=1; }
|
||||
python3 -I tools/build.py --test > /dev/null || { echo "lint: tools/build.py --test failed"; fail=1; }
|
||||
if [ $fail -eq 0 ]; then
|
||||
echo "lint passed (globals, header, require, native, layers, deps, contract, registry; $ntype type diagnostics: LINT_TYPES=1 shows them)"
|
||||
echo "lint passed (globals, header, require, native, layers, deps, contract, registry; $ntype type diagnostics, baseline $baseline: LINT_TYPES=1 shows them)"
|
||||
fi
|
||||
exit $fail
|
||||
@@ -0,0 +1 @@
|
||||
94
|
||||
Reference in new issue
Block a user