reduce cruft

This commit is contained in:
ed
2026-07-10 09:23:02 -04:00
parent c824c998eb
commit 6103f47f05
6 changed files with 26 additions and 44 deletions
+4 -3
View File
@@ -162,12 +162,13 @@ function M.run(ctx)
local annot_results = (ctx.flags and ctx.flags._annot_results) or {}
-- Render per-source reports.
-- Hoist ensure_dir out of the loop (cache + hoisting = single mkdir).
if not ctx.dry_run then ensure_dir(ctx.out_root) end
for _, entry in ipairs(annot_results) do
local src = entry.source
local result = entry.result
local out_path = ctx.out_root .. "/" .. src.basename .. ".annotations.txt"
if not ctx.dry_run then
ensure_dir(ctx.out_root)
write_file(out_path, render_source_report(src.path, result))
end
table.insert(outputs, { annotations_txt = out_path })
@@ -177,12 +178,12 @@ function M.run(ctx)
if not ctx.dry_run then
-- The project report references each source by its absolute path.
-- Augment the entries with a .source field for the per-source error counts.
-- ensure_dir was already hoisted above; cache makes this a no-op.
local all_results = {}
for _, entry in ipairs(annot_results) do
entry.result.source = entry.source.path
table.insert(all_results, entry.result)
end
ensure_dir(ctx.out_root)
local summary_path = ctx.out_root .. "/annotation_validation.txt"
write_file(summary_path, render_project_report(all_results))
table.insert(outputs, { summary_txt = summary_path })
@@ -191,4 +192,4 @@ function M.run(ctx)
return { outputs = outputs, errors = errors, warnings = warnings }
end
return M
return M