MCPcopy Create free account
hub / github.com/BerriAI/litellm / cmd_check

Function cmd_check

scripts/openapi_docs_gate.py:153–174  ·  view source on GitHub ↗
(base: str)

Source from the content-addressed store, hash-verified

151
152
153def cmd_check(base: str) -> None:
154 head: Final = head_violations()
155 base_point: Final = resolve_base_point(base)
156 breaches: Final = evaluate(count_by_rule(head), base_counts_cached(checker_identity(), base_point, base_counts))
157 if not breaches:
158 print(f"OK: no OA rule grew past its merge-base count (base {base})")
159 return
160 diff: Final = _run(["git", "diff", base_point, "--unified=0", "--no-color", "--", TARGET])
161 new: Final = introduced(head, added_text(diff))
162 print(f"FAIL: OA-rule totals grew past their merge-base count (base {base}):")
163 for breach in breaches:
164 print(f" {breach.rule}: total {breach.total} over ceiling {breach.ceiling} (this change added {breach.added})")
165 for violation in sorted(v for v in new if v.code == breach.rule):
166 print(f" {violation.method} {violation.path}")
167 print(
168 "Give every new POST route a request body schema (a typed body parameter, or "
169 "`openapi_extra={'requestBody': inline_request_body(Model, example)}` when the handler reads "
170 "`request.body()`), a docstring, and a 200 schema (`response_model=` or `responses={200: {'model': ...}}`), "
171 "or document an equal number of existing routes; the ceiling is the merge-base count. Run "
172 "`python scripts/check_openapi_docs.py` to see every finding."
173 )
174 raise SystemExit(1)
175
176
177def main() -> None:

Callers 1

mainFunction · 0.70

Calls 10

resolve_base_pointFunction · 0.90
evaluateFunction · 0.90
base_counts_cachedFunction · 0.90
added_textFunction · 0.85
sortedFunction · 0.85
head_violationsFunction · 0.70
count_by_ruleFunction · 0.70
checker_identityFunction · 0.70
_runFunction · 0.70
introducedFunction · 0.70

Tested by

no test coverage detected