mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
* ci(lint): enforce blanket-noqa, dataclass-default, and unused-noqa rules Enable PGH004 (blanket-noqa), RUF008 (mutable-dataclass-default), RUF009 (function-call-in-dataclass-default-argument), and RUF100 (unused-noqa) in ruff.toml, and clean up every resulting violation. RUF008/RUF009 were already clean. PGH004/RUF100 surfaced ~335 stale or blanket noqas: blanket `# noqa` are now scoped to the rule they actually suppress (mostly T201), dead directives are removed, and inapplicable codes are trimmed (e.g. F401 dropped from `import *`). lint.external lists rules enforced outside this config (the strict-rule gate via ruff-strict.toml and upstream litellm's own ruff config) so RUF100 keeps the noqa directives that protect them instead of stripping coverage this config can't see. * ci(lint): trim RUF100 external list to load-bearing codes only Drop the 9 precautionary strict-gate codes (ANN001/002/003/401, B006, PLR0913, PLW0603, RUF012, TID251) that have zero `# noqa` references in the gated source. Keep only the 11 codes with live suppressions so RUF100 doesn't flag them as unused. Future strict-gate suppressions can re-add codes here (or fix the underlying issue) as needed.
31 lines
1.6 KiB
TOML
31 lines
1.6 KiB
TOML
lint.ignore = ["F405", "E402", "E501", "F403"]
|
|
lint.extend-select = ["E501", "PLR0915", "T20", "PGH004", "RUF008", "RUF009", "RUF100"]
|
|
# RUF100 (unused-noqa) only knows the rules enabled in THIS config, so it would strip
|
|
# `# noqa` directives that protect rules enforced elsewhere. List those codes as external
|
|
# so RUF100 leaves their directives alone: the strict gate (ruff-strict.toml) and upstream
|
|
# litellm's own ruff config both rely on suppressions this config can't see.
|
|
lint.external = [
|
|
# Enforced by the strict-rule gate (scripts/ruff_strict_gate.py + ruff-strict.toml)
|
|
"C901",
|
|
# Enforced by upstream litellm's ruff config, but not run in this repo's CI
|
|
"PLC0415", "E402", "BLE001", "ARG002", "S102", "S324", "S606", "D401", "F403", "F405",
|
|
]
|
|
line-length = 120
|
|
exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_config_yaml/*", "tests/*"]
|
|
|
|
|
|
[lint.per-file-ignores]
|
|
"litellm/main.py" = ["F401"]
|
|
"litellm/utils.py" = ["F401"]
|
|
"litellm/proxy/proxy_server.py" = ["F401"]
|
|
"litellm/caching/__init__.py" = ["F401"]
|
|
"litellm/llms/anthropic/chat/__init__.py" = ["F401"]
|
|
"litellm/llms/azure_ai/embed/__init__.py" = ["F401"]
|
|
"litellm/llms/azure_ai/rerank/__init__.py" = ["F401"]
|
|
"litellm/llms/bedrock/chat/__init__.py" = ["F401"]
|
|
"litellm/proxy/utils.py" = ["F401", "PLR0915"]
|
|
"litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py" = ["PLR0915"]
|
|
"litellm/proxy/guardrails/guardrail_hooks/guardrail_benchmarks/test_eval.py" = ["PLR0915"]
|
|
"litellm/responses/streaming_iterator.py" = ["PLR0915"]
|
|
"litellm/files/main.py" = ["PLR0915"]
|
|
"litellm/llms/litellm_proxy/skills/sandbox_executor.py" = ["PLR0915"]
|