mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
LIT001 and LIT002 only see literal dict annotations and constructions, so a value whose dict type is inferred (a helper returning dict[str, int], a defaultdict threaded through calls) sails through review. scripts/check_dict_usage.py walks mypy's typed AST and flags every expression whose proper type is a bare mutable dict variant, and scripts/dict_usage_gate.py wraps it in the same grandfathered budget model as the LIT and basedpyright gates: fail only when the total is over the dict-usage-budget.json limit and above the merge-base count, with --update ratcheting limits down and branch-seeded rules passed through untouched The gate measures from the gate-owned .venv-typecheck env (mypy inference depends on which packages are importable), caches base counts in the shared lint cache under a dict-usage-base- prefix keyed by the checker's own bytes, and runs as its own CI job because a full mypy pass would blow the lint job's 15-minute timeout. ensure_typecheck_env now holds an flock during provisioning so this gate and the basedpyright gate can share the env under make lint -j. Budget seeded at the current count of 54056
5 lines
42 B
JSON
5 lines
42 B
JSON
{
|
|
"DICT001": {
|
|
"limit": 54056
|
|
}
|
|
}
|