mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
The eslint-metrics.json snapshot duplicated the violation counts already enforced by eslint-budgets.json. Keeping it current added a CI drift check, a pre-commit regenerate-and-flag step, and a standalone npm run lint:metrics script, none of which caught anything the budget gate did not, yet all of which failed noisily whenever the snapshot went stale. This drops the file and that machinery while leaving eslint-budgets.json as the actual ratchet gate
22 lines
871 B
JavaScript
22 lines
871 B
JavaScript
import { readFileSync } from "fs";
|
|
import { countBudgetViolations } from "./lint-budget-lib.mjs";
|
|
|
|
const [reportPath, budgetsPath] = process.argv.slice(2);
|
|
const report = JSON.parse(readFileSync(reportPath, "utf8"));
|
|
const budgets = JSON.parse(readFileSync(budgetsPath, "utf8"));
|
|
const counts = countBudgetViolations(report, budgets);
|
|
|
|
let failed = false;
|
|
for (const [rule, { max, target }] of Object.entries(budgets)) {
|
|
const count = counts[rule];
|
|
const note = count > max ? "OVER BUDGET" : count <= target ? "at target" : `${max - count} of headroom`;
|
|
console.log(`${rule}: ${count} | max: ${max} | target: ${target} | ${note}`);
|
|
if (count > max) {
|
|
console.error(
|
|
`::error::${rule} budget exceeded (${count} > ${max}). Reduce usage; lower max in eslint-budgets.json as the count drops.`,
|
|
);
|
|
failed = true;
|
|
}
|
|
}
|
|
|
|
process.exit(failed ? 1 : 0);
|