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
15 lines
401 B
JavaScript
15 lines
401 B
JavaScript
export function countBudgetViolations(report, budgets) {
|
|
const counts = {};
|
|
for (const file of report) {
|
|
for (const message of file.messages) {
|
|
if (message.ruleId in budgets) {
|
|
counts[message.ruleId] = (counts[message.ruleId] || 0) + 1;
|
|
}
|
|
}
|
|
}
|
|
return Object.fromEntries(
|
|
Object.keys(budgets)
|
|
.sort()
|
|
.map((rule) => [rule, counts[rule] || 0]),
|
|
);
|
|
}
|