Public report — ruff, published 29 Jul 2026. Concrete security findings (CVE IDs, secret matches, dependency versions) are hidden in this version; ask the repo owner for the full report.
Watchdog 29-07-2026 @ 17:43 UTC Public
Code Health Audit

Astral-Sh/ruff

66% At Risk

Very large · 632,035 LoC · rebuild ~7.3 person-years · weakest lens: Readiness (55%)

Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸

46/47dimensions tool-verifieddeterministic · confidence 1.0 · 1 LLM-assisted, advisory
1208findings with an exact file:lineof 1220 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
47/113dimensions across the health lenses632035 LoC — wide & deep

Executive summary

Read through the Preview lens: this repo is pre-1.0 / in development, so the colour bands are relaxed to what a preview needs — *green* means good enough for a preview, not yet production-stable. Code correctness and security stay near-strict even here; the score itself is absolute and comparable across repos.

astral-sh/ruff is in good overall health (66%), but at least one category below sits in Adequate-or-worse territory — most items are improvements, and the weakest category contains work to schedule, not shelve.

It is strongest in Domain Modelling (100%) — the domain model is expressive and well-guarded. Event Sourcing (100%) is solid too.

Most urgent: a critical security exposure was detected (see the Security & Compliance lens). Treat it as a priority regardless of the overall grade.

The area that most needs attention is Readiness (55%) — releases are harder to depend on — versioning, release notes and dependency hygiene are thin, so consumers can't easily tell what changed or trust an upgrade.

Leadership focus, highest impact first: tests that import the unreached modules (directly or through… (Test Coverage); unused dependencies, declare unlisted imports explicitly,… (Dependency Hygiene); Give every control a programmatic label (a <label for> /… (Forms & labels).

For scale: Very large (~632,035 production lines); rebuilding it from scratch would take roughly ~7.3 person-years (~4–14 engineers). Approximate, ±~30%.

Encouragingly, the gaps are in documentation and release process — not in the code's correctness, structure or security, which are strong. They're low-risk to close, and doing so would lift the grade without re-engineering anything that already works.

How the score is built — each lens's share of the headline Width is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
Readiness 55% · 45% weightAccessibility 70% · 25% weightSecurity 77% · 14% weightCode Health 78% · 8% weightMaturity 79% · 4% weightArchitecture 90% · 2% weightDomain Modelling 100% · 1% weightEvent Sourcing 100% · 1% weight

Raise Readiness 55 → 70 (the Healthy floor) ⇒ headline 66 → ~73.

Code composition — where the lines go
Tests 100%
New since the last scan (100+)

200 finding(s) are new versus the previous scan (2026-07-20) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.

  • D1 · Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cyclomatic 96) crates/ty_python_semantic/src/types.rs
  • D1 · render::render_source_line (cyclomatic 72) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D1 · comparisons::infer_binary_type_comparison_inner (cyclomatic 72) crates/ty_python_semantic/src/types/infer/comparisons.rs
  • D1 · helpers::any_over_stmt::inner (cyclomatic 43) crates/ruff_python_ast/src/helpers.rs
  • D1 · render::render_snippet_annotations (cyclomatic 41) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D1 · equality::evaluate_structural_comparison (cyclomatic 35) crates/ty_python_semantic/src/types/equality.rs
  • D1 · helpers::any_over_expr::inner (cyclomatic 32) crates/ruff_python_ast/src/helpers.rs
  • D1 · SourceMap::annotated_lines (cyclomatic 29) crates/ruff_annotate_snippets/src/renderer/source_map.rs
  • D1 · SourceMap::splice_lines (cyclomatic 28) crates/ruff_annotate_snippets/src/renderer/source_map.rs
  • D1 · render::emit_suggestion_default (cyclomatic 28) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D1 · render::render (cyclomatic 26) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D1 · render::render_title (cyclomatic 24) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D1 · FormatImplicitConcatenatedStringFlat::new::merge_flags (cyclomatic 24) crates/ruff_python_formatter/src/string/implicit.rs
  • D1 · TypeInferenceBuilder::infer_typealiastype_assignment_deferred (cyclomatic 24) crates/ty_python_semantic/src/types/infer/builder.rs
  • D1 · overrides::check_inherited_method_conflicts (cyclomatic 24) crates/ty_python_semantic/src/types/overrides.rs
  • D1 · Type::try_iterate_with_mode::non_async_special_case (cyclomatic 23) crates/ty_python_semantic/src/types/iteration.rs
  • D1 · Document::propagate_expand::propagate_expands (cyclomatic 21) crates/ruff_formatter/src/format_element/document.rs
  • D1 · render::pre_process (cyclomatic 19) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D1 · class::any_member_declaration::any_stmt_in_body (cyclomatic 19) crates/ruff_python_semantic/src/analyze/class.rs
  • D1 · SpecializationBuilder::common_typed_dict_protocol_constraints (cyclomatic 19) crates/ty_python_semantic/src/types/generics.rs
  • D1 · NarrowingConstraintsBuilder::evaluate_expr_compare_op (cyclomatic 19) crates/ty_python_semantic/src/types/narrow.rs
  • D1 · TypeRelationChecker::check_type_satisfies_protocol (cyclomatic 18) crates/ty_python_semantic/src/types/instance.rs
  • D1 · ClassType::into_callable_with_receiver (cyclomatic 16) crates/ty_python_semantic/src/types/class.rs
  • D1 · Type::class_member_with_policy_inner (cyclomatic 16) crates/ty_python_semantic/src/types.rs
  • D2 · render::render_source_line (cognitive 121) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · render::render_snippet_annotations (cognitive 117) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · render::render (cognitive 67) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · TypeInferenceBuilder::infer_typealiastype_assignment_deferred (cognitive 65) crates/ty_python_semantic/src/types/infer/builder.rs
  • D2 · render::emit_suggestion_default (cognitive 62) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · SourceMap::splice_lines (cognitive 59) crates/ruff_annotate_snippets/src/renderer/source_map.rs
  • D2 · Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cognitive 56) crates/ty_python_semantic/src/types.rs
  • D2 · FormatImplicitConcatenatedStringFlat::new::merge_flags (cognitive 51) crates/ruff_python_formatter/src/string/implicit.rs
  • D2 · render::pre_process (cognitive 50) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · SourceMap::annotated_lines (cognitive 49) crates/ruff_annotate_snippets/src/renderer/source_map.rs
  • D2 · comparisons::infer_binary_type_comparison_inner (cognitive 47) crates/ty_python_semantic/src/types/infer/comparisons.rs
  • D2 · render::render_title (cognitive 44) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · overrides::check_inherited_method_conflicts (cognitive 40) crates/ty_python_semantic/src/types/overrides.rs
  • D2 · helpers::is_django_model_import::match_model_import (cognitive 38) crates/ruff_linter/src/rules/pep8_naming/helpers.rs
  • D2 · AssignmentAttributeWriteEvaluator::evaluate_class (cognitive 27) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs
  • D2 · ClassType::into_callable_with_receiver (cognitive 26) crates/ty_python_semantic/src/types/class.rs
  • D2 · PathAssignments::visit_inner (cognitive 24) crates/ty_python_semantic/src/types/constraints.rs
  • D2 · NarrowingConstraintsBuilder::evaluate_expr_compare_op (cognitive 24) crates/ty_python_semantic/src/types/narrow.rs
  • D2 · Type::try_iterate_with_mode::non_async_special_case (cognitive 24) crates/ty_python_semantic/src/types/iteration.rs
  • D2 · TypeInferenceBuilder::infer_callable_type::inner (cognitive 22) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs
  • D2 · Document::propagate_expand::propagate_expands (cognitive 21) crates/ruff_formatter/src/format_element/document.rs
  • D2 · helpers::any_over_stmt::inner (cognitive 21) crates/ruff_python_ast/src/helpers.rs
  • D2 · equality::evaluate_structural_comparison (cognitive 21) crates/ty_python_semantic/src/types/equality.rs
  • D2 · DisplayParameters::fmt_detailed::display_parameters (cognitive 20) crates/ty_python_semantic/src/types/display.rs
  • D2 · ide_support::direct_subtypes (cognitive 20) crates/ty_python_semantic/src/types/ide_support.rs
  • D2 · render::render_short_message (cognitive 19) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · StaticClassLiteral::try_metaclass::try_metaclass_inner (cognitive 18) crates/ty_python_semantic/src/types/class/static_literal.rs
  • D2 · OverloadLiteral::raw_signature (cognitive 18) crates/ty_python_semantic/src/types/function.rs
  • D2 · TypedDictType::openness::class_based_openness (cognitive 18) crates/ty_python_semantic/src/types/typed_dict.rs
  • D2 · equality::compare_nominal_instances (cognitive 18) crates/ty_python_semantic/src/types/equality.rs
  • D2 · overloaded_function::check_non_generic_overload_implementation_consistency (cognitive 18) crates/ty_python_semantic/src/types/infer/builder/post_inference/overloaded_function.rs
  • D2 · SectionContexts::from_docstring (cognitive 17) crates/ruff_linter/src/docstrings/sections.rs
  • D2 · class::any_member_declaration::any_stmt_in_body (cognitive 17) crates/ruff_python_semantic/src/analyze/class.rs
  • D2 · ArgumentTypeChecker::check_argument_type (cognitive 17) crates/ty_python_semantic/src/types/call/bind.rs
  • D2 · ArgumentTypeChecker::evaluate_paramspec_sub_call (cognitive 17) crates/ty_python_semantic/src/types/call/bind.rs
  • D2 · NodeId::is_never_satisfied (cognitive 17) crates/ty_python_semantic/src/types/constraints.rs
  • D2 · render::draw_line (cognitive 16) crates/ruff_annotate_snippets/src/renderer/render.rs
  • D2 · ProtocolClass::for_each_member_candidate (cognitive 16) crates/ty_python_semantic/src/types/protocol_class.rs
  • D3 · FileTooLong: infer/builder.rs crates/ty_python_semantic/src/types/infer/builder.rs
  • D3 · FileTooLong: src/types.rs crates/ty_python_semantic/src/types.rs
  • D3 · FileTooLong: call/bind.rs crates/ty_python_semantic/src/types/call/bind.rs
  • D3 · FileTooLong: types/constraints.rs crates/ty_python_semantic/src/types/constraints.rs
  • D3 · FileTooLong: types/diagnostic.rs crates/ty_python_semantic/src/types/diagnostic.rs
  • D3 · FileTooLong: src/builder.rs crates/ty_python_core/src/builder.rs
  • D3 · FileTooLong: types/signatures.rs crates/ty_python_semantic/src/types/signatures.rs
  • D3 · FileTooLong: types/narrow.rs crates/ty_python_semantic/src/types/narrow.rs
  • D3 · FileTooLong: types/display.rs crates/ty_python_semantic/src/types/display.rs
  • D3 · FileTooLong: src/options.rs crates/ruff_workspace/src/options.rs
  • D3 · FileTooLong: types/protocol_class.rs crates/ty_python_semantic/src/types/protocol_class.rs
  • D3 · FileTooLong: ast/mod.rs crates/ruff_linter/src/checkers/ast/mod.rs
  • D3 · FileTooLong: types/generics.rs crates/ty_python_semantic/src/types/generics.rs
  • D3 · FileTooLong: class/static_literal.rs crates/ty_python_semantic/src/types/class/static_literal.rs
  • D3 · FileTooLong: src/nodes.rs crates/ruff_python_ast/src/nodes.rs
  • D3 · FileTooLong: builder/type_expression.rs crates/ty_python_semantic/src/types/infer/builder/type_expression.rs
  • D3 · FileTooLong: types/relation.rs crates/ty_python_semantic/src/types/relation.rs
  • D3 · FileTooLong: types/typed_dict.rs crates/ty_python_semantic/src/types/typed_dict.rs
  • D3 · FileTooLong: types/tuple.rs crates/ty_python_semantic/src/types/tuple.rs
  • D3 · FileTooLong: src/use_def.rs crates/ty_python_core/src/use_def.rs
  • D3 · FileTooLong: renderer/render.rs crates/ruff_annotate_snippets/src/renderer/render.rs
  • D3 · FileTooLong: types/class.rs crates/ty_python_semantic/src/types/class.rs
  • D3 · FileTooLong: types/ide_support.rs crates/ty_python_semantic/src/types/ide_support.rs
  • D3 · FileTooLong: builder/subscript.rs crates/ty_python_semantic/src/types/infer/builder/subscript.rs
  • D3 · FileTooLong: class/known.rs crates/ty_python_semantic/src/types/class/known.rs
  • D3 · FileTooLong: src/completion.rs crates/ty_ide/src/completion.rs
  • D3 · FileTooLong: parser/expression.rs crates/ruff_python_parser/src/parser/expression.rs
  • D3 · FileTooLong: types/function.rs crates/ty_python_semantic/src/types/function.rs
  • D3 · FileTooLong: parser/statement.rs crates/ruff_python_parser/src/parser/statement.rs
  • D3 · FileTooLong: src/comparable.rs crates/ruff_python_ast/src/comparable.rs
  • D3 · FileTooLong: metadata/options.rs crates/ty_project/src/metadata/options.rs
  • D3 · FileTooLong: analyze/expression.rs crates/ruff_linter/src/checkers/ast/analyze/expression.rs
  • D3 · FileTooLong: src/configuration.rs crates/ruff_workspace/src/configuration.rs
  • D3 · FileTooLong: src/model.rs crates/ruff_python_semantic/src/model.rs
  • D3 · FileTooLong: src/place.rs crates/ty_python_semantic/src/place.rs
  • D3 · FileTooLong: src/lib.rs crates/ty_site_packages/src/lib.rs
  • D3 · FileTooLong: src/generator.rs crates/ruff_python_codegen/src/generator.rs
  • D3 · FileTooLong: types/typevar.rs crates/ty_python_semantic/src/types/typevar.rs

A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.

Rebuild cost & value ~ Modeled — €350,000–€1,800,000
Cost to rebuild€350,000–€1,800,000 (3.5–11.0 person-years (5,848–18,551 h), ~4–14 engineers)
Domain complexityStandard — harder problems cost more per line
Quality factor0.9× (at 66% quality) — the last 20% of quality is most of the work
Size & shapeVery large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
Dead frontend code~3 LoC unreachable (1 file(s)) — that slice of this estimate buys code with zero runtime value; deleting it is the cheapest win in this report (the R7 card lists every file)

This codebase represents roughly ~7.3 person-years of build effort (about ~€1,100,000 to rebuild). Its weakest lens is Readiness at 55% — the part of that asset most exposed by the findings below.

How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.2) — domain model × a 0.9× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).

Top priorities

The highest-leverage moves; the full ranked list is in the Roadmap below.

1
Add tests that import the unreached modules (directly or through their public entry).
+9.3 pts · Medium effort · Test Coverage
2
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
+9.2 pts · Medium effort · Dependency Hygiene
3
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
+2.6 pts · Medium effort · Forms & labels

Diagnosis — what's actually going on

Value concentrated against a weak lens · Medium · Value at risk
This is a Very large asset (~7.3 person-years to rebuild), and its weakest lens is Readiness at 55%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
Evidence: valuation: Very large, ~7.3 person-years rebuild (632,035 LoC) · weakest lens: Readiness 55%
→ Direct remediation budget at Readiness first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Add tests that import the unreached modules (directly or through their public entry). The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Add tests that import the unreached modules (directly or through their public entry).
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 5.4/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 6–14% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2 complexity, D4 duplication, D6 cohesion: averaging 5.4/10 across the code-quality signals
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.

At a glance — Code Health · 78% · Adequate · gated by D2

At a glance — Architecture · 90% · Exemplary

At a glance — Maturity · 79% · Strong

At a glance — Readiness · 55% · Adequate · gated by R4

At a glance — Security · 77% · Adequate · gated by D38

At a glance — Domain Modelling · 100% · Exemplary

At a glance — Event Sourcing · 100% · Exemplary

At a glance — Accessibility · 70% · Strong

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A06:2021 — Vulnerable & Outdated Components18High / Critical
A03:2021 — Injection5High / Critical
A05:2021 — Security Misconfiguration4High / Critical

Roadmap

Begin by establishing test coverage for all unreached production modules to ensure code is validated. Simultaneously, improve dependency hygiene by removing unused packages and explicitly declaring all imports. Next, address accessibility by adding programmatic labels to all form controls and buttons. Finally, enforce accessibility standards in the toolchain and refactor oversized components to improve maintainability.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Add tests that import the unreached modules (directly or through their public entry).+9.3 ptsMediumTest Coverage
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.+9.2 ptsMediumDependency Hygiene
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.+2.6 ptsMediumForms & labels
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.+2.6 ptsMediumA11y enforcement
Split the oversized components into smaller, focused ones.+0.8 ptsMediumLarge Files
Start an ADR log (docs/adr/) recording significant decisions and their rationale.+0.7 ptsMediumArchitecture documentation
Extract the duplicated blocks into shared functions/components.+0.6 ptsMediumCode Duplication
Resolve the 7 High CVE finding(s) in OSV Dependency Vulnerabilities — start with package-lock.json (7).+0.3 ptsLowOSV Dependency Vulnerabilities

File quality

Per-file score 0–10 — a quality signature. Of 414 files carrying findings, judged against the Preview bar: 0% slop · 2% mixed · 98% near-clean.

FileScoreBandWorst signal
playground/package-lock.json0.1SlopOSV Dependency Vulnerabilities: Critical CVE: [GHSA redacted]
Dockerfile5.1MixedIaC & Container Security: High IaC: DS-0002
playground/api/package-lock.json5.1MixedOSV Dependency Vulnerabilities: High CVE: [GHSA redacted]
crates/ruff_linter/src/checkers/ast/analyze/expression.rs5.9MixedCyclomatic Complexity: expression::expression (cyclomatic 504)
Cargo.lock6.1MixedOSV Dependency Vulnerabilities: Medium advisory (unmaintained): RUSTSEC-2024-0436
scripts/setup_primer_project.py6.2MixedStatic Analysis (SAST): Medium: dangerous-subprocess-use-tainted-env-args
crates/ty_python_semantic/src/dunder_all.rs6.3MixedCyclomatic Complexity: DunderAllNamesCollector::visit_stmt (cyclomatic 33)
crates/ty_server/src/capabilities.rs6.3MixedCyclomatic Complexity: ResolvedClientCapabilities::new (cyclomatic 25)
scripts/Dockerfile.ecosystem6.5MixedIaC & Container Security: High IaC: DS-0002
crates/ty_python_semantic/src/types/call/bind.rs7.0Near-cleanCyclomatic Complexity: Bindings::evaluate_known_cases (cyclomatic 214)
crates/ty_python_core/src/builder.rs7.0Near-cleanCyclomatic Complexity: SemanticIndexBuilder::visit_stmt_impl (cyclomatic 147)
crates/ruff_linter/src/checkers/ast/mod.rs7.0Near-cleanCyclomatic Complexity: Checker::visit_expr (cyclomatic 114)
crates/ty_python_semantic/src/types/infer/builder/type_expression.rs7.0Near-cleanCyclomatic Complexity: TypeInferenceBuilder::infer_type_expression_no_store (cyclomatic 111)
crates/ty_python_semantic/src/types/infer/builder.rs7.0Near-cleanCyclomatic Complexity: TypeInferenceBuilder::infer_call_expression_impl (cyclomatic 97)
crates/ty_python_semantic/src/types.rs7.0Near-cleanCyclomatic Complexity: Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cyclomatic 96)
crates/ty_python_semantic/src/types/display.rs7.0Near-cleanCyclomatic Complexity: DisplayRepresentation::fmt_detailed (cyclomatic 89)
crates/ruff_annotate_snippets/src/renderer/render.rs7.0Near-cleanCyclomatic Complexity: render::render_source_line (cyclomatic 72)
crates/ty_python_semantic/src/types/set_theoretic/builder.rs7.0Near-cleanCyclomatic Complexity: UnionBuilder::add_in_place_impl (cyclomatic 72)
crates/ty_python_semantic/src/types/class/static_literal.rs7.0Near-cleanCyclomatic Complexity: StaticClassLiteral::own_synthesized_member (cyclomatic 71)
crates/ty_python_semantic/src/types/infer/builder/subscript.rs7.0Near-cleanCyclomatic Complexity: TypeInferenceBuilder::infer_explicit_callable_specialization_impl (cyclomatic 69)

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 46 of 47 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 1 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.6 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 47 dimensions across the health lenses
D1D2D3D4D13D15D16D21D28D29D31D33D34D35D36D38AC2AC3AC4AC5AC6AC7AX9DM2DM4DM5DM6ES1ES2M1M2M3M4P1P3P4P6R1R10R2R3R4R5R6R7R8R9

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1208 of 1220 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
jscpdCode duplication✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.302✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.302✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 019faef9-aa45-7c0c-a94e-409debb85221.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D19 Documentation Quality — LLM provider failed — The model provider returned an unusable result, so this LLM-assisted dimension fell back to a measurement gap (confidence 0) rather than a penalty. Re-run with a reachable provider to score it.
  • D30 Dependency Vulnerabilities — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.

Repo exclusion declarations: 29 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity (jscpd) — it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D33 JS/npm Dependency Vulnerabilities: JS/npm CVE matching reads package manifests and lockfiles — risk from how a dependency is used, and advisories not yet published, fall outside this scan.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A clean result is "no unlabelled native control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (2): D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score (documentation, ADR quality, naming, comment value, onboarding) — D25 sets the ADR-conformance fraction over sampled code, D22 judges API accuracy over a sample. These are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

D1 · Cyclomatic Complexity4.3 / 10Weak✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: DocumentedVerifiedPrevented · effective 4.3 / 10 · rule-coverage 100% · ceiling Prevented

357 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was expression::expression at 504. A further 80 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being codes::code_to_rule at 984 — they are counted neither in the figure above nor in this dimension's score.

TypeInferenceBuilder::infer_type_expression_no_store (cyclomatic 111) · ×45crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:135
Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cyclomatic 96) · ×13crates/ty_python_semantic/src/types.rs:3790
Parser::parse_parameters (cyclomatic 33) · ×7crates/ruff_python_parser/src/parser/statement.rs:3310
render::render_source_line (cyclomatic 72) · ×6crates/ruff_annotate_snippets/src/renderer/render.rs:895
StaticClassLiteral::own_synthesized_member (cyclomatic 71) · ×6crates/ty_python_semantic/src/types/class/static_literal.rs:1387

+ 229 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 45 TypeInferenceBuilder finding(s) in Cyclomatic Complexity — start with builder.rs (15), type_expression.rs (7), subscript.rs (5). — One of this dimension's main actionable groups (45 warning-level).
  2. Resolve the 13 Type finding(s) in Cyclomatic Complexity — start with types.rs (9), subscript.rs, bool.rs. — One of this dimension's main actionable groups (13 warning-level).
  3. Resolve the 7 Parser finding(s) in Cyclomatic Complexity — start with expression.rs (3), statement.rs (2), parser.rs (2). — One of this dimension's main actionable groups (7 warning-level).
  4. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: DocumentedVerifiedPrevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

650 method(s) exceeded the cognitive complexity threshold of 15; the worst was expression::expression at 731.

TypeInferenceBuilder::infer_parameterized_special_form_type_expression (cognitive 211) · ×63crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:1981
Parser::parse_impl (cognitive 84) · ×17crates/mdtest/src/parser.rs:591
Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cognitive 56) · ×13crates/ty_python_semantic/src/types.rs:3790
StaticClassLiteral::own_synthesized_member (cognitive 93) · ×9crates/ty_python_semantic/src/types/class/static_literal.rs:1387
TypeRelationChecker::check_signature_pair_inner (cognitive 458) · ×8crates/ty_python_semantic/src/types/signatures.rs:2175

+ 389 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 63 TypeInferenceBuilder finding(s) in Cognitive Complexity — start with builder.rs (24), type_expression.rs (8), subscript.rs (5). — One of this dimension's main actionable groups (63 warning-level).
  2. Resolve the 17 Parser finding(s) in Cognitive Complexity — start with expression.rs (7), statement.rs (5), parser.rs (2). — One of this dimension's main actionable groups (17 warning-level).
  3. Resolve the 13 Type finding(s) in Cognitive Complexity — start with types.rs (8), iteration.rs (2), bool.rs. — One of this dimension's main actionable groups (13 warning-level).
  4. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes9.1 / 10Exemplary✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: DocumentedVerifiedPrevented · effective 9.1 / 10 · rule-coverage 100% · ceiling Prevented

154 god class(es) detected.

FileTooLong: infer/builder.rs · ×117crates/ty_python_semantic/src/types/infer/builder.rs:0
TooManyMethods: TypeInferenceBuilder · ×26crates/ty_python_semantic/src/types/infer/builder.rs:251
TooManyFunctions: crate::types::diagnostic · ×11crates/ty_python_semantic/src/types/diagnostic.rs:58

✓ On the Gold path — maintain.

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication10.0 / 10Exemplary✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 duplicated block group(s) detected.

✓ On the Gold path — maintain.

Detailed fixes: d4_recommendation.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D15 · Churn × Complexity Hotspots8.8 / 10Strong✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: DocumentedVerifiedPrevented · effective 8.8 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: crates/ruff_linter/src/codes.rs (15×984=14760); crates/ty_python_semantic/src/types.rs (130×107=13910); crates/ty_python_semantic/src/types/call/bind.rs (60×214=12840)

Hotspot: crates/ruff_linter/src/codes.rs · ×10crates/ruff_linter/src/codes.rs

What to do

  1. Resolve the 10 Hotspot finding(s) in Churn × Complexity Hotspots — start with builder.rs (2), codes.rs, types.rs. — One of this dimension's main actionable groups (10 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.6 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: DocumentedVerifiedPrevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

60 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is crates/ty_python_semantic/src/types/equality.rs.

Off-boarding risk: anonymized user #1 · ×4
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D21 · Naming Consistency / 10Exemplary◐ Sampled · advisory

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

Maturity: DocumentedVerifiedPrevented · effective Exemplary / 10 · rule-coverage 100% · ceiling Verified

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: Git-history secret scan via gitleaks detect over full history in an isolated checkout; each match flagged High. Exhaustive; degrades cleanly when tool absent.

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)7.4 / 10Strong✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: DocumentedVerifiedPrevented · effective 7.4 / 10 · rule-coverage 100% · ceiling Documented

5 finding(s): 0 critical, 1 high, 2 medium, 2 low.

High: eval-detectedscripts/generate_builtin_modules.py:52detected by semgrep finding
Medium: dangerous-subprocess-use-tainted-env-args · ×2scripts/setup_primer_project.py:142detected by semgrep finding
Low: dynamic-urllib-use-detected · ×2scripts/publish-crates.py:80detected by semgrep finding

What to do

  1. Resolve the 1 High finding(s) in Static Analysis (SAST) — start with generate_builtin_modules.py. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 2 Medium finding(s) in Static Analysis (SAST) — start with setup_primer_project.py (2). — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 2 Low finding(s) in Static Analysis (SAST) — start with publish-crates.py, setup_primer_project.py. — One of this dimension's main actionable groups (2 recommendation-level).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security9.2 / 10Exemplary✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: DocumentedVerifiedPrevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Documented

5 finding(s): 0 critical, 2 high, 1 medium, 2 low.

High IaC: DS-0002 · ×2Dockerfiledetected by trivy finding
Medium IaC: DS-0001Dockerfiledetected by trivy finding
Low IaC: DS-0005scripts/Dockerfile.ecosystemdetected by trivy finding

✓ On the Gold path — maintain.

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D33 · JS/npm Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether JavaScript/npm dependencies have known published vulnerabilities (CVEs) — the npm ecosystem's biggest risk.

Method: JS/npm CVE scan via trivy fs --scanners vuln over JS manifests (package.json/yarn.lock/pnpm-lock/bun.lockb); 0-10 tight normalizer. NotApplicable without JS manifests. Exhaustive, deterministic.

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No known-vulnerable JS/npm dependencies.

✓ On the Gold path — maintain.

Detailed fixes: d33_recommendation.md.

D34 · Knowledge Freshness9.4 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: DocumentedVerifiedPrevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Documented

76 of 1353 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/ruff_python_literal/src/cformat.rs.

Further orphaned files (smaller)

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.8 / 10Exemplary✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling; coupling through a build step, config, or non-source file isn't seen.

Maturity: DocumentedVerifiedPrevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: mod.rs↔check_docstring.rs 70%; fix.rs↔lint.rs 65%; testing.rs↔program.rs 65%

Change coupling: mod.rs ↔ check_docstring.rs · ×10crates/ruff_linter/src/rules/pydoclint/mod.rs

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing7.5 / 10Strong✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: DocumentedVerifiedPrevented · effective 7.5 / 10 · rule-coverage 100% · ceiling Documented

3/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

No SBOM

What to do

  1. Resolve the 1 No SBOM finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D38 · OSV Dependency Vulnerabilities2.2 / 10Critical✓ Tool-verified

What it measures: Whether dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.

Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.

Maturity: DocumentedVerifiedPrevented · effective 2.2 / 10 · rule-coverage 100% · ceiling Documented

18 finding(s): 1 critical, 8 high, 8 medium, 1 low.

High CVE: [GHSA redacted] · ×7playground/package-lock.jsondetected by osv-scanner finding
Critical CVE: [GHSA redacted]playground/package-lock.jsondetected by osv-scanner finding
High vulnerability: [GHSA redacted]playground/api/package-lock.jsondetected by osv-scanner finding
Medium CVE: [GHSA redacted] · ×3playground/package-lock.jsondetected by osv-scanner finding
Medium advisory (unmaintained): RUSTSEC-2024-0436 · ×2Cargo.lockdetected by osv-scanner finding

+ 3 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 7 High CVE finding(s) in OSV Dependency Vulnerabilities — start with package-lock.json (7). — One of this dimension's main actionable groups (7 issue-level).
  2. Resolve the 1 Critical CVE finding(s) in OSV Dependency Vulnerabilities — start with package-lock.json. — One of this dimension's main actionable groups (1 issue-level).
  3. Resolve the 1 High vulnerability finding(s) in OSV Dependency Vulnerabilities — start with package-lock.json. — One of this dimension's main actionable groups (1 issue-level).

Detailed fixes: d38_recommendation.md · top locations in Appendix A, every location in findings.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC2 · Forms & labels4.8 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

  • A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. (×2) — Header.tsx:97, RepoButton.tsx:3
  • This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — Files.tsx:182

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

AC4 · Keyboard semantics10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.

AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

AC6 · Visual & motion safety10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an a11y linter (eslint-plugin-jsx-a11y / vuejs-accessibility) configured, and axe/pa11y/Lighthouse wired into tests or CI — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an a11y linter (eslint-plugin-jsx-a11y / vuejs-accessibility) configured, and axe/pa11y/Lighthouse in tests or CI, graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

  • No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time.

What to do

  • Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

DM2 · Strongly-typed ids10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether domain identifiers are strongly typed (a newtype wrapper) rather than raw primitives — consistency once an idiom exists.

Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. Deterministic, adoption percentage.

Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.

DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.

Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.

Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.

DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.

Method: Roslyn (DDD-gated): public setters on entities detected; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.

Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (diesel/sea-orm/sqlx) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.

Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)8.5 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 38 of 90 project(s) that lack one — worth up to 0.8 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — decisions aren't captured for future maintainers.

What to do

  • Start an ADR log (docs/adr/) recording significant decisions and their rationale.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary◐ Sampled · advisory

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P3 · Security & performance tooling6.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

R10 · Code Duplication8.3 / 10Strong✓ Tool-verified

React / JS · Code Health — Copy-pasted token-identical blocks across the frontend (the D4 clone algorithm over JS/TS tokens, D-386).

Method: Copy-pasted token-identical blocks across the frontend (the D4 clone algorithm run over JS/TS tokens). Deterministic.

  • playground/shared/src/setupMonaco.tsx:630 · playground/shared/src/setupMonaco.tsx:686 — setupMonaco.tsx:630
  • playground/shared/src/Icons.tsx:203 · playground/shared/src/Icons.tsx:230 · playground/shared/src/Icons.tsx:253 · playground/shared/src/Icons.tsx:274 — Icons.tsx:203
  • playground/ruff/src/Editor/Diagnostics.tsx:32 · playground/ty/src/Editor/Diagnostics.tsx:38 — Diagnostics.tsx:32
  • playground/ruff/src/Editor/Editor.tsx:181 · playground/ty/src/Editor/Chrome.tsx:290 — Editor.tsx:181
  • playground/ruff/src/Editor/SecondaryPanel.tsx:153 · playground/ty/src/Editor/SecondaryPanel.tsx:57 — SecondaryPanel.tsx:153
  • playground/ty/src/Editor/Editor.tsx:724 · playground/ty/src/Editor/Editor.tsx:743 · playground/ty/src/Editor/Editor.tsx:762 · playground/ty/src/Editor/Editor.tsx:783 — Editor.tsx:724
  • playground/ruff/src/Editor/Diagnostics.tsx:145 · playground/ty/src/Editor/Diagnostics.tsx:256 — Diagnostics.tsx:145
  • playground/ruff/src/Editor/SettingsEditor.tsx:30 · playground/ruff/src/Editor/SettingsEditor.tsx:51 — SettingsEditor.tsx:30

What to do

  • Extract the duplicated blocks into shared functions/components.
R2 · Cyclomatic Complexity8.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • Branch-heavy code is where defects cluster — extract decisions into smaller functions. (×4) — Chrome.tsx:267, SecondaryPanel.tsx:26, Playground.tsx:438, …

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files7.2 / 10Strong✓ Tool-verified

React / JS · Code Health — How many components/modules exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

What to do

  • Split the oversized components into smaller, focused ones.
R4 · Test Coverage0.0 / 10Critical✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively — its behavior is unverified. (×8) — Editor.tsx, setupMonaco.tsx, Playground.tsx, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D33 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D33). Deterministic.

R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code9.5 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • 1 file(s) (~38 LoC) were excluded from dead-code analysis — declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package. — playground
  • Unreachable from the 4 application, 8 tooling and 0 test entry point(s) detected in this repo. Gate removals on your build/type-check — an undetected custom entry would make these reachable.
  • no import path from any entry point (4 application, 8 tooling, 0 test roots considered) — index.tsx
  • Nothing imports this binding — it is safe to review for removal. (×5) — setupMonaco.tsx:7, setupMonaco.tsx:9, setupMonaco.tsx:11, …

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene6.0 / 10Adequate✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Declared in playground/package.json but never imported anywhere in that package or its workspace members — dead weight and attack surface. Verify against build tooling before removing.
  • Declared in playground/api/package.json but never imported anywhere in that package or its workspace members — dead weight and attack surface. Verify against build tooling before removing. (×2)
  • Every import is type-only — move it to devDependencies. — DiagnosticDetail.tsx:1

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports7.8 / 10Strong✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

  • playground/ty/src/Editor/Chrome.tsx → playground/ty/src/Editor/Editor.tsx → playground/ty/src/Playground.tsx → playground/ty/src/Editor/Chrome.tsx — Chrome.tsx

What to do

  • Break each cycle by extracting the shared piece into a module both sides can import.

WCAG coverage — what static analysis assessed

Statically assessed 12 of 55 WCAG 2.2 Level A/AA success criteria (22%; ≈24% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 43 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 43 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health78%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture90%ExemplarySolid.
Maturity79%StrongSolid.
Readiness55%Adequate — gated by R4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security77%Adequate — gated by D38Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling100%ExemplaryStrongest area.
Event Sourcing100%ExemplarySolid.
Accessibility70%StrongSolid.
Not included — 66 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
  • AX1 Captive dependencies — no DI registrations detected
  • AX10 Code composition — not assessed — code composition is computed by ROLE over the .NET document set and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX2 Stateful singletons — no singleton implementations detected
  • AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over the .NET project-reference graph and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over the .NET project-reference graph and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from the .NET project graph (projects, types, namespaces) and no such graph was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over the .NET type surface and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — not assessed — test isolation is computed from the .NET project graph (which projects are test projects, and what they reference) and no such graph was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • AXB2 Runtime readiness — no data
  • C1 Data Protection — Not assessed: these personal data controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C3 Audit Trail — Not assessed: these audit controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~128786 lines of test source are present (.rs, .py) but the test-quality collector reads C# only, so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included
  • D12 Dependency Hygiene — Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • D14 License Compliance — Not scored — this repository's package manifest is not parsed for licence data yet. A gap in the analyzer's language coverage, NOT a finding that the repository's licenses are compliant (a Cargo manifest, a Python pyproject.toml/requirements.txt (pip/uv/Poetry), package.json), which this pass does not parse yet — so this dimension asserts nothing about this repository's licensing in either direction.
  • D17 Explicit Debt — explicit-debt markers are read through a C# workspace today, so they were not read for this repository's language — this asserts nothing about how many markers the code carries. Not scored — this is a gap in the analyzer, not a finding about this repository
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D19 Documentation Quality — LLM evaluation failed
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • D22 Internal API Consistency — No exposed public API
  • D23 Boundary Type-Coupling — Production source is present (.py, .rs, .ts, .tsx) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["Acme.Billing"]`, `Catalog: ["Acme.Catalog"]`.
  • D24 Comment Value — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
  • D27 Navigability — No calls could be sampled, so navigability was not assessed — tracing effort is measured over resolved call sites and this target exposed none. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
  • D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Cargo manifest, a Python pyproject.toml/requirements.txt (pip/uv/Poetry), package.json — not scanned yet) — where an OSV-supported manifest exists, dependency vulnerabilities for this repository are reported under D38 instead.
  • D32 Data Compliance (PII/GDPR) — No PII/GDPR ruleset is bundled (the public p/gdpr semgrep pack was retired) — data compliance is not assessed in this scan.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
  • D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a C#/VB class graph, and this repository's production source is .py, .rs, .ts, .tsx, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D7 Architectural Integrity — no checkable ADRs and no dependency cycles — architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • D9 Test Distribution — Test source is present (.rs, .py) but the test-pyramid classifier reads C# only, so its unit/integration/BDD/E2E split couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • DM1 Aggregate boundaries — not gated in Rust source-only: aggregate-vs-value-object classification is not 0-FP-separable (every struct-holding-struct reads alike), and a child COLLECTION (legitimate membership) vs a single embedded aggregate is indistinguishable — advisory (the Swift/Dart parity)
  • DM3 Integration-event coupling — not gated in Rust source-only: a cross-crate domain leak is not 0-FP-separable from a legitimate shared-kernel crate, and the corpus is predominantly single-crate — advisory (candidate-demote, schema §6.1/§13)
  • DM7 Repository granularity — not gated in Rust source-only: 'a repository per CHILD entity' needs the aggregate-root structure, which is not source-resolvable; the softest gated dim (schema §6.1 sanctions the advisory demote) — advisory
  • ED2 Event/command shape — not gated in Rust source-only: a command with >1 competing handler needs a dispatch/call graph the source-only frontend cannot resolve (inferred/generic call owners decline) — advisory
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • GD1 Unfinished & placeholder code — no source files
  • IC1 Incompleteness & stubs — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — no data
  • P2 Observability — Observability was not assessed: this check reads .NET source (ILogger/Serilog, OpenTelemetry, health checks) and no such source carries this repository's product — because it is written in another language, or because the solution failed to load. Absence of a .NET logging idiom is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
  • P7 Outbound HTTP resilience — not applicable — this isn't a service/API/worker
  • P8 Schema migrations — not assessed — schema-migration practice is read from EF Core usage in .NET source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo llvm-cov --lcov --output-path lcov.info`) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • PF2 Allocation hygiene — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • PF3 Async & latency hygiene — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — no data
  • X1 Async correctness — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • X2 Cancellation propagation — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • X3 Exception handling — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • X4 Structured logging — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Issue — 12 finding(s)
D38 · OSV Dependency Vulnerabilities · High CVE · ×7
  • High CVE: [GHSA redacted] playground/package-lock.json — brace-expansion 1.1.11: [GHSA redacted] — brace-expansion is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin brace-expansion to 1.1.16 with an `overrides` entry). This is 1 of 4 advisories this scan raises against brace-expansion 1.1.11, and their fixed versions do not agree — anything below 1.1.16 still leaves at least one of them open, so 1.1.16 is the floor for this package, not this row's target alone. One upgrade of brace-expansion 1.1.11 clears all 4 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted].
  • High CVE: [GHSA redacted] playground/api/package-lock.json — cross-spawn 7.0.3: [GHSA redacted] — cross-spawn is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin cross-spawn to 7.0.5 with an `overrides` entry).
  • High CVE: [GHSA redacted] playground/package-lock.json — flatted 3.3.3: [GHSA redacted] — flatted is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin flatted to 3.4.0 with an `overrides` entry). This is 1 of 2 advisories this scan raises against flatted 3.3.3, and their fixed versions do not agree — anything below 3.4.2 still leaves at least one of them open, so 3.4.2 is the floor for this package, not this row's target alone. One upgrade of flatted 3.3.3 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
  • High CVE: [GHSA redacted] playground/package-lock.json — js-yaml 4.1.0: [GHSA redacted] — js-yaml is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin js-yaml to 4.3.0 with an `overrides` entry). This is 1 of 3 advisories this scan raises against js-yaml 4.1.0, and their fixed versions do not agree — anything below 4.3.0 still leaves at least one of them open, so 4.3.0 is the floor for this package, not this row's target alone. One upgrade of js-yaml 4.1.0 clears all 3 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted].
  • High CVE: [GHSA redacted] playground/package-lock.json — minimatch 3.1.2: [GHSA redacted] — minimatch is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin minimatch to 3.1.4 with an `overrides` entry). This is 1 of 3 advisories this scan raises against minimatch 3.1.2, and their fixed versions do not agree — anything below 3.1.4 still leaves at least one of them open, so 3.1.4 is the floor for this package, not this row's target alone. One upgrade of minimatch 3.1.2 clears all 3 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted].
  • High CVE: [GHSA redacted] playground/api/package-lock.json — picomatch 2.3.1: [GHSA redacted] — picomatch is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin picomatch to 2.3.2 with an `overrides` entry). (in 2 lockfiles) One upgrade of picomatch 2.3.1 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
  • High CVE: [GHSA redacted] playground/package-lock.json — ws 8.18.2: [GHSA redacted] — ws is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin ws to 8.21.0 with an `overrides` entry). This is 1 of 2 advisories this scan raises against ws 8.18.2, and their fixed versions do not agree — anything below 8.21.0 still leaves at least one of them open, so 8.21.0 is the floor for this package, not this row's target alone. One upgrade of ws 8.18.2 clears all 2 advisories it raises: [GHSA redacted], [GHSA redacted].
D31 · IaC & Container Security · High IaC · ×2
  • High IaC: DS-0002 Dockerfile — Image user should not be 'root'
  • High IaC: DS-0002 scripts/Dockerfile.ecosystem — Image user should not be 'root'
D29 · Static Analysis (SAST) · High · ×1
  • High: eval-detected scripts/generate_builtin_modules.py:52 — Detected the use of eval(). eval() can be dangerous if used to evaluate dynamic content. If this content can be input from outside the program, this may be a code injection vulnerability. Ensure evaluated content is not definable by external sources. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
D38 · OSV Dependency Vulnerabilities · Critical CVE · ×1
  • Critical CVE: [GHSA redacted] playground/package-lock.json — tar 7.5.15: [GHSA redacted] — tar is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin tar to 7.5.19 with an `overrides` entry). This is 1 of 6 advisories this scan raises against tar 7.5.15, and their fixed versions do not agree — anything below 7.5.21 still leaves at least one of them open, so 7.5.21 is the floor for this package, not this row's target alone. One upgrade of tar 7.5.15 clears all 6 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted].
D38 · OSV Dependency Vulnerabilities · High vulnerability · ×1
  • High vulnerability: [GHSA redacted] playground/api/package-lock.json — sharp 0.34.5: [GHSA redacted] — sharp is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin sharp to 0.35.0 with an `overrides` entry).
Warning — 1193 finding(s)
D3 · God Classes · FileTooLong · ×117
  • FileTooLong: infer/builder.rs crates/ty_python_semantic/src/types/infer/builder.rs:0 — FileTooLong — 7679 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: src/types.rs crates/ty_python_semantic/src/types.rs:0 — FileTooLong — 5396 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: call/bind.rs crates/ty_python_semantic/src/types/call/bind.rs:0 — FileTooLong — 5235 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/constraints.rs crates/ty_python_semantic/src/types/constraints.rs:0 — FileTooLong — 4325 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/diagnostic.rs crates/ty_python_semantic/src/types/diagnostic.rs:0 — FileTooLong — 3209 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: src/builder.rs crates/ty_python_core/src/builder.rs:0 — FileTooLong — 3202 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/signatures.rs crates/ty_python_semantic/src/types/signatures.rs:0 — FileTooLong — 3183 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/narrow.rs crates/ty_python_semantic/src/types/narrow.rs:0 — FileTooLong — 2885 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/display.rs crates/ty_python_semantic/src/types/display.rs:0 — FileTooLong — 2295 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: src/options.rs crates/ruff_workspace/src/options.rs:0 — FileTooLong — 2245 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/protocol_class.rs crates/ty_python_semantic/src/types/protocol_class.rs:0 — FileTooLong — 2242 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: ast/mod.rs crates/ruff_linter/src/checkers/ast/mod.rs:0 — FileTooLong — 2195 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/generics.rs crates/ty_python_semantic/src/types/generics.rs:0 — FileTooLong — 2127 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: class/static_literal.rs crates/ty_python_semantic/src/types/class/static_literal.rs:0 — FileTooLong — 2082 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: src/nodes.rs crates/ruff_python_ast/src/nodes.rs:0 — FileTooLong — 2038 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: builder/type_expression.rs crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:0 — FileTooLong — 2032 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/relation.rs crates/ty_python_semantic/src/types/relation.rs:0 — FileTooLong — 1993 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/typed_dict.rs crates/ty_python_semantic/src/types/typed_dict.rs:0 — FileTooLong — 1978 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/tuple.rs crates/ty_python_semantic/src/types/tuple.rs:0 — FileTooLong — 1800 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: src/use_def.rs crates/ty_python_core/src/use_def.rs:0 — FileTooLong — 1794 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: renderer/render.rs crates/ruff_annotate_snippets/src/renderer/render.rs:0 — FileTooLong — 1762 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/class.rs crates/ty_python_semantic/src/types/class.rs:0 — FileTooLong — 1724 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: types/ide_support.rs crates/ty_python_semantic/src/types/ide_support.rs:0 — FileTooLong — 1723 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: builder/subscript.rs crates/ty_python_semantic/src/types/infer/builder/subscript.rs:0 — FileTooLong — 1686 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • FileTooLong: class/known.rs crates/ty_python_semantic/src/types/class/known.rs:0 — FileTooLong — 1665 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted).
  • + 92 more in this group — see findings.md.
D2 · Cognitive Complexity · TypeInferenceBuilder · ×63
  • TypeInferenceBuilder::infer_parameterized_special_form_type_expression (cognitive 211) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:1981 — TypeInferenceBuilder::infer_parameterized_special_form_type_expression has cognitive complexity 211 (threshold 15). Drivers by points: if/else 165, loops 29, match/switch 12, boolean chains 5 (nesting depth added 110). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_type_expression_no_store (cognitive 189) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:135 — TypeInferenceBuilder::infer_type_expression_no_store has cognitive complexity 189 (threshold 15). Drivers by points: if/else 150, match/switch 18, loops 13, boolean chains 8 (nesting depth added 112). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_call_expression_impl (cognitive 173) crates/ty_python_semantic/src/types/infer/builder.rs:8419 — TypeInferenceBuilder::infer_call_expression_impl has cognitive complexity 173 (threshold 15). Drivers by points: if/else 120, match/switch 25, boolean chains 21, loops 7 (nesting depth added 86). Of this number, 167 points are the body's own statements and 6 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_explicit_callable_specialization_impl (cognitive 156) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:566 — TypeInferenceBuilder::infer_explicit_callable_specialization_impl has cognitive complexity 156 (threshold 15). Drivers by points: if/else 116, boolean chains 15, loops 14, match/switch 11 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_subscript_type_expression (cognitive 129) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:1472 — TypeInferenceBuilder::infer_subscript_type_expression has cognitive complexity 129 (threshold 15). Drivers by points: if/else 119, match/switch 8, loops 2 (nesting depth added 83). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_annotated_assignment_definition (cognitive 120) crates/ty_python_semantic/src/types/infer/builder.rs:4138 — TypeInferenceBuilder::infer_annotated_assignment_definition has cognitive complexity 120 (threshold 15). Drivers by points: if/else 87, match/switch 20, boolean chains 11, loops 2 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::validate_typevar_default (cognitive 116) crates/ty_python_semantic/src/types/infer/builder/typevar.rs:166 — TypeInferenceBuilder::validate_typevar_default has cognitive complexity 116 (threshold 15). Drivers by points: if/else 103, loops 8, match/switch 4, boolean chains 1 (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::validate_subscript_assignment_impl (cognitive 108) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:1630 — TypeInferenceBuilder::validate_subscript_assignment_impl has cognitive complexity 108 (threshold 15). Drivers by points: if/else 85, boolean chains 9, match/switch 8, loops 6 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_collection_literal_impl (cognitive 98) crates/ty_python_semantic/src/types/infer/builder.rs:6967 — TypeInferenceBuilder::infer_collection_literal_impl has cognitive complexity 98 (threshold 15). Drivers by points: if/else 62, loops 25, boolean chains 9, match/switch 2 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_namedtuple_call_expression (cognitive 94) crates/ty_python_semantic/src/types/infer/builder/named_tuple.rs:30 — TypeInferenceBuilder::infer_namedtuple_call_expression has cognitive complexity 94 (threshold 15). Drivers by points: if/else 59, boolean chains 15, match/switch 14, loops 6 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::validate_subscript_deletion_impl (cognitive 78) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:2049 — TypeInferenceBuilder::validate_subscript_deletion_impl has cognitive complexity 78 (threshold 15). Drivers by points: if/else 60, match/switch 10, boolean chains 4, loops 4 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_attribute_load_impl (cognitive 69) crates/ty_python_semantic/src/types/infer/builder.rs:10011 — TypeInferenceBuilder::infer_attribute_load_impl has cognitive complexity 69 (threshold 15). Drivers by points: if/else 51, match/switch 8, boolean chains 5, loops 5 (nesting depth added 37). Of this number, 65 points are the body's own statements and 4 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_annotated_assignment_statement (cognitive 68) crates/ty_python_semantic/src/types/infer/builder.rs:3948 — TypeInferenceBuilder::infer_annotated_assignment_statement has cognitive complexity 68 (threshold 15). Drivers by points: if/else 54, match/switch 6, boolean chains 5, loops 3 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_annotation_expression_impl (cognitive 67) crates/ty_python_semantic/src/types/infer/builder/annotation_expression.rs:103 — TypeInferenceBuilder::infer_annotation_expression_impl has cognitive complexity 67 (threshold 15). Drivers by points: if/else 36, match/switch 21, boolean chains 5, loops 5 (nesting depth added 38). Of this number, 54 points are the body's own statements and 13 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_typeddict_call_expression (cognitive 65) crates/ty_python_semantic/src/types/infer/builder/typed_dict.rs:72 — TypeInferenceBuilder::infer_typeddict_call_expression has cognitive complexity 65 (threshold 15). Drivers by points: if/else 37, loops 16, boolean chains 8, match/switch 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_typealiastype_assignment_deferred (cognitive 65) crates/ty_python_semantic/src/types/infer/builder.rs:3786 — TypeInferenceBuilder::infer_typealiastype_assignment_deferred has cognitive complexity 65 (threshold 15). Drivers by points: if/else 55, loops 5, match/switch 3, boolean chains 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::validate_attribute_deletion (cognitive 64) crates/ty_python_semantic/src/types/infer/builder.rs:2813 — TypeInferenceBuilder::validate_attribute_deletion has cognitive complexity 64 (threshold 15). Drivers by points: if/else 38, match/switch 18, boolean chains 6, loops 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_class_definition (cognitive 61) crates/ty_python_semantic/src/types/infer/builder/class.rs:81 — TypeInferenceBuilder::infer_class_definition has cognitive complexity 61 (threshold 15). Drivers by points: if/else 40, match/switch 10, loops 8, boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_function_definition (cognitive 60) crates/ty_python_semantic/src/types/infer/builder/function.rs:294 — TypeInferenceBuilder::infer_function_definition has cognitive complexity 60 (threshold 15). Drivers by points: if/else 28, match/switch 13, boolean chains 10, loops 9 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_binary_expression_type_impl (cognitive 59) crates/ty_python_semantic/src/types/infer/builder/binary_expressions.rs:299 — TypeInferenceBuilder::infer_binary_expression_type_impl has cognitive complexity 59 (threshold 15). Drivers by points: if/else 39, match/switch 13, boolean chains 7 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_subscript_load_impl (cognitive 57) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:169 — TypeInferenceBuilder::infer_subscript_load_impl has cognitive complexity 57 (threshold 15). Drivers by points: if/else 39, match/switch 9, boolean chains 5, loops 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_tuple_type_expression (cognitive 56) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:1061 — TypeInferenceBuilder::infer_tuple_type_expression has cognitive complexity 56 (threshold 15). Drivers by points: if/else 48, boolean chains 5, loops 2, match/switch 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_place_load (cognitive 52) crates/ty_python_semantic/src/types/infer/builder.rs:9583 — TypeInferenceBuilder::infer_place_load has cognitive complexity 52 (threshold 15). Drivers by points: if/else 34, boolean chains 8, match/switch 6, loops 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_dict_expression (cognitive 50) crates/ty_python_semantic/src/types/infer/builder.rs:6791 — TypeInferenceBuilder::infer_dict_expression has cognitive complexity 50 (threshold 15). Drivers by points: if/else 38, loops 11, boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeInferenceBuilder::infer_function_body (cognitive 46) crates/ty_python_semantic/src/types/infer/builder/function.rs:118 — TypeInferenceBuilder::infer_function_body has cognitive complexity 46 (threshold 15). Drivers by points: if/else 33, loops 7, boolean chains 3, match/switch 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 38 more in this group — see findings.md.
D1 · Cyclomatic Complexity · TypeInferenceBuilder · ×45
  • TypeInferenceBuilder::infer_type_expression_no_store (cyclomatic 111) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:135 — TypeInferenceBuilder::infer_type_expression_no_store has cyclomatic complexity 111 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_parameterized_special_form_type_expression (cyclomatic 105) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:1981 — TypeInferenceBuilder::infer_parameterized_special_form_type_expression has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_call_expression_impl (cyclomatic 97) crates/ty_python_semantic/src/types/infer/builder.rs:8419 — TypeInferenceBuilder::infer_call_expression_impl has cyclomatic complexity 97 (threshold 15). Of this number, 93 points are the body's own statements and 4 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_binary_expression_type_impl (cyclomatic 75) crates/ty_python_semantic/src/types/infer/builder/binary_expressions.rs:299 — TypeInferenceBuilder::infer_binary_expression_type_impl has cyclomatic complexity 75 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TypeInferenceBuilder::infer_explicit_callable_specialization_impl (cyclomatic 69) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:566 — TypeInferenceBuilder::infer_explicit_callable_specialization_impl has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_subscript_type_expression (cyclomatic 67) crates/ty_python_semantic/src/types/infer/builder/type_expression.rs:1472 — TypeInferenceBuilder::infer_subscript_type_expression has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_namedtuple_call_expression (cyclomatic 62) crates/ty_python_semantic/src/types/infer/builder/named_tuple.rs:30 — TypeInferenceBuilder::infer_namedtuple_call_expression has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_annotated_assignment_definition (cyclomatic 58) crates/ty_python_semantic/src/types/infer/builder.rs:4138 — TypeInferenceBuilder::infer_annotated_assignment_definition has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_collection_literal_impl (cyclomatic 47) crates/ty_python_semantic/src/types/infer/builder.rs:6967 — TypeInferenceBuilder::infer_collection_literal_impl has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::validate_subscript_assignment_impl (cyclomatic 46) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:1630 — TypeInferenceBuilder::validate_subscript_assignment_impl has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_typeddict_call_expression (cyclomatic 41) crates/ty_python_semantic/src/types/infer/builder/typed_dict.rs:72 — TypeInferenceBuilder::infer_typeddict_call_expression has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_function_definition (cyclomatic 40) crates/ty_python_semantic/src/types/infer/builder/function.rs:294 — TypeInferenceBuilder::infer_function_definition has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_subscript_load_impl (cyclomatic 37) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:169 — TypeInferenceBuilder::infer_subscript_load_impl has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_attribute_load_impl (cyclomatic 37) crates/ty_python_semantic/src/types/infer/builder.rs:10011 — TypeInferenceBuilder::infer_attribute_load_impl has cyclomatic complexity 37 (threshold 15). Of this number, 34 points are the body's own statements and 3 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_annotation_expression_impl (cyclomatic 36) crates/ty_python_semantic/src/types/infer/builder/annotation_expression.rs:103 — TypeInferenceBuilder::infer_annotation_expression_impl has cyclomatic complexity 36 (threshold 15). Of this number, 28 points are the body's own statements and 8 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_class_definition (cyclomatic 36) crates/ty_python_semantic/src/types/infer/builder/class.rs:81 — TypeInferenceBuilder::infer_class_definition has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::validate_attribute_deletion (cyclomatic 36) crates/ty_python_semantic/src/types/infer/builder.rs:2813 — TypeInferenceBuilder::validate_attribute_deletion has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_legacy_typevar (cyclomatic 35) crates/ty_python_semantic/src/types/infer/builder/typevar.rs:1259 — TypeInferenceBuilder::infer_legacy_typevar has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TypeInferenceBuilder::infer_place_load (cyclomatic 35) crates/ty_python_semantic/src/types/infer/builder.rs:9583 — TypeInferenceBuilder::infer_place_load has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::validate_typevar_default (cyclomatic 33) crates/ty_python_semantic/src/types/infer/builder/typevar.rs:166 — TypeInferenceBuilder::validate_typevar_default has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_legacy_typevartuple (cyclomatic 32) crates/ty_python_semantic/src/types/infer/builder/typevar.rs:752 — TypeInferenceBuilder::infer_legacy_typevartuple has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::validate_subscript_deletion_impl (cyclomatic 29) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:2049 — TypeInferenceBuilder::validate_subscript_deletion_impl has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_legacy_paramspec (cyclomatic 29) crates/ty_python_semantic/src/types/infer/builder/typevar.rs:1012 — TypeInferenceBuilder::infer_legacy_paramspec has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TypeInferenceBuilder::infer_builtins_type_call (cyclomatic 28) crates/ty_python_semantic/src/types/infer/builder/type_call.rs:29 — TypeInferenceBuilder::infer_builtins_type_call has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeInferenceBuilder::infer_annotated_assignment_statement (cyclomatic 28) crates/ty_python_semantic/src/types/infer/builder.rs:3948 — TypeInferenceBuilder::infer_annotated_assignment_statement has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • + 20 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×26
  • TooManyMethods: TypeInferenceBuilder crates/ty_python_semantic/src/types/infer/builder.rs:251 — TooManyMethods — 368 methods, declared across 19 files: infer/builder.rs (223), builder/type_expression.rs (21), builder/function.rs (18), builder/subscript.rs (18), +15 more file(s).
  • TooManyMethods: Parser crates/ruff_python_parser/src/parser/mod.rs:64 — TooManyMethods — 186 methods, declared across 4 files: parser/expression.rs (63), parser/statement.rs (62), parser/mod.rs (46), parser/pattern.rs (15).
  • TooManyMethods: SemanticModel crates/ruff_python_semantic/src/model.rs:58 — TooManyMethods — 138 methods, declared across 2 files: src/model.rs (136), model/all.rs (2).
  • TooManyMethods: SemanticIndexBuilder crates/ty_python_core/src/builder.rs:239 — TooManyMethods — 108 methods.
  • TooManyMethods: StaticClassLiteral crates/ty_python_semantic/src/types/class/static_literal.rs:76 — TooManyMethods — 77 methods, declared across 2 files: class/static_literal.rs (76), types/protocol_class.rs (1).
  • TooManyMethods: TypeRelationChecker crates/ty_python_semantic/src/types/relation.rs:804 — TooManyMethods — 66 methods, declared across 13 files: types/relation.rs (25), types/protocol_class.rs (15), types/signatures.rs (6), types/instance.rs (4), +9 more file(s).
  • TooManyMethods: Checker crates/ruff_linter/src/checkers/ast/mod.rs:195 — TooManyMethods — 63 methods.
  • TooManyMethods: Diagnostic crates/ruff_db/src/diagnostic/mod.rs:29 — TooManyMethods — 54 methods.
  • TooManyMethods: Bindings crates/ty_python_semantic/src/types/call/bind.rs:530 — TooManyMethods — 52 methods, declared across 2 files: call/bind.rs (51), bind/enum_property.rs (1).
  • TooManyMethods: Session crates/ty_server/src/session.rs:52 — TooManyMethods — 51 methods.
  • TooManyMethods: VariableLengthTuple crates/ty_python_semantic/src/types/tuple.rs:974 — TooManyMethods — 50 methods.
  • TooManyMethods: UseDefMapBuilder crates/ty_python_core/src/use_def.rs:1765 — TooManyMethods — 47 methods.
  • TooManyMethods: Signature crates/ty_python_semantic/src/types/signatures.rs:548 — TooManyMethods — 45 methods, declared across 2 files: types/signatures.rs (43), types/display.rs (2).
  • TooManyMethods: NarrowingConstraintsBuilder crates/ty_python_semantic/src/types/narrow.rs:1053 — TooManyMethods — 42 methods.
  • TooManyMethods: FunctionType crates/ty_python_semantic/src/types/function.rs:1103 — TooManyMethods — 41 methods, declared across 2 files: types/function.rs (40), types/display.rs (1).
  • TooManyMethods: PatternSuccessAnalyzer crates/ty_python_semantic/src/types/narrow.rs:365 — TooManyMethods — 41 methods.
  • TooManyMethods: Generator crates/ruff_python_codegen/src/generator.rs:90 — TooManyMethods — 39 methods.
  • TooManyMethods: SemanticIndex crates/ty_python_core/src/lib.rs:280 — TooManyMethods — 39 methods.
  • TooManyMethods: Binding crates/ty_python_semantic/src/types/call/bind.rs:6420 — TooManyMethods — 39 methods, declared across 2 files: call/bind.rs (34), bind/constructor.rs (5).
  • TooManyMethods: Parameters crates/ty_python_semantic/src/types/signatures.rs:3780 — TooManyMethods — 37 methods, declared across 2 files: types/signatures.rs (36), types/display.rs (1).
  • TooManyMethods: UseDefMap crates/ty_python_core/src/use_def.rs:742 — TooManyMethods — 35 methods.
  • TooManyMethods: Lexer crates/ruff_python_parser/src/lexer.rs:36 — TooManyMethods — 33 methods.
  • TooManyMethods: NodeId crates/ty_python_semantic/src/types/constraints.rs:2289 — TooManyMethods — 33 methods.
  • TooManyMethods: GenericContext crates/ty_python_semantic/src/types/generics.rs:250 — TooManyMethods — 32 methods, declared across 2 files: types/generics.rs (29), types/display.rs (3).
  • TooManyMethods: Parameter crates/ty_python_semantic/src/types/signatures.rs:4645 — TooManyMethods — 32 methods, declared across 2 files: types/signatures.rs (31), types/display.rs (1).
  • + 1 more in this group — see findings.md.
D2 · Cognitive Complexity · Parser · ×17
  • Parser::parse_impl (cognitive 84) crates/mdtest/src/parser.rs:591 — Parser::parse_impl has cognitive complexity 84 (threshold 15). Drivers by points: if/else 68, match/switch 10, loops 4, boolean chains 2 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_parameters (cognitive 45) crates/ruff_python_parser/src/parser/statement.rs:3310 — Parser::parse_parameters has cognitive complexity 45 (threshold 15). Drivers by points: if/else 39, boolean chains 5, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::handle_implicitly_concatenated_strings (cognitive 35) crates/ruff_python_parser/src/parser/expression.rs:1438 — Parser::handle_implicitly_concatenated_strings has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 15, loops 10, if/else 9, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_type_param (cognitive 33) crates/ruff_python_parser/src/parser/statement.rs:3645 — Parser::parse_type_param has cognitive complexity 33 (threshold 15). Drivers by points: if/else 33 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_arguments (cognitive 31) crates/ruff_python_parser/src/parser/expression.rs:807 — Parser::parse_arguments has cognitive complexity 31 (threshold 15). Drivers by points: if/else 28, match/switch 2, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_interpolated_element (cognitive 30) crates/ruff_python_parser/src/parser/expression.rs:1767 — Parser::parse_interpolated_element has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22, boolean chains 3, match/switch 3, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_set_or_dict_like_expression (cognitive 25) crates/ruff_python_parser/src/parser/expression.rs:2170 — Parser::parse_set_or_dict_like_expression has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21, match/switch 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_ipython_escape_command_value (cognitive 25) crates/ruff_python_parser/src/parser/mod.rs:535 — Parser::parse_ipython_escape_command_value has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16, loops 4, boolean chains 3, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::process_code_block (cognitive 24) crates/mdtest/src/parser.rs:818 — Parser::process_code_block has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18, match/switch 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_comma_separated_list (cognitive 23) crates/ruff_python_parser/src/parser/mod.rs:822 — Parser::parse_comma_separated_list has cognitive complexity 23 (threshold 15). Drivers by points: if/else 21, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_match_pattern_literal (cognitive 22) crates/ruff_python_parser/src/parser/pattern.rs:421 — Parser::parse_match_pattern_literal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::try_parse_parenthesized_with_items (cognitive 21) crates/ruff_python_parser/src/parser/statement.rs:2350 — Parser::try_parse_parenthesized_with_items has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 3, boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_binary_expression_or_higher_recursive (cognitive 20) crates/ruff_python_parser/src/parser/expression.rs:256 — Parser::parse_binary_expression_or_higher_recursive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, match/switch 2, boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_lhs_expression_inner (cognitive 20) crates/ruff_python_parser/src/parser/expression.rs:399 — Parser::parse_lhs_expression_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_simple_statement (cognitive 20) crates/ruff_python_parser/src/parser/statement.rs:267 — Parser::parse_simple_statement has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, match/switch 4, boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_slice (cognitive 19) crates/ruff_python_parser/src/parser/expression.rs:1086 — Parser::parse_slice has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, match/switch 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::parse_except_clause (cognitive 18) crates/ruff_python_parser/src/parser/statement.rs:1687 — Parser::parse_except_clause has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · Type · ×13
  • Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cyclomatic 96) crates/ty_python_semantic/src/types.rs:3790 — Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl has cyclomatic complexity 96 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::subscript (cyclomatic 61) crates/ty_python_semantic/src/types/subscript.rs:539 — Type::subscript has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::try_bool_impl (cyclomatic 54) crates/ty_python_semantic/src/types/bool.rs:48 — Type::try_bool_impl has cyclomatic complexity 54 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::apply_type_mapping_impl (cyclomatic 50) crates/ty_python_semantic/src/types.rs:6507 — Type::apply_type_mapping_impl has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::bindings (cyclomatic 44) crates/ty_python_semantic/src/types.rs:4551 — Type::bindings has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::in_type_expression (cyclomatic 43) crates/ty_python_semantic/src/types.rs:6041 — Type::in_type_expression has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::try_upcast_to_callable_with_policy_and_context (cyclomatic 38) crates/ty_python_semantic/src/types/callable.rs:73 — Type::try_upcast_to_callable_with_policy_and_context has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::find_legacy_typevars_impl (cyclomatic 38) crates/ty_python_semantic/src/types.rs:6858 — Type::find_legacy_typevars_impl has cyclomatic complexity 38 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::try_iterate_with_mode::non_async_special_case (cyclomatic 23) crates/ty_python_semantic/src/types/iteration.rs:98 — Type::try_iterate_with_mode::non_async_special_case has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::generator_types (cyclomatic 22) crates/ty_python_semantic/src/types.rs:5813 — Type::generator_types has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::constructor_bindings (cyclomatic 21) crates/ty_python_semantic/src/types.rs:5249 — Type::constructor_bindings has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Type::class_member_with_policy_inner (cyclomatic 16) crates/ty_python_semantic/src/types.rs:2707 — Type::class_member_with_policy_inner has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Type::try_call_dunder_get (cyclomatic 16) crates/ty_python_semantic/src/types.rs:3201 — Type::try_call_dunder_get has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function item declared inside it (try_call_dunder_get_inner). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · Type · ×13
  • Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl (cognitive 56) crates/ty_python_semantic/src/types.rs:3790 — Type::member_lookup_with_policy_and_receiver::member_lookup_with_policy_impl has cognitive complexity 56 (threshold 15). Drivers by points: if/else 24, boolean chains 20, match/switch 12 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::try_bool_impl (cognitive 40) crates/ty_python_semantic/src/types/bool.rs:48 — Type::try_bool_impl has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23, match/switch 13, boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::subscript (cognitive 40) crates/ty_python_semantic/src/types/subscript.rs:539 — Type::subscript has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15, boolean chains 13, match/switch 12 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::apply_type_mapping_impl (cognitive 38) crates/ty_python_semantic/src/types.rs:6507 — Type::apply_type_mapping_impl has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 17, if/else 14, loops 5, boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::bindings (cognitive 32) crates/ty_python_semantic/src/types.rs:4551 — Type::bindings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17, match/switch 14, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::constructor_bindings (cognitive 30) crates/ty_python_semantic/src/types.rs:5249 — Type::constructor_bindings has cognitive complexity 30 (threshold 15). Drivers by points: if/else 21, match/switch 8, boolean chains 1 (nesting depth added 9). Of this number, 28 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::try_upcast_to_callable_with_policy_and_context (cognitive 28) crates/ty_python_semantic/src/types/callable.rs:73 — Type::try_upcast_to_callable_with_policy_and_context has cognitive complexity 28 (threshold 15). Drivers by points: loops 11, if/else 8, match/switch 8, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::generator_types (cognitive 27) crates/ty_python_semantic/src/types.rs:5813 — Type::generator_types has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 13, if/else 6, boolean chains 4, loops 4 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Type::in_type_expression (cognitive 26) crates/ty_python_semantic/src/types.rs:6041 — Type::in_type_expression has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, match/switch 10, boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::try_iterate_with_mode::non_async_special_case (cognitive 24) crates/ty_python_semantic/src/types/iteration.rs:98 — Type::try_iterate_with_mode::non_async_special_case has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13, loops 6, match/switch 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Type::find_legacy_typevars_impl (cognitive 22) crates/ty_python_semantic/src/types.rs:6858 — Type::find_legacy_typevars_impl has cognitive complexity 22 (threshold 15). Drivers by points: loops 10, if/else 8, match/switch 4 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Type::try_call_dunder_get (cognitive 20) crates/ty_python_semantic/src/types.rs:3201 — Type::try_call_dunder_get has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, boolean chains 4, match/switch 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to one function item declared inside it (try_call_dunder_get_inner). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • Type::try_iterate_with_mode (cognitive 18) crates/ty_python_semantic/src/types/iteration.rs:93 — Type::try_iterate_with_mode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 20, match/switch 16, loops 6 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · TooManyFunctions · ×11
  • TooManyFunctions: crate::types::diagnostic crates/ty_python_semantic/src/types/diagnostic.rs:58 — TooManyFunctions — 79 free functions.
  • TooManyFunctions: crate::preview crates/ruff_linter/src/preview.rs:13 — TooManyFunctions — 65 free functions.
  • TooManyFunctions: crate::helpers crates/ruff_python_ast/src/helpers.rs:22 — TooManyFunctions — 48 free functions.
  • TooManyFunctions: crate::types::ide_support crates/ty_python_semantic/src/types/ide_support.rs:40 — TooManyFunctions — 46 free functions.
  • TooManyFunctions: crate::comments::placement crates/ruff_python_formatter/src/comments/placement.rs:22 — TooManyFunctions — 41 free functions.
  • TooManyFunctions: crate::types::equality crates/ty_python_semantic/src/types/equality.rs:127 — TooManyFunctions — 37 free functions.
  • TooManyFunctions: crate::analyze::typing crates/ruff_python_semantic/src/analyze/typing.rs:49 — TooManyFunctions — 36 free functions.
  • TooManyFunctions: crate::visitor::source_order crates/ruff_python_ast/src/visitor/source_order.rs:188 — TooManyFunctions — 34 free functions.
  • TooManyFunctions: crate::builders crates/ruff_formatter/src/builders.rs:69 — TooManyFunctions — 31 free functions.
  • TooManyFunctions: crate::types::match_pattern crates/ty_python_semantic/src/types/match_pattern.rs:25 — TooManyFunctions — 31 free functions.
  • TooManyFunctions: crate::types::typed_dict crates/ty_python_semantic/src/types/typed_dict.rs:184 — TooManyFunctions — 31 free functions.
D15 · Churn × Complexity Hotspots · Hotspot · ×10
  • Hotspot: crates/ruff_linter/src/codes.rs crates/ruff_linter/src/codes.rs — crates/ruff_linter/src/codes.rs changed 15 times in last 90 days, max complexity 984. 1 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_semantic/src/types.rs crates/ty_python_semantic/src/types.rs — crates/ty_python_semantic/src/types.rs changed 130 times in last 90 days, max complexity 107. 12 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_semantic/src/types/call/bind.rs crates/ty_python_semantic/src/types/call/bind.rs — crates/ty_python_semantic/src/types/call/bind.rs changed 60 times in last 90 days, max complexity 214. 3 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_semantic/src/types/infer/builder.rs crates/ty_python_semantic/src/types/infer/builder.rs — crates/ty_python_semantic/src/types/infer/builder.rs changed 116 times in last 90 days, max complexity 97. 5 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_semantic/src/types/relation.rs crates/ty_python_semantic/src/types/relation.rs — crates/ty_python_semantic/src/types/relation.rs changed 50 times in last 90 days, max complexity 194. 2 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_core/src/builder.rs crates/ty_python_core/src/builder.rs — crates/ty_python_core/src/builder.rs changed 50 times in last 90 days, max complexity 147. 3 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_semantic/src/types/signatures.rs crates/ty_python_semantic/src/types/signatures.rs — crates/ty_python_semantic/src/types/signatures.rs changed 36 times in last 90 days, max complexity 180.
  • Hotspot: crates/ty_python_semantic/src/types/generics.rs crates/ty_python_semantic/src/types/generics.rs — crates/ty_python_semantic/src/types/generics.rs changed 51 times in last 90 days, max complexity 82. 2 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
  • Hotspot: crates/ty_python_semantic/src/types/class/static_literal.rs crates/ty_python_semantic/src/types/class/static_literal.rs — crates/ty_python_semantic/src/types/class/static_literal.rs changed 50 times in last 90 days, max complexity 71.
  • Hotspot: crates/ty_python_semantic/src/types/narrow.rs crates/ty_python_semantic/src/types/narrow.rs — crates/ty_python_semantic/src/types/narrow.rs changed 55 times in last 90 days, max complexity 64. 2 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
D35 · Change Coupling · Change coupling · ×10
  • Change coupling: mod.rs ↔ check_docstring.rs crates/ruff_linter/src/rules/pydoclint/mod.rs — `crates/ruff_linter/src/rules/pydoclint/mod.rs` and `crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs` change together 70% of the time (7 of the 10 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: fix.rs ↔ lint.rs crates/ruff_server/src/fix.rs — `crates/ruff_server/src/fix.rs` and `crates/ruff_server/src/lint.rs` change together 65% of the time (15 of the 23 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
  • Change coupling: testing.rs ↔ program.rs crates/ty_module_resolver/src/testing.rs — `crates/ty_module_resolver/src/testing.rs` and `crates/ty_python_core/src/program.rs` change together 65% of the time (20 of the 31 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: lib.rs ↔ requests.rs crates/ty_ide/src/lib.rs — `crates/ty_ide/src/lib.rs` and `crates/ty_server/src/server/api/requests.rs` change together 58% of the time (15 of the 26 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: symbol.rs ↔ infer.rs crates/ty_python_core/src/symbol.rs — `crates/ty_python_core/src/symbol.rs` and `crates/ty_python_semantic/src/types/infer.rs` change together 57% of the time (30 of the 53 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: goto_type_definition.rs ↔ hover.rs crates/ty_server/src/server/api/requests/goto_type_definition.rs — `crates/ty_server/src/server/api/requests/goto_type_definition.rs` and `crates/ty_server/src/server/api/requests/hover.rs` change together 56% of the time (10 of the 18 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. They already sit in the same directory, so if they share structure, extract the common part into one unit; otherwise break the coupling.
  • Change coupling: server.rs ↔ requests.rs crates/ty_server/src/server.rs — `crates/ty_server/src/server.rs` and `crates/ty_server/src/server/api/requests.rs` change together 54% of the time (14 of the 26 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: expression.rs ↔ codes.rs crates/ruff_linter/src/checkers/ast/analyze/expression.rs — `crates/ruff_linter/src/checkers/ast/analyze/expression.rs` and `crates/ruff_linter/src/codes.rs` change together 52% of the time (86 of the 164 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: capabilities.rs ↔ requests.rs crates/ty_server/src/capabilities.rs — `crates/ty_server/src/capabilities.rs` and `crates/ty_server/src/server/api/requests.rs` change together 50% of the time (13 of the 26 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
  • Change coupling: dunder_all.rs ↔ class.rs crates/ty_python_semantic/src/dunder_all.rs — `crates/ty_python_semantic/src/dunder_all.rs` and `crates/ty_python_semantic/src/types/class.rs` change together 50% of the time (11 of the 22 commits that touched the less-changed of the two, renames followed) with no explicit dependency — a hidden/logical coupling. If they belong together, co-locate them; if not, break the coupling.
D2 · Cognitive Complexity · StaticClassLiteral · ×9
  • StaticClassLiteral::own_synthesized_member (cognitive 93) crates/ty_python_semantic/src/types/class/static_literal.rs:1387 — StaticClassLiteral::own_synthesized_member has cognitive complexity 93 (threshold 15). Drivers by points: if/else 59, boolean chains 20, match/switch 9, loops 5 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::implicit_attribute_inner (cognitive 76) crates/ty_python_semantic/src/types/class/static_literal.rs:2579 — StaticClassLiteral::implicit_attribute_inner has cognitive complexity 76 (threshold 15). Drivers by points: if/else 41, match/switch 23, loops 10, boolean chains 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::own_instance_member (cognitive 48) crates/ty_python_semantic/src/types/class/static_literal.rs:2902 — StaticClassLiteral::own_instance_member has cognitive complexity 48 (threshold 15). Drivers by points: if/else 43, boolean chains 3, match/switch 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::own_fields (cognitive 42) crates/ty_python_semantic/src/types/class/static_literal.rs:2321 — StaticClassLiteral::own_fields has cognitive complexity 42 (threshold 15). Drivers by points: if/else 35, match/switch 3, boolean chains 2, loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::merged_dataclass_params (cognitive 23) crates/ty_python_semantic/src/types/class/static_literal.rs:870 — StaticClassLiteral::merged_dataclass_params has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, loops 8, boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::own_class_member (cognitive 20) crates/ty_python_semantic/src/types/class/static_literal.rs:1250 — StaticClassLiteral::own_class_member has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 4, match/switch 2 (nesting depth added 3). Of this number, 18 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • StaticClassLiteral::validate_members (cognitive 19) crates/ty_python_semantic/src/types/class/static_literal.rs:2237 — StaticClassLiteral::validate_members has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 2, match/switch 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::total_ordering_root_method (cognitive 18) crates/ty_python_semantic/src/types/class/static_literal.rs:295 — StaticClassLiteral::total_ordering_root_method has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 3, match/switch 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StaticClassLiteral::try_metaclass::try_metaclass_inner (cognitive 18) crates/ty_python_semantic/src/types/class/static_literal.rs:1027 — StaticClassLiteral::try_metaclass::try_metaclass_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 2, boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TypeRelationChecker · ×8
  • TypeRelationChecker::check_signature_pair_inner (cognitive 458) crates/ty_python_semantic/src/types/signatures.rs:2175 — TypeRelationChecker::check_signature_pair_inner has cognitive complexity 458 (threshold 15). Drivers by points: if/else 309, match/switch 80, loops 44, boolean chains 25 (nesting depth added 303). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeRelationChecker::check_typeddict_pair (cognitive 140) crates/ty_python_semantic/src/types/typed_dict.rs:632 — TypeRelationChecker::check_typeddict_pair has cognitive complexity 140 (threshold 15). Drivers by points: if/else 110, match/switch 13, loops 10, boolean chains 7 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeRelationChecker::check_type_pair (cognitive 135) crates/ty_python_semantic/src/types/relation.rs:1136 — TypeRelationChecker::check_type_pair has cognitive complexity 135 (threshold 15). Drivers by points: if/else 77, boolean chains 32, match/switch 26 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeRelationChecker::check_variable_length_vs_tuple_spec (cognitive 60) crates/ty_python_semantic/src/types/tuple.rs:425 — TypeRelationChecker::check_variable_length_vs_tuple_spec has cognitive complexity 60 (threshold 15). Drivers by points: if/else 34, match/switch 11, loops 8, boolean chains 7 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeRelationChecker::check_type_satisfies_protocol (cognitive 22) crates/ty_python_semantic/src/types/instance.rs:489 — TypeRelationChecker::check_type_satisfies_protocol has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeRelationChecker::check_fixed_length_tuple_vs_tuple_spec (cognitive 19) crates/ty_python_semantic/src/types/tuple.rs:324 — TypeRelationChecker::check_fixed_length_tuple_vs_tuple_spec has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, loops 4, match/switch 3, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypeRelationChecker::check_protocol_member_read (cognitive 17) crates/ty_python_semantic/src/types/protocol_class.rs:2552 — TypeRelationChecker::check_protocol_member_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 3 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TypeRelationChecker::check_protocol_member_access_pair (cognitive 16) crates/ty_python_semantic/src/types/protocol_class.rs:2897 — TypeRelationChecker::check_protocol_member_access_pair has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 4, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render · ×8
  • render::render_source_line (cognitive 121) crates/ruff_annotate_snippets/src/renderer/render.rs:895 — render::render_source_line has cognitive complexity 121 (threshold 15). Drivers by points: if/else 64, loops 27, boolean chains 17, match/switch 13 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::render_snippet_annotations (cognitive 117) crates/ruff_annotate_snippets/src/renderer/render.rs:554 — render::render_snippet_annotations has cognitive complexity 117 (threshold 15). Drivers by points: if/else 77, loops 33, match/switch 5, boolean chains 2 (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::render (cognitive 67) crates/ruff_annotate_snippets/src/renderer/render.rs:29 — render::render has cognitive complexity 67 (threshold 15). Drivers by points: if/else 46, match/switch 10, boolean chains 6, loops 5 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::emit_suggestion_default (cognitive 62) crates/ruff_annotate_snippets/src/renderer/render.rs:1507 — render::emit_suggestion_default has cognitive complexity 62 (threshold 15). Drivers by points: if/else 46, loops 10, match/switch 4, boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::pre_process (cognitive 50) crates/ruff_annotate_snippets/src/renderer/render.rs:2712 — render::pre_process has cognitive complexity 50 (threshold 15). Drivers by points: if/else 36, match/switch 10, loops 3, boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::render_title (cognitive 44) crates/ruff_annotate_snippets/src/renderer/render.rs:318 — render::render_title has cognitive complexity 44 (threshold 15). Drivers by points: if/else 35, boolean chains 5, loops 3, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::render_short_message (cognitive 19) crates/ruff_annotate_snippets/src/renderer/render.rs:237 — render::render_short_message has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • render::draw_line (cognitive 16) crates/ruff_annotate_snippets/src/renderer/render.rs:2028 — render::draw_line has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · Parser · ×7
  • Parser::parse_parameters (cyclomatic 33) crates/ruff_python_parser/src/parser/statement.rs:3310 — Parser::parse_parameters has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_impl (cyclomatic 31) crates/mdtest/src/parser.rs:591 — Parser::parse_impl has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_simple_statement (cyclomatic 25) crates/ruff_python_parser/src/parser/statement.rs:267 — Parser::parse_simple_statement has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Parser::handle_implicitly_concatenated_strings (cyclomatic 21) crates/ruff_python_parser/src/parser/expression.rs:1438 — Parser::handle_implicitly_concatenated_strings has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Parser::process_code_block (cyclomatic 20) crates/mdtest/src/parser.rs:818 — Parser::process_code_block has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_interpolated_element (cyclomatic 19) crates/ruff_python_parser/src/parser/expression.rs:1767 — Parser::parse_interpolated_element has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::parse_set_or_dict_like_expression (cyclomatic 16) crates/ruff_python_parser/src/parser/expression.rs:2170 — Parser::parse_set_or_dict_like_expression has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · typed_dict · ×7
  • typed_dict::extract_unpacked_typed_dict_from_value_type (cognitive 41) crates/ty_python_semantic/src/types/typed_dict.rs:1721 — typed_dict::extract_unpacked_typed_dict_from_value_type has cognitive complexity 41 (threshold 15). Drivers by points: if/else 25, loops 15, match/switch 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typed_dict::validate_merged_dict_literal (cognitive 36) crates/ty_python_semantic/src/types/typed_dict.rs:2648 — typed_dict::validate_merged_dict_literal has cognitive complexity 36 (threshold 15). Drivers by points: if/else 35, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typed_dict::validate_typed_dict_constructor (cognitive 31) crates/ty_python_semantic/src/types/typed_dict.rs:2381 — typed_dict::validate_typed_dict_constructor has cognitive complexity 31 (threshold 15). Drivers by points: if/else 28, boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typed_dict::validate_typed_dict_openness (cognitive 31) crates/ty_python_semantic/src/types/infer/builder/post_inference/typed_dict.rs:147 — typed_dict::validate_typed_dict_openness has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20, boolean chains 5, match/switch 5, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typed_dict::validate_merged_unpacked_keyword_argument (cognitive 23) crates/ty_python_semantic/src/types/typed_dict.rs:2757 — typed_dict::validate_merged_unpacked_keyword_argument has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, loops 4, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typed_dict::validate_typed_dict_class_body_statements (cognitive 22) crates/ty_python_semantic/src/types/infer/builder/post_inference/typed_dict.rs:45 — typed_dict::validate_typed_dict_class_body_statements has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, loops 4, match/switch 2, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typed_dict::collect_guaranteed_keys_from_merged_unpacked_keyword (cognitive 18) crates/ty_python_semantic/src/types/typed_dict.rs:2026 — typed_dict::collect_guaranteed_keys_from_merged_unpacked_keyword has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, loops 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · helpers · ×7
  • helpers::is_django_model_import::match_model_import (cognitive 38) crates/ruff_linter/src/rules/pep8_naming/helpers.rs:109 — helpers::is_django_model_import::match_model_import has cognitive complexity 38 (threshold 15). Drivers by points: if/else 38 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • helpers::has_slots (cognitive 22) crates/ruff_linter/src/rules/flake8_slots/helpers.rs:4 — helpers::has_slots has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 4, match/switch 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • helpers::get_section_contexts (cognitive 21) crates/ruff_linter/src/rules/pydocstyle/helpers.rs:73 — helpers::get_section_contexts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, match/switch 3, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • helpers::any_over_stmt::inner (cognitive 21) crates/ruff_python_ast/src/helpers.rs:530 — helpers::any_over_stmt::inner has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 20, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • helpers::is_unpacking_assignment (cognitive 19) crates/ruff_python_ast/src/helpers.rs:1316 — helpers::is_unpacking_assignment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 5, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • helpers::num_statements (cognitive 17) crates/ruff_linter/src/rules/pylint/helpers.rs:320 — helpers::num_statements has cognitive complexity 17 (threshold 15). Drivers by points: loops 10, if/else 5, match/switch 2 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • helpers::extract_handled_exceptions (cognitive 16) crates/ruff_python_ast/src/helpers.rs:860 — helpers::extract_handled_exceptions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 6, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · render · ×6
  • render::render_source_line (cyclomatic 72) crates/ruff_annotate_snippets/src/renderer/render.rs:895 — render::render_source_line has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • render::render_snippet_annotations (cyclomatic 41) crates/ruff_annotate_snippets/src/renderer/render.rs:554 — render::render_snippet_annotations has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • render::emit_suggestion_default (cyclomatic 28) crates/ruff_annotate_snippets/src/renderer/render.rs:1507 — render::emit_suggestion_default has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • render::render (cyclomatic 26) crates/ruff_annotate_snippets/src/renderer/render.rs:29 — render::render has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • render::render_title (cyclomatic 24) crates/ruff_annotate_snippets/src/renderer/render.rs:318 — render::render_title has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • render::pre_process (cyclomatic 19) crates/ruff_annotate_snippets/src/renderer/render.rs:2712 — render::pre_process has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StaticClassLiteral · ×6
  • StaticClassLiteral::own_synthesized_member (cyclomatic 71) crates/ty_python_semantic/src/types/class/static_literal.rs:1387 — StaticClassLiteral::own_synthesized_member has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • StaticClassLiteral::implicit_attribute_inner (cyclomatic 40) crates/ty_python_semantic/src/types/class/static_literal.rs:2579 — StaticClassLiteral::implicit_attribute_inner has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • StaticClassLiteral::own_fields (cyclomatic 21) crates/ty_python_semantic/src/types/class/static_literal.rs:2321 — StaticClassLiteral::own_fields has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • StaticClassLiteral::own_class_member (cyclomatic 19) crates/ty_python_semantic/src/types/class/static_literal.rs:1250 — StaticClassLiteral::own_class_member has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • StaticClassLiteral::try_metaclass (cyclomatic 17) crates/ty_python_semantic/src/types/class/static_literal.rs:1016 — StaticClassLiteral::try_metaclass has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function item declared inside it (try_metaclass_inner). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • StaticClassLiteral::own_instance_member (cyclomatic 17) crates/ty_python_semantic/src/types/class/static_literal.rs:2902 — StaticClassLiteral::own_instance_member has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · Checker · ×6
  • Checker::visit_expr (cognitive 264) crates/ruff_linter/src/checkers/ast/mod.rs:1672 — Checker::visit_expr has cognitive complexity 264 (threshold 15). Drivers by points: if/else 145, loops 76, match/switch 37, boolean chains 6 (nesting depth added 168). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checker::visit_stmt (cognitive 154) crates/ruff_linter/src/checkers/ast/mod.rs:970 — Checker::visit_stmt has cognitive complexity 154 (threshold 15). Drivers by points: if/else 111, loops 22, match/switch 13, boolean chains 8 (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checker::visit_deferred_string_type_definitions (cognitive 37) crates/ruff_linter/src/checkers/ast/mod.rs:2996 — Checker::visit_deferred_string_type_definitions has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26, match/switch 7, loops 3, boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checker::visit_exports (cognitive 30) crates/ruff_linter/src/checkers/ast/mod.rs:3202 — Checker::visit_exports has cognitive complexity 30 (threshold 15). Drivers by points: if/else 25, loops 3, boolean chains 1, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checker::report_semantic_error (cognitive 27) crates/ruff_linter/src/checkers/ast/mod.rs:710 — Checker::report_semantic_error has cognitive complexity 27 (threshold 15). Drivers by points: if/else 26, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checker::add_binding (cognitive 18) crates/ruff_linter/src/checkers/ast/mod.rs:2677 — Checker::add_binding has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · format · ×6
  • format::warn_incompatible_formatter_settings (cognitive 51) crates/ruff/src/commands/format.rs:1083 — format::warn_incompatible_formatter_settings has cognitive complexity 51 (threshold 15). Drivers by points: if/else 37, boolean chains 7, loops 4, match/switch 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • format::format (cognitive 41) crates/ruff/src/commands/format.rs:71 — format::format has cognitive complexity 41 (threshold 15). Drivers by points: if/else 28, match/switch 7, boolean chains 4, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • format::format_source (cognitive 29) crates/ruff/src/commands/format.rs:350 — format::format_source has cognitive complexity 29 (threshold 15). Drivers by points: if/else 22, match/switch 3, boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • format::format_path (cognitive 22) crates/ruff/src/commands/format.rs:254 — format::format_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, match/switch 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • format::format_single_line (cognitive 19) crates/ruff_linter/src/rules/isort/format.rs:110 — format::format_single_line has cognitive complexity 19 (threshold 15). Drivers by points: loops 11, if/else 7, boolean chains 1 (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • format::format_multi_line (cognitive 16) crates/ruff_linter/src/rules/isort/format.rs:198 — format::format_multi_line has cognitive complexity 16 (threshold 15). Drivers by points: loops 10, if/else 5, boolean chains 1 (nesting depth added 4). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · TypeRelationChecker · ×5
  • TypeRelationChecker::check_type_pair (cyclomatic 194) crates/ty_python_semantic/src/types/relation.rs:1136 — TypeRelationChecker::check_type_pair has cyclomatic complexity 194 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • TypeRelationChecker::check_signature_pair_inner (cyclomatic 180) crates/ty_python_semantic/src/types/signatures.rs:2175 — TypeRelationChecker::check_signature_pair_inner has cyclomatic complexity 180 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeRelationChecker::check_typeddict_pair (cyclomatic 51) crates/ty_python_semantic/src/types/typed_dict.rs:632 — TypeRelationChecker::check_typeddict_pair has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeRelationChecker::check_variable_length_vs_tuple_spec (cyclomatic 31) crates/ty_python_semantic/src/types/tuple.rs:425 — TypeRelationChecker::check_variable_length_vs_tuple_spec has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TypeRelationChecker::check_type_satisfies_protocol (cyclomatic 18) crates/ty_python_semantic/src/types/instance.rs:489 — TypeRelationChecker::check_type_satisfies_protocol has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · SemanticIndexBuilder · ×5
  • SemanticIndexBuilder::visit_stmt_impl (cognitive 309) crates/ty_python_core/src/builder.rs:2953 — SemanticIndexBuilder::visit_stmt_impl has cognitive complexity 309 (threshold 15). Drivers by points: if/else 222, loops 56, boolean chains 16, match/switch 15 (nesting depth added 169). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticIndexBuilder::visit_expr (cognitive 85) crates/ty_python_core/src/builder.rs:4597 — SemanticIndexBuilder::visit_expr has cognitive complexity 85 (threshold 15). Drivers by points: if/else 63, loops 10, match/switch 9, boolean chains 3 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticIndexBuilder::pop_scope (cognitive 44) crates/ty_python_core/src/builder.rs:904 — SemanticIndexBuilder::pop_scope has cognitive complexity 44 (threshold 15). Drivers by points: if/else 30, loops 10, boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticIndexBuilder::update_lazy_snapshots (cognitive 19) crates/ty_python_core/src/builder.rs:807 — SemanticIndexBuilder::update_lazy_snapshots has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, loops 4, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticIndexBuilder::with_type_params (cognitive 16) crates/ty_python_core/src/builder.rs:2540 — SemanticIndexBuilder::with_type_params has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, match/switch 6, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sections · ×5
  • sections::blanks_and_section_underline (cognitive 107) crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs:1475 — sections::blanks_and_section_underline has cognitive complexity 107 (threshold 15). Drivers by points: if/else 99, loops 6, boolean chains 2 (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • sections::common_section (cognitive 30) crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs:1760 — sections::common_section has cognitive complexity 30 (threshold 15). Drivers by points: if/else 30 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • sections::is_docstring_section (cognitive 22) crates/ruff_linter/src/docstrings/sections.rs:445 — sections::is_docstring_section has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • sections::missing_args (cognitive 22) crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs:1895 — sections::missing_args has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • sections::parameters_section (cognitive 16) crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs:2024 — sections::parameters_section has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, loops 6, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SemanticModel · ×5
  • SemanticModel::resolve_load (cognitive 63) crates/ruff_python_semantic/src/model.rs:461 — SemanticModel::resolve_load has cognitive complexity 63 (threshold 15). Drivers by points: if/else 56, boolean chains 3, match/switch 3, loops 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticModel::simulate_runtime_load_at_location_in_scope (cognitive 55) crates/ruff_python_semantic/src/model.rs:951 — SemanticModel::simulate_runtime_load_at_location_in_scope has cognitive complexity 55 (threshold 15). Drivers by points: if/else 37, match/switch 9, loops 5, boolean chains 4 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticModel::extract_dunder_all_names (cognitive 29) crates/ruff_python_semantic/src/model/all.rs:75 — SemanticModel::extract_dunder_all_names has cognitive complexity 29 (threshold 15). Drivers by points: if/else 24, loops 4, match/switch 1 (nesting depth added 16). Of this number, 25 points are the body's own statements and 4 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticModel::resolve_qualified_import_name (cognitive 28) crates/ruff_python_semantic/src/model.rs:1301 — SemanticModel::resolve_qualified_import_name has cognitive complexity 28 (threshold 15). Drivers by points: if/else 26, boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticModel::lookup_symbol_in_scope (cognitive 25) crates/ruff_python_semantic/src/model.rs:834 — SemanticModel::lookup_symbol_in_scope has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, match/switch 3, boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssignmentAttributeWriteEvaluator · ×5
  • AssignmentAttributeWriteEvaluator::evaluate (cognitive 47) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:157 — AssignmentAttributeWriteEvaluator::evaluate has cognitive complexity 47 (threshold 15). Drivers by points: if/else 37, loops 4, boolean chains 3, match/switch 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentAttributeWriteEvaluator::evaluate_instance (cognitive 37) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:352 — AssignmentAttributeWriteEvaluator::evaluate_instance has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23, boolean chains 7, match/switch 7 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentAttributeWriteEvaluator::evaluate_class (cognitive 27) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:505 — AssignmentAttributeWriteEvaluator::evaluate_class has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21, match/switch 5, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentAttributeWriteEvaluator::report (cognitive 24) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:782 — AssignmentAttributeWriteEvaluator::report has cognitive complexity 24 (threshold 15). Drivers by points: if/else 23, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AssignmentAttributeWriteEvaluator::evaluate_protocol_descriptor_write (cognitive 18) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:611 — AssignmentAttributeWriteEvaluator::evaluate_protocol_descriptor_write has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, loops 2, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · diagnostic · ×5
  • diagnostic::report_inconsistent_generic_bases (cognitive 39) crates/ty_python_semantic/src/types/diagnostic.rs:3592 — diagnostic::report_inconsistent_generic_bases has cognitive complexity 39 (threshold 15). Drivers by points: if/else 33, loops 3, match/switch 2, boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • diagnostic::report_invalid_method_override (cognitive 29) crates/ty_python_semantic/src/types/diagnostic.rs:3755 — diagnostic::report_invalid_method_override has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16, match/switch 6, boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • diagnostic::report_invalid_key_on_typed_dict (cognitive 25) crates/ty_python_semantic/src/types/diagnostic.rs:3161 — diagnostic::report_invalid_key_on_typed_dict has cognitive complexity 25 (threshold 15). Drivers by points: if/else 22, match/switch 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • diagnostic::report_overridden_final_method (cognitive 21) crates/ty_python_semantic/src/types/diagnostic.rs:4005 — diagnostic::report_overridden_final_method has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, boolean chains 3, match/switch 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • diagnostic::report_unsupported_comparison (cognitive 17) crates/ty_python_semantic/src/types/diagnostic.rs:4246 — diagnostic::report_unsupported_comparison has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · SemanticTokenVisitor · ×4
  • SemanticTokenVisitor::visit_stmt (cyclomatic 43) crates/ty_ide/src/semantic_tokens.rs:719 — SemanticTokenVisitor::visit_stmt has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticTokenVisitor::classify_from_definition (cyclomatic 21) crates/ty_ide/src/semantic_tokens.rs:295 — SemanticTokenVisitor::classify_from_definition has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticTokenVisitor::visit_expr (cyclomatic 20) crates/ty_ide/src/semantic_tokens.rs:968 — SemanticTokenVisitor::visit_expr has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • SemanticTokenVisitor::classify_from_type_for_attribute (cyclomatic 18) crates/ty_ide/src/semantic_tokens.rs:475 — SemanticTokenVisitor::classify_from_type_for_attribute has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SemanticSyntaxChecker · ×4
  • SemanticSyntaxChecker::check_stmt (cyclomatic 38) crates/ruff_python_parser/src/semantic_errors.rs:76 — SemanticSyntaxChecker::check_stmt has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticSyntaxChecker::visit_expr (cyclomatic 23) crates/ruff_python_parser/src/semantic_errors.rs:865 — SemanticSyntaxChecker::visit_expr has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticSyntaxChecker::check_annotation (cyclomatic 18) crates/ruff_python_parser/src/semantic_errors.rs:350 — SemanticSyntaxChecker::check_annotation has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticSyntaxChecker::debug_shadowing (cyclomatic 16) crates/ruff_python_parser/src/semantic_errors.rs:577 — SemanticSyntaxChecker::debug_shadowing has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Printer · ×4
  • Printer::write_summary_text (cognitive 106) crates/ruff/src/printer.rs:84 — Printer::write_summary_text has cognitive complexity 106 (threshold 15). Drivers by points: if/else 105, boolean chains 1 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Printer::print_element (cognitive 59) crates/ruff_formatter/src/printer/mod.rs:94 — Printer::print_element has cognitive complexity 59 (threshold 15). Drivers by points: if/else 41, match/switch 17, boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Printer::print_fill_entries (cognitive 41) crates/ruff_formatter/src/printer/mod.rs:640 — Printer::print_fill_entries has cognitive complexity 41 (threshold 15). Drivers by points: if/else 29, loops 6, match/switch 5, boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Printer::write_once (cognitive 18) crates/ruff/src/printer.rs:208 — Printer::write_once has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NarrowingConstraintsBuilder · ×4
  • NarrowingConstraintsBuilder::evaluate_expr_compare (cognitive 100) crates/ty_python_semantic/src/types/narrow.rs:3152 — NarrowingConstraintsBuilder::evaluate_expr_compare has cognitive complexity 100 (threshold 15). Drivers by points: if/else 69, match/switch 16, boolean chains 12, loops 3 (nesting depth added 41). Of this number, 92 points are the body's own statements and 8 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NarrowingConstraintsBuilder::evaluate_expr_compare_op (cognitive 24) crates/ty_python_semantic/src/types/narrow.rs:3024 — NarrowingConstraintsBuilder::evaluate_expr_compare_op has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, match/switch 6, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NarrowingConstraintsBuilder::narrow_type_by_exact_len (cognitive 22) crates/ty_python_semantic/src/types/narrow.rs:2786 — NarrowingConstraintsBuilder::narrow_type_by_exact_len has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 12, if/else 8, boolean chains 2 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • NarrowingConstraintsBuilder::narrow_type_by_len (cognitive 17) crates/ty_python_semantic/src/types/narrow.rs:2723 — NarrowingConstraintsBuilder::narrow_type_by_len has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Lexer · ×4
  • Lexer::consume_ascii_character (cognitive 90) crates/ruff_python_parser/src/lexer.rs:400 — Lexer::consume_ascii_character has cognitive complexity 90 (threshold 15). Drivers by points: if/else 85, boolean chains 4, match/switch 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lexer::lex_interpolated_string_middle_or_end (cognitive 47) crates/ruff_python_parser/src/lexer.rs:796 — Lexer::lex_interpolated_string_middle_or_end has cognitive complexity 47 (threshold 15). Drivers by points: if/else 42, boolean chains 2, match/switch 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lexer::lex_token (cognitive 28) crates/ruff_python_parser/src/lexer.rs:157 — Lexer::lex_token has cognitive complexity 28 (threshold 15). Drivers by points: if/else 26, match/switch 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Lexer::lex_string (cognitive 24) crates/ruff_python_parser/src/lexer.rs:924 — Lexer::lex_string has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, loops 4, match/switch 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SemanticSyntaxChecker · ×4
  • SemanticSyntaxChecker::check_stmt (cognitive 55) crates/ruff_python_parser/src/semantic_errors.rs:76 — SemanticSyntaxChecker::check_stmt has cognitive complexity 55 (threshold 15). Drivers by points: if/else 41, loops 12, boolean chains 1, match/switch 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticSyntaxChecker::check_annotation (cognitive 28) crates/ruff_python_parser/src/semantic_errors.rs:350 — SemanticSyntaxChecker::check_annotation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 23, boolean chains 2, loops 2, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticSyntaxChecker::visit_expr (cognitive 28) crates/ruff_python_parser/src/semantic_errors.rs:865 — SemanticSyntaxChecker::visit_expr has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17, loops 6, match/switch 4, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticSyntaxChecker::debug_shadowing (cognitive 25) crates/ruff_python_parser/src/semantic_errors.rs:577 — SemanticSyntaxChecker::debug_shadowing has cognitive complexity 25 (threshold 15). Drivers by points: loops 14, if/else 7, match/switch 4 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · printf_string_formatting · ×4
  • printf_string_formatting::clean_params_dictionary (cognitive 45) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:232 — printf_string_formatting::clean_params_dictionary has cognitive complexity 45 (threshold 15). Drivers by points: if/else 40, loops 5 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • printf_string_formatting::handle_part (cognitive 44) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:119 — printf_string_formatting::handle_part has cognitive complexity 44 (threshold 15). Drivers by points: if/else 26, match/switch 14, boolean chains 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • printf_string_formatting::printf_string_formatting (cognitive 23) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:370 — printf_string_formatting::printf_string_formatting has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11, loops 6, match/switch 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • printf_string_formatting::convertible (cognitive 21) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:310 — printf_string_formatting::convertible has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArgumentTypeChecker · ×4
  • ArgumentTypeChecker::infer_specialization (cognitive 42) crates/ty_python_semantic/src/types/call/bind.rs:5300 — ArgumentTypeChecker::infer_specialization has cognitive complexity 42 (threshold 15). Drivers by points: if/else 28, loops 11, boolean chains 2, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ArgumentTypeChecker::check_argument_type (cognitive 17) crates/ty_python_semantic/src/types/call/bind.rs:5624 — ArgumentTypeChecker::check_argument_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 6 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ArgumentTypeChecker::check_argument_types (cognitive 17) crates/ty_python_semantic/src/types/call/bind.rs:5844 — ArgumentTypeChecker::check_argument_types has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, loops 4, boolean chains 2, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ArgumentTypeChecker::evaluate_paramspec_sub_call (cognitive 17) crates/ty_python_semantic/src/types/call/bind.rs:5961 — ArgumentTypeChecker::evaluate_paramspec_sub_call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 2, match/switch 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · static_class · ×3
  • static_class::check_static_class_definitions (cyclomatic 154) crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs:75 — static_class::check_static_class_definitions has cyclomatic complexity 154 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • static_class::check_class_namespace_against_metaclass_members (cyclomatic 17) crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs:1038 — static_class::check_class_namespace_against_metaclass_members has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • static_class::check_final_class_abstract_methods (cyclomatic 16) crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs:1210 — static_class::check_final_class_abstract_methods has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SemanticIndexBuilder · ×3
  • SemanticIndexBuilder::visit_stmt_impl (cyclomatic 147) crates/ty_python_core/src/builder.rs:2953 — SemanticIndexBuilder::visit_stmt_impl has cyclomatic complexity 147 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticIndexBuilder::visit_expr (cyclomatic 49) crates/ty_python_core/src/builder.rs:4597 — SemanticIndexBuilder::visit_expr has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticIndexBuilder::pop_scope (cyclomatic 23) crates/ty_python_core/src/builder.rs:904 — SemanticIndexBuilder::pop_scope has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Checker · ×3
  • Checker::visit_expr (cyclomatic 114) crates/ruff_linter/src/checkers/ast/mod.rs:1672 — Checker::visit_expr has cyclomatic complexity 114 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Checker::visit_stmt (cyclomatic 90) crates/ruff_linter/src/checkers/ast/mod.rs:970 — Checker::visit_stmt has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Checker::report_semantic_error (cyclomatic 27) crates/ruff_linter/src/checkers/ast/mod.rs:710 — Checker::report_semantic_error has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Lexer · ×3
  • Lexer::consume_ascii_character (cyclomatic 70) crates/ruff_python_parser/src/lexer.rs:400 — Lexer::consume_ascii_character has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Lexer::lex_identifier (cyclomatic 49) crates/ruff_python_parser/src/lexer.rs:643 — Lexer::lex_identifier has cyclomatic complexity 49 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Lexer::lex_interpolated_string_middle_or_end (cyclomatic 25) crates/ruff_python_parser/src/lexer.rs:796 — Lexer::lex_interpolated_string_middle_or_end has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Printer · ×3
  • Printer::print_element (cyclomatic 50) crates/ruff_formatter/src/printer/mod.rs:94 — Printer::print_element has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Printer::write_summary_text (cyclomatic 26) crates/ruff/src/printer.rs:84 — Printer::write_summary_text has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Printer::print_fill_entries (cyclomatic 17) crates/ruff_formatter/src/printer/mod.rs:640 — Printer::print_fill_entries has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CallableBinding · ×3
  • CallableBinding::check_types (cyclomatic 32) crates/ty_python_semantic/src/types/call/bind.rs:3439 — CallableBinding::check_types has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CallableBinding::report_diagnostics (cyclomatic 23) crates/ty_python_semantic/src/types/call/bind.rs:4181 — CallableBinding::report_diagnostics has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CallableBinding::filter_overloads_using_any_or_unknown (cyclomatic 20) crates/ty_python_semantic/src/types/call/bind.rs:3854 — CallableBinding::filter_overloads_using_any_or_unknown has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RecoveryContextKind · ×3
  • RecoveryContextKind::list_terminator_kind (cyclomatic 30) crates/ruff_python_parser/src/parser/mod.rs:1278 — RecoveryContextKind::list_terminator_kind has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • RecoveryContextKind::is_list_element (cyclomatic 27) crates/ruff_python_parser/src/parser/mod.rs:1457 — RecoveryContextKind::is_list_element has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • RecoveryContextKind::create_error (cyclomatic 26) crates/ruff_python_parser/src/parser/mod.rs:1504 — RecoveryContextKind::create_error has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AssignmentAttributeWriteEvaluator · ×3
  • AssignmentAttributeWriteEvaluator::evaluate (cyclomatic 27) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:157 — AssignmentAttributeWriteEvaluator::evaluate has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AssignmentAttributeWriteEvaluator::evaluate_instance (cyclomatic 26) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:352 — AssignmentAttributeWriteEvaluator::evaluate_instance has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • AssignmentAttributeWriteEvaluator::report (cyclomatic 20) crates/ty_python_semantic/src/types/infer/builder/attribute_assignment.rs:782 — AssignmentAttributeWriteEvaluator::report has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · printf_string_formatting · ×3
  • printf_string_formatting::handle_part (cyclomatic 18) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:119 — printf_string_formatting::handle_part has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • printf_string_formatting::convertible (cyclomatic 17) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:310 — printf_string_formatting::convertible has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • printf_string_formatting::printf_string_formatting (cyclomatic 17) crates/ruff_linter/src/rules/pyupgrade/rules/printf_string_formatting.rs:370 — printf_string_formatting::printf_string_formatting has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D2 · Cognitive Complexity · Bindings · ×3
  • Bindings::evaluate_known_cases (cognitive 598) crates/ty_python_semantic/src/types/call/bind.rs:1456 — Bindings::evaluate_known_cases has cognitive complexity 598 (threshold 15). Drivers by points: if/else 446, match/switch 124, loops 18, boolean chains 10 (nesting depth added 432). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Bindings::report_element_diagnostics (cognitive 25) crates/ty_python_semantic/src/types/call/bind.rs:1386 — Bindings::report_element_diagnostics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 23, loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Bindings::apply_generic_context_in_place (cognitive 18) crates/ty_python_semantic/src/types/call/bind.rs:650 — Bindings::apply_generic_context_in_place has cognitive complexity 18 (threshold 15). Drivers by points: loops 11, if/else 4, match/switch 3 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · static_class · ×3
  • static_class::check_static_class_definitions (cognitive 319) crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs:75 — static_class::check_static_class_definitions has cognitive complexity 319 (threshold 15). Drivers by points: if/else 233, loops 44, boolean chains 24, match/switch 18 (nesting depth added 178). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • static_class::check_class_namespace_against_metaclass_members (cognitive 41) crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs:1038 — static_class::check_class_namespace_against_metaclass_members has cognitive complexity 41 (threshold 15). Drivers by points: if/else 29, loops 12 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • static_class::check_final_class_abstract_methods (cognitive 27) crates/ty_python_semantic/src/types/infer/builder/post_inference/static_class.rs:1210 — static_class::check_final_class_abstract_methods has cognitive complexity 27 (threshold 15). Drivers by points: if/else 24, boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_docstring · ×3
  • check_docstring::check_docstring (cognitive 94) crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs:1230 — check_docstring::check_docstring has cognitive complexity 94 (threshold 15). Drivers by points: if/else 69, loops 10, match/switch 10, boolean chains 5 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • check_docstring::parse_raises_google (cognitive 25) crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs:759 — check_docstring::parse_raises_google has cognitive complexity 25 (threshold 15). Drivers by points: if/else 24, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • check_docstring::parse_parameters_numpy (cognitive 21) crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs:680 — check_docstring::parse_parameters_numpy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, loops 6 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SemanticTokenVisitor · ×3
  • SemanticTokenVisitor::visit_stmt (cognitive 76) crates/ty_ide/src/semantic_tokens.rs:719 — SemanticTokenVisitor::visit_stmt has cognitive complexity 76 (threshold 15). Drivers by points: if/else 44, loops 27, match/switch 4, boolean chains 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticTokenVisitor::classify_from_definition (cognitive 32) crates/ty_ide/src/semantic_tokens.rs:295 — SemanticTokenVisitor::classify_from_definition has cognitive complexity 32 (threshold 15). Drivers by points: if/else 24, match/switch 6, boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SemanticTokenVisitor::visit_expr (cognitive 23) crates/ty_ide/src/semantic_tokens.rs:968 — SemanticTokenVisitor::visit_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12, match/switch 8, loops 2, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Generator · ×3
  • Generator::unparse_expr (cognitive 69) crates/ruff_python_codegen/src/generator.rs:921 — Generator::unparse_expr has cognitive complexity 69 (threshold 15). Drivers by points: if/else 46, loops 12, match/switch 10, boolean chains 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Generator::unparse_stmt (cognitive 33) crates/ruff_python_codegen/src/generator.rs:248 — Generator::unparse_stmt has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22, loops 10, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Generator::unparse_pattern (cognitive 17) crates/ruff_python_codegen/src/generator.rs:769 — Generator::unparse_pattern has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, loops 6, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CallableBinding · ×3
  • CallableBinding::check_types (cognitive 59) crates/ty_python_semantic/src/types/call/bind.rs:3439 — CallableBinding::check_types has cognitive complexity 59 (threshold 15). Drivers by points: if/else 30, loops 16, match/switch 13 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CallableBinding::report_diagnostics (cognitive 44) crates/ty_python_semantic/src/types/call/bind.rs:4181 — CallableBinding::report_diagnostics has cognitive complexity 44 (threshold 15). Drivers by points: if/else 36, match/switch 5, loops 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CallableBinding::filter_overloads_using_any_or_unknown (cognitive 42) crates/ty_python_semantic/src/types/call/bind.rs:3854 — CallableBinding::filter_overloads_using_any_or_unknown has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25, loops 14, match/switch 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · comparisons · ×3
  • comparisons::infer_binary_type_comparison_inner (cognitive 47) crates/ty_python_semantic/src/types/infer/comparisons.rs:296 — comparisons::infer_binary_type_comparison_inner has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 22, loops 15, if/else 8, boolean chains 2 (nesting depth added 20). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • comparisons::infer_tuple_rich_comparison (cognitive 18) crates/ty_python_semantic/src/types/infer/comparisons.rs:1086 — comparisons::infer_tuple_rich_comparison has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 10, if/else 4, loops 4 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • comparisons::infer_binary_intersection_type_comparison (cognitive 16) crates/ty_python_semantic/src/types/infer/comparisons.rs:827 — comparisons::infer_binary_intersection_type_comparison has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 11, if/else 3, loops 2 (nesting depth added 5). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · diagnostics · ×3
  • diagnostics::lint_path (cognitive 45) crates/ruff/src/diagnostics.rs:182 — diagnostics::lint_path has cognitive complexity 45 (threshold 15). Drivers by points: if/else 28, match/switch 16, boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • diagnostics::lint_stdin (cognitive 35) crates/ruff/src/diagnostics.rs:383 — diagnostics::lint_stdin has cognitive complexity 35 (threshold 15). Drivers by points: if/else 27, match/switch 8 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • diagnostics::to_lsp_diagnostic (cognitive 20) crates/ty_server/src/server/api/diagnostics.rs:454 — diagnostics::to_lsp_diagnostic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, loops 3, match/switch 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PathBounds · ×3
  • PathBounds::default_solve (cognitive 42) crates/ty_python_semantic/src/types/constraints.rs:3847 — PathBounds::default_solve has cognitive complexity 42 (threshold 15). Drivers by points: if/else 37, boolean chains 2, loops 2, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PathBounds::compute_simple_bound_conjunction (cognitive 20) crates/ty_python_semantic/src/types/constraints.rs:3722 — PathBounds::compute_simple_bound_conjunction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, match/switch 3, boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PathBounds::compute (cognitive 19) crates/ty_python_semantic/src/types/constraints.rs:3572 — PathBounds::compute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 3, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fixes · ×3
  • fixes::fix_all (cognitive 41) crates/ty_python_semantic/src/fixes.rs:78 — fixes::fix_all has cognitive complexity 41 (threshold 15). Drivers by points: if/else 30, loops 8, match/switch 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fixes::fix_unnecessary_call_around_sorted (cognitive 35) crates/ruff_linter/src/rules/flake8_comprehensions/fixes.rs:418 — fixes::fix_unnecessary_call_around_sorted has cognitive complexity 35 (threshold 15). Drivers by points: if/else 33, boolean chains 1, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fixes::fix_unnecessary_comprehension_in_call (cognitive 22) crates/ruff_linter/src/rules/flake8_comprehensions/fixes.rs:821 — fixes::fix_unnecessary_comprehension_in_call has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, loops 6, match/switch 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · removal_in_3 · ×3
  • removal_in_3::check_method (cognitive 29) crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs:544 — removal_in_3::check_method has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 17, if/else 12 (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • removal_in_3::is_context_key_access (cognitive 23) crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs:1267 — removal_in_3::is_context_key_access has cognitive complexity 23 (threshold 15). Drivers by points: if/else 21, boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • removal_in_3::check_name (cognitive 19) crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs:654 — removal_in_3::check_name has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 17, if/else 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · subscript · ×3
  • subscript::legacy_generic_class_context (cognitive 28) crates/ty_python_semantic/src/types/infer/builder/subscript.rs:2389 — subscript::legacy_generic_class_context has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21, match/switch 4, boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • subscript::subscript (cognitive 19) crates/ruff_linter/src/rules/flake8_2020/rules/subscript.rs:175 — subscript::subscript has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 4, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • subscript::py_slice_with_step (cognitive 17) crates/ty_python_semantic/src/subscript.rs:125 — subscript::py_slice_with_step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, match/switch 8 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · place · ×3
  • place::place_from_bindings_impl (cognitive 27) crates/ty_python_semantic/src/place.rs:1470 — place::place_from_bindings_impl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14, match/switch 9, loops 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • place::place_by_id (cognitive 25) crates/ty_python_semantic/src/place.rs:992 — place::place_by_id has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, match/switch 7, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • place::place_from_declarations_impl (cognitive 16) crates/ty_python_semantic/src/place.rs:1852 — place::place_from_declarations_impl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, loops 3, boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · parametrize · ×3
  • parametrize::check_names (cognitive 26) crates/ruff_linter/src/rules/flake8_pytest_style/rules/parametrize.rs:346 — parametrize::check_names has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16, match/switch 10 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parametrize::check_values (cognitive 24) crates/ruff_linter/src/rules/flake8_pytest_style/rules/parametrize.rs:520 — parametrize::check_values has cognitive complexity 24 (threshold 15). Drivers by points: if/else 22, boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • parametrize::handle_value_rows (cognitive 16) crates/ruff_linter/src/rules/flake8_pytest_style/rules/parametrize.rs:799 — parametrize::handle_value_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 2, boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · placement · ×3
  • placement::handle_enclosed_comment (cognitive 26) crates/ruff_python_formatter/src/comments/placement.rs:191 — placement::handle_enclosed_comment has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, match/switch 3, boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • placement::handle_comprehension_comment (cognitive 21) crates/ruff_python_formatter/src/comments/placement.rs:2201 — placement::handle_comprehension_comment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • placement::handle_lambda_comment (cognitive 19) crates/ruff_python_formatter/src/comments/placement.rs:1829 — placement::handle_lambda_comment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ide_support · ×3
  • ide_support::definitions_for_attribute (cognitive 25) crates/ty_python_semantic/src/types/ide_support.rs:231 — ide_support::definitions_for_attribute has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 10, if/else 9, loops 5, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_support::definitions_for_name (cognitive 23) crates/ty_python_semantic/src/types/ide_support.rs:59 — ide_support::definitions_for_name has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 3, match/switch 3, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ide_support::direct_subtypes (cognitive 20) crates/ty_python_semantic/src/types/ide_support.rs:2731 — ide_support::direct_subtypes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, boolean chains 4, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parameters · ×3
  • Parameters::from_normalized (cognitive 21) crates/ty_python_semantic/src/types/signatures.rs:3861 — Parameters::from_normalized has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, match/switch 2, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parameters::with_transformed_parameters (cognitive 18) crates/ty_python_semantic/src/types/signatures.rs:3998 — Parameters::with_transformed_parameters has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, boolean chains 3, match/switch 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parameters::expand_starred_variadic_annotations (cognitive 16) crates/ty_python_semantic/src/types/signatures.rs:4461 — Parameters::expand_starred_variadic_annotations has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 7, if/else 6, boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · equality · ×3
  • equality::evaluate_structural_comparison (cognitive 21) crates/ty_python_semantic/src/types/equality.rs:560 — equality::evaluate_structural_comparison has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 9, if/else 7, boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • equality::compare_nominal_instances (cognitive 18) crates/ty_python_semantic/src/types/equality.rs:1402 — equality::compare_nominal_instances has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 4, match/switch 3, loops 2 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • equality::evaluate_target_union (cognitive 17) crates/ty_python_semantic/src/types/equality.rs:987 — equality::evaluate_target_union has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 2, match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D38 · OSV Dependency Vulnerabilities · Medium CVE · ×3
  • Medium CVE: [GHSA redacted] playground/package-lock.json — ajv 6.12.6: [GHSA redacted] — ajv is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin ajv to 6.14.0 with an `overrides` entry).
  • Medium CVE: [GHSA redacted] playground/package-lock.json — dompurify 3.4.8: [GHSA redacted] — dompurify is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or pin dompurify to 3.4.11 with an `overrides` entry). This is 1 of 3 advisories this scan raises against dompurify 3.4.8, and their fixed versions do not agree — anything below 3.4.12 still leaves at least one of them open, so 3.4.12 is the floor for this package, not this row's target alone. One upgrade of dompurify 3.4.8 clears all 3 advisories it raises: [GHSA redacted], [GHSA redacted], [GHSA redacted].
  • Medium CVE: PYSEC-2026-2987 python/py-fuzzer/uv.lock — pygments 2.19.2: PYSEC-2026-2987 — pygments is not declared in this repo's manifests: it is pulled in transitively, so upgrade the dependency that requires it (or raise its floor in your own manifest and re-resolve (`uv lock --upgrade-package pygments`)).
D1 · Cyclomatic Complexity · DisjointnessChecker · ×2
  • DisjointnessChecker::check_type_pair (cyclomatic 105) crates/ty_python_semantic/src/types/relation.rs:2695 — DisjointnessChecker::check_type_pair has cyclomatic complexity 105 (threshold 15). Of this number, 104 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • DisjointnessChecker::check_typeddict_pair (cyclomatic 28) crates/ty_python_semantic/src/types/typed_dict.rs:1055 — DisjointnessChecker::check_typeddict_pair has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SpecializationBuilder · ×2
  • SpecializationBuilder::infer_map_impl (cyclomatic 82) crates/ty_python_semantic/src/types/generics.rs:2833 — SpecializationBuilder::infer_map_impl has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SpecializationBuilder::common_typed_dict_protocol_constraints (cyclomatic 19) crates/ty_python_semantic/src/types/generics.rs:2579 — SpecializationBuilder::common_typed_dict_protocol_constraints has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function items declared inside it (collect_typed_dicts, is_string_keyed_mapping). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · overrides · ×2
  • overrides::check_class_declaration (cyclomatic 74) crates/ty_python_semantic/src/types/overrides.rs:424 — overrides::check_class_declaration has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • overrides::check_inherited_method_conflicts (cyclomatic 24) crates/ty_python_semantic/src/types/overrides.rs:125 — overrides::check_inherited_method_conflicts has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · removal_in_3 · ×2
  • removal_in_3::check_name (cyclomatic 72) crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs:654 — removal_in_3::check_name has cyclomatic complexity 72 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • removal_in_3::check_method (cyclomatic 30) crates/ruff_linter/src/rules/airflow/rules/removal_in_3.rs:544 — removal_in_3::check_method has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · UnionBuilder · ×2
  • UnionBuilder::add_in_place_impl (cyclomatic 72) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:674 — UnionBuilder::add_in_place_impl has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • UnionBuilder::push_type (cyclomatic 28) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:992 — UnionBuilder::push_type has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GotoTarget · ×2
  • GotoTarget::from_covering_node (cyclomatic 71) crates/ty_ide/src/goto.rs:935 — GotoTarget::from_covering_node has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • GotoTarget::definitions (cyclomatic 27) crates/ty_ide/src/goto.rs:608 — GotoTarget::definitions has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · NarrowingConstraintsBuilder · ×2
  • NarrowingConstraintsBuilder::evaluate_expr_compare (cyclomatic 64) crates/ty_python_semantic/src/types/narrow.rs:3152 — NarrowingConstraintsBuilder::evaluate_expr_compare has cyclomatic complexity 64 (threshold 15). Of this number, 54 points are the body's own statements and 10 belong to 2 function items declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • NarrowingConstraintsBuilder::evaluate_expr_compare_op (cyclomatic 19) crates/ty_python_semantic/src/types/narrow.rs:3024 — NarrowingConstraintsBuilder::evaluate_expr_compare_op has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Generator · ×2
  • Generator::unparse_expr (cyclomatic 57) crates/ruff_python_codegen/src/generator.rs:921 — Generator::unparse_expr has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Generator::unparse_stmt (cyclomatic 39) crates/ruff_python_codegen/src/generator.rs:248 — Generator::unparse_stmt has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · transformer · ×2
  • transformer::walk_expr (cyclomatic 53) crates/ruff_python_ast/src/visitor/transformer.rs:349 — transformer::walk_expr has cyclomatic complexity 53 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • transformer::walk_stmt (cyclomatic 42) crates/ruff_python_ast/src/visitor/transformer.rs:122 — transformer::walk_stmt has cyclomatic complexity 42 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · visitor · ×2
  • visitor::walk_expr (cyclomatic 53) crates/ruff_python_ast/src/visitor.rs:365 — visitor::walk_expr has cyclomatic complexity 53 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • visitor::walk_stmt (cyclomatic 43) crates/ruff_python_ast/src/visitor.rs:135 — visitor::walk_stmt has cyclomatic complexity 43 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · InnerIntersectionBuilder · ×2
  • InnerIntersectionBuilder::add_positive (cyclomatic 46) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:1452 — InnerIntersectionBuilder::add_positive has cyclomatic complexity 46 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • InnerIntersectionBuilder::add_negative (cyclomatic 33) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:1675 — InnerIntersectionBuilder::add_negative has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · helpers · ×2
  • helpers::any_over_stmt::inner (cyclomatic 43) crates/ruff_python_ast/src/helpers.rs:530 — helpers::any_over_stmt::inner has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • helpers::any_over_expr::inner (cyclomatic 32) crates/ruff_python_ast/src/helpers.rs:262 — helpers::any_over_expr::inner has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SequentMap · ×2
  • SequentMap::add_nested_typevar_sequents (cyclomatic 41) crates/ty_python_semantic/src/types/constraints.rs:5720 — SequentMap::add_nested_typevar_sequents has cyclomatic complexity 41 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • SequentMap::add_mutual_sequents_for_different_typevars (cyclomatic 17) crates/ty_python_semantic/src/types/constraints.rs:5541 — SequentMap::add_mutual_sequents_for_different_typevars has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · equality · ×2
  • equality::evaluate_structural_comparison (cyclomatic 35) crates/ty_python_semantic/src/types/equality.rs:560 — equality::evaluate_structural_comparison has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • equality::known_literal_equality (cyclomatic 17) crates/ty_python_semantic/src/types/equality.rs:1697 — equality::known_literal_equality has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · normalize · ×2
  • normalize::normalize_imports (cyclomatic 31) crates/ruff_linter/src/rules/isort/normalize.rs:5 — normalize::normalize_imports has cyclomatic complexity 31 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • normalize::normalize_string (cyclomatic 19) crates/ruff_python_formatter/src/string/normalize.rs:664 — normalize::normalize_string has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · format · ×2
  • format::warn_incompatible_formatter_settings (cyclomatic 29) crates/ruff/src/commands/format.rs:1083 — format::warn_incompatible_formatter_settings has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • format::format (cyclomatic 26) crates/ruff/src/commands/format.rs:71 — format::format has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SourceMap · ×2
  • SourceMap::annotated_lines (cyclomatic 29) crates/ruff_annotate_snippets/src/renderer/source_map.rs:171 — SourceMap::annotated_lines has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SourceMap::splice_lines (cyclomatic 28) crates/ruff_annotate_snippets/src/renderer/source_map.rs:406 — SourceMap::splice_lines has cyclomatic complexity 28 (threshold 15). Of this number, 23 points are the body's own statements and 5 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BlankLinesChecker · ×2
  • BlankLinesChecker::check_line (cyclomatic 28) crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs:833 — BlankLinesChecker::check_line has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BlankLinesChecker::check_lines (cyclomatic 20) crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs:731 — BlankLinesChecker::check_lines has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SemanticModel · ×2
  • SemanticModel::resolve_load (cyclomatic 28) crates/ruff_python_semantic/src/model.rs:461 — SemanticModel::resolve_load has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • SemanticModel::simulate_runtime_load_at_location_in_scope (cyclomatic 24) crates/ruff_python_semantic/src/model.rs:951 — SemanticModel::simulate_runtime_load_at_location_in_scope has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · diagnostics · ×2
  • diagnostics::lint_path (cyclomatic 24) crates/ruff/src/diagnostics.rs:182 — diagnostics::lint_path has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • diagnostics::lint_stdin (cyclomatic 18) crates/ruff/src/diagnostics.rs:383 — diagnostics::lint_stdin has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClassType · ×2
  • ClassType::own_class_member (cyclomatic 24) crates/ty_python_semantic/src/types/class.rs:1657 — ClassType::own_class_member has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ClassType::into_callable_with_receiver (cyclomatic 16) crates/ty_python_semantic/src/types/class.rs:2068 — ClassType::into_callable_with_receiver has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClauseHeader · ×2
  • ClauseHeader::visit (cyclomatic 19) crates/ruff_python_formatter/src/statement/clause.rs:108 — ClauseHeader::visit has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ClauseHeader::first_keyword_range (cyclomatic 18) crates/ruff_python_formatter/src/statement/clause.rs:247 — ClauseHeader::first_keyword_range has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · typed_dict · ×2
  • typed_dict::validate_typed_dict_openness (cyclomatic 19) crates/ty_python_semantic/src/types/infer/builder/post_inference/typed_dict.rs:147 — typed_dict::validate_typed_dict_openness has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • typed_dict::extract_unpacked_typed_dict_from_value_type (cyclomatic 18) crates/ty_python_semantic/src/types/typed_dict.rs:1721 — typed_dict::extract_unpacked_typed_dict_from_value_type has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · expression · ×2
  • expression::expression (cognitive 731) crates/ruff_linter/src/checkers/ast/analyze/expression.rs:25 — expression::expression has cognitive complexity 731 (threshold 15). Drivers by points: if/else 666, loops 27, boolean chains 25, match/switch 13 (nesting depth added 254). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • expression::has_own_parentheses (cognitive 17) crates/ruff_python_formatter/src/expression/mod.rs:1188 — expression::has_own_parentheses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnionBuilder · ×2
  • UnionBuilder::add_in_place_impl (cognitive 180) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:674 — UnionBuilder::add_in_place_impl has cognitive complexity 180 (threshold 15). Drivers by points: if/else 131, match/switch 26, loops 14, boolean chains 9 (nesting depth added 121). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • UnionBuilder::push_type (cognitive 43) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:992 — UnionBuilder::push_type has cognitive complexity 43 (threshold 15). Drivers by points: if/else 30, boolean chains 8, loops 3, match/switch 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · overrides · ×2
  • overrides::check_class_declaration (cognitive 171) crates/ty_python_semantic/src/types/overrides.rs:424 — overrides::check_class_declaration has cognitive complexity 171 (threshold 15). Drivers by points: if/else 145, boolean chains 20, match/switch 4, loops 2 (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • overrides::check_inherited_method_conflicts (cognitive 40) crates/ty_python_semantic/src/types/overrides.rs:125 — overrides::check_inherited_method_conflicts has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24, loops 8, boolean chains 4, match/switch 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · noqa · ×2
  • noqa::check_noqa (cognitive 132) crates/ruff_linter/src/checkers/noqa.rs:28 — noqa::check_noqa has cognitive complexity 132 (threshold 15). Drivers by points: if/else 103, boolean chains 13, loops 9, match/switch 7 (nesting depth added 79). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • noqa::find_suppression_comments (cognitive 33) crates/ruff_linter/src/noqa.rs:950 — noqa::find_suppression_comments has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21, match/switch 11, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalize · ×2
  • normalize::normalize_imports (cognitive 102) crates/ruff_linter/src/rules/isort/normalize.rs:5 — normalize::normalize_imports has cognitive complexity 102 (threshold 15). Drivers by points: loops 62, if/else 33, boolean chains 5, match/switch 2 (nesting depth added 69). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • normalize::normalize_string (cognitive 62) crates/ruff_python_formatter/src/string/normalize.rs:664 — normalize::normalize_string has cognitive complexity 62 (threshold 15). Drivers by points: if/else 53, loops 8, boolean chains 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · overloaded_function · ×2
  • overloaded_function::check_overloaded_function (cognitive 76) crates/ty_python_semantic/src/types/infer/builder/post_inference/overloaded_function.rs:32 — overloaded_function::check_overloaded_function has cognitive complexity 76 (threshold 15). Drivers by points: if/else 56, loops 15, boolean chains 5 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • overloaded_function::check_non_generic_overload_implementation_consistency (cognitive 18) crates/ty_python_semantic/src/types/infer/builder/post_inference/overloaded_function.rs:286 — overloaded_function::check_non_generic_overload_implementation_consistency has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 3, match/switch 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InnerIntersectionBuilder · ×2
  • InnerIntersectionBuilder::add_positive (cognitive 68) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:1452 — InnerIntersectionBuilder::add_positive has cognitive complexity 68 (threshold 15). Drivers by points: if/else 27, match/switch 20, loops 13, boolean chains 8 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InnerIntersectionBuilder::add_negative (cognitive 53) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:1675 — InnerIntersectionBuilder::add_negative has cognitive complexity 53 (threshold 15). Drivers by points: if/else 38, loops 10, boolean chains 4, match/switch 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FitsMeasurer · ×2
  • FitsMeasurer::fits_element (cognitive 61) crates/ruff_formatter/src/printer/mod.rs:1166 — FitsMeasurer::fits_element has cognitive complexity 61 (threshold 15). Drivers by points: if/else 33, match/switch 27, boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FitsMeasurer::fits_text (cognitive 30) crates/ruff_formatter/src/printer/mod.rs:1485 — FitsMeasurer::fits_text has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16, match/switch 10, loops 3, boolean chains 1 (nesting depth added 19). Of this number, 29 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourceMap · ×2
  • SourceMap::splice_lines (cognitive 59) crates/ruff_annotate_snippets/src/renderer/source_map.rs:406 — SourceMap::splice_lines has cognitive complexity 59 (threshold 15). Drivers by points: if/else 36, loops 13, match/switch 10 (nesting depth added 26). Of this number, 51 points are the body's own statements and 8 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SourceMap::annotated_lines (cognitive 49) crates/ruff_annotate_snippets/src/renderer/source_map.rs:171 — SourceMap::annotated_lines has cognitive complexity 49 (threshold 15). Drivers by points: if/else 28, loops 13, boolean chains 8 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArgumentMatcher · ×2
  • ArgumentMatcher::match_variadic (cognitive 57) crates/ty_python_semantic/src/types/call/bind.rs:4631 — ArgumentMatcher::match_variadic has cognitive complexity 57 (threshold 15). Drivers by points: if/else 33, loops 14, match/switch 7, boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ArgumentMatcher::match_keyword_variadic (cognitive 16) crates/ty_python_semantic/src/types/call/bind.rs:4862 — ArgumentMatcher::match_keyword_variadic has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 4, match/switch 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BlankLinesChecker · ×2
  • BlankLinesChecker::check_line (cognitive 55) crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs:833 — BlankLinesChecker::check_line has cognitive complexity 55 (threshold 15). Drivers by points: if/else 50, boolean chains 5 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BlankLinesChecker::check_lines (cognitive 36) crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs:731 — BlankLinesChecker::check_lines has cognitive complexity 36 (threshold 15). Drivers by points: if/else 33, match/switch 2, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImportReplacer · ×2
  • ImportReplacer::without_renames (cognitive 55) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs:483 — ImportReplacer::without_renames has cognitive complexity 55 (threshold 15). Drivers by points: if/else 54, match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ImportReplacer::with_renames (cognitive 19) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs:451 — ImportReplacer::with_renames has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · isort · ×2
  • isort::format_import_block (cognitive 51) crates/ruff_linter/src/rules/isort/mod.rs:154 — isort::format_import_block has cognitive complexity 51 (threshold 15). Drivers by points: if/else 25, loops 16, match/switch 7, boolean chains 3 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • isort::format_imports (cognitive 21) crates/ruff_linter/src/rules/isort/mod.rs:68 — isort::format_imports has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, loops 7, match/switch 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatImplicitConcatenatedStringFlat · ×2
  • FormatImplicitConcatenatedStringFlat::new::merge_flags (cognitive 51) crates/ruff_python_formatter/src/string/implicit.rs:137 — FormatImplicitConcatenatedStringFlat::new::merge_flags has cognitive complexity 51 (threshold 15). Drivers by points: if/else 42, loops 4, match/switch 3, boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FormatImplicitConcatenatedStringFlat::fmt (cognitive 22) crates/ruff_python_formatter/src/string/implicit.rs:288 — FormatImplicitConcatenatedStringFlat::fmt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8, loops 6, match/switch 6, boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mro · ×2
  • Mro::of_static_class (cognitive 51) crates/ty_python_semantic/src/types/mro.rs:54 — Mro::of_static_class has cognitive complexity 51 (threshold 15). Drivers by points: if/else 33, loops 8, match/switch 8, boolean chains 2 (nesting depth added 24). Of this number, 49 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Mro::of_dynamic_class (cognitive 21) crates/ty_python_semantic/src/types/mro.rs:342 — Mro::of_dynamic_class has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, loops 3, match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClassType · ×2
  • ClassType::own_class_member (cognitive 48) crates/ty_python_semantic/src/types/class.rs:1657 — ClassType::own_class_member has cognitive complexity 48 (threshold 15). Drivers by points: if/else 32, loops 9, match/switch 6, boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ClassType::into_callable_with_receiver (cognitive 26) crates/ty_python_semantic/src/types/class.rs:2068 — ClassType::into_callable_with_receiver has cognitive complexity 26 (threshold 15). Drivers by points: if/else 22, match/switch 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · transformer · ×2
  • transformer::walk_expr (cognitive 47) crates/ruff_python_ast/src/visitor/transformer.rs:349 — transformer::walk_expr has cognitive complexity 47 (threshold 15). Drivers by points: loops 30, if/else 13, match/switch 4 (nesting depth added 23). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • transformer::walk_stmt (cognitive 41) crates/ruff_python_ast/src/visitor/transformer.rs:122 — transformer::walk_stmt has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20, loops 20, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · visitor · ×2
  • visitor::walk_expr (cognitive 47) crates/ruff_python_ast/src/visitor.rs:365 — visitor::walk_expr has cognitive complexity 47 (threshold 15). Drivers by points: loops 30, if/else 13, match/switch 4 (nesting depth added 23). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • visitor::walk_stmt (cognitive 44) crates/ruff_python_ast/src/visitor.rs:135 — visitor::walk_stmt has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23, loops 20, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisjointnessChecker · ×2
  • DisjointnessChecker::check_type_pair (cognitive 45) crates/ty_python_semantic/src/types/relation.rs:2695 — DisjointnessChecker::check_type_pair has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22, match/switch 12, boolean chains 11 (nesting depth added 11). Of this number, 43 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DisjointnessChecker::check_typeddict_pair (cognitive 26) crates/ty_python_semantic/src/types/typed_dict.rs:1055 — DisjointnessChecker::check_typeddict_pair has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13, boolean chains 10, match/switch 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Server · ×2
  • Server::main_loop (cognitive 37) crates/ty_server/src/server/main_loop.rs:16 — Server::main_loop has cognitive complexity 37 (threshold 15). Drivers by points: if/else 28, match/switch 8, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Server::main_loop (cognitive 28) crates/ruff_server/src/server/main_loop.rs:18 — Server::main_loop has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22, match/switch 5, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SuppressionsBuilder · ×2
  • SuppressionsBuilder::load_from_tokens (cognitive 33) crates/ruff_linter/src/suppression.rs:727 — SuppressionsBuilder::load_from_tokens has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17, loops 7, match/switch 6, boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SuppressionsBuilder::add_comment (cognitive 21) crates/ty_python_semantic/src/suppression.rs:606 — SuppressionsBuilder::add_comment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 4, loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · logging_call · ×2
  • logging_call::logging_f_string (cognitive 33) crates/ruff_linter/src/rules/flake8_logging_format/rules/logging_call.rs:17 — logging_call::logging_f_string has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16, match/switch 12, loops 4, boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • logging_call::check_log_record_attr_clash (cognitive 16) crates/ruff_linter/src/rules/flake8_logging_format/rules/logging_call.rs:174 — logging_call::check_log_record_attr_clash has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, loops 4, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reachability · ×2
  • reachability::analyze_single_pattern_predicate_kind (cognitive 33) crates/ty_python_semantic/src/reachability.rs:1263 — reachability::analyze_single_pattern_predicate_kind has cognitive complexity 33 (threshold 15). Drivers by points: if/else 27, match/switch 5, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • reachability::analyze_enum_literal_union_pattern_predicate (cognitive 16) crates/ty_python_semantic/src/reachability.rs:407 — reachability::analyze_enum_literal_union_pattern_predicate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, loops 3 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · linter · ×2
  • linter::check_path (cognitive 32) crates/ruff_linter/src/linter.rs:119 — linter::check_path has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21, loops 6, boolean chains 3, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • linter::lint_fix (cognitive 23) crates/ruff_linter/src/linter.rs:544 — linter::lint_fix has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, loops 5, boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mdtest · ×2
  • mdtest::run (cognitive 31) crates/mdtest/src/lib.rs:48 — mdtest::run has cognitive complexity 31 (threshold 15). Drivers by points: loops 13, if/else 7, match/switch 7, boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mdtest::validate_inline_snapshot (cognitive 17) crates/mdtest/src/lib.rs:362 — mdtest::validate_inline_snapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · deprecated_mock_import · ×2
  • deprecated_mock_import::deprecated_mock_import (cognitive 30) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs:284 — deprecated_mock_import::deprecated_mock_import has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20, boolean chains 4, match/switch 4, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • deprecated_mock_import::clean_import_aliases (cognitive 23) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs:79 — deprecated_mock_import::clean_import_aliases has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, match/switch 5, boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ruff_markdown · ×2
  • ruff_markdown::format_code_blocks (cognitive 30) crates/ruff_markdown/src/lib.rs:64 — ruff_markdown::format_code_blocks has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17, match/switch 7, loops 4, boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ruff_markdown::format_pycon_block (cognitive 28) crates/ruff_markdown/src/lib.rs:150 — ruff_markdown::format_pycon_block has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19, loops 8, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate_docs · ×2
  • generate_docs::main (cognitive 29) crates/ruff_dev/src/generate_docs.rs:28 — generate_docs::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, match/switch 7, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • generate_docs::process_documentation (cognitive 26) crates/ruff_dev/src/generate_docs.rs:160 — generate_docs::process_documentation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20, match/switch 4, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · type_alias_quotes · ×2
  • type_alias_quotes::quotes_are_unremovable (cognitive 29) crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs:329 — type_alias_quotes::quotes_are_unremovable has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, boolean chains 3, match/switch 3, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • type_alias_quotes::collect_typing_references (cognitive 25) crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs:198 — type_alias_quotes::collect_typing_references has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21, loops 2, boolean chains 1, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · manual_dict_comprehension · ×2
  • manual_dict_comprehension::manual_dict_comprehension (cognitive 29) crates/ruff_linter/src/rules/perflint/rules/manual_dict_comprehension.rs:85 — manual_dict_comprehension::manual_dict_comprehension has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18, match/switch 8, boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • manual_dict_comprehension::convert_to_dict_comprehension (cognitive 29) crates/ruff_linter/src/rules/perflint/rules/manual_dict_comprehension.rs:303 — manual_dict_comprehension::convert_to_dict_comprehension has cognitive complexity 29 (threshold 15). Drivers by points: if/else 23, match/switch 6 (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GroupNameFinder · ×2
  • GroupNameFinder::visit_stmt (cognitive 28) crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs:117 — GroupNameFinder::visit_stmt has cognitive complexity 28 (threshold 15). Drivers by points: if/else 23, loops 4, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • GroupNameFinder::visit_expr (cognitive 23) crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs:245 — GroupNameFinder::visit_expr has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, loops 4, boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ast_bool_op · ×2
  • ast_bool_op::duplicate_isinstance_call (cognitive 27) crates/ruff_linter/src/rules/flake8_simplify/rules/ast_bool_op.rs:335 — ast_bool_op::duplicate_isinstance_call has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25, loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ast_bool_op::is_short_circuit (cognitive 16) crates/ruff_linter/src/rules/flake8_simplify/rules/ast_bool_op.rs:727 — ast_bool_op::is_short_circuit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 2, match/switch 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · manual_list_comprehension · ×2
  • manual_list_comprehension::convert_to_list_extend (cognitive 27) crates/ruff_linter/src/rules/perflint/rules/manual_list_comprehension.rs:360 — manual_list_comprehension::convert_to_list_extend has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19, match/switch 8 (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • manual_list_comprehension::manual_list_comprehension (cognitive 26) crates/ruff_linter/src/rules/perflint/rules/manual_list_comprehension.rs:97 — manual_list_comprehension::manual_list_comprehension has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18, boolean chains 4, match/switch 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · function · ×2
  • function::is_instance_truthiness (cognitive 27) crates/ty_python_semantic/src/types/function.rs:1877 — function::is_instance_truthiness has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16, match/switch 7, loops 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • function::check_classinfo_in_isinstance (cognitive 16) crates/ty_python_semantic/src/types/function.rs:1702 — function::check_classinfo_in_isinstance has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, match/switch 3, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_dict_kwargs · ×2
  • unnecessary_dict_kwargs::unnecessary_dict_kwargs (cognitive 26) crates/ruff_linter/src/rules/flake8_pie/rules/unnecessary_dict_kwargs.rs:90 — unnecessary_dict_kwargs::unnecessary_dict_kwargs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 25, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • unnecessary_dict_kwargs::duplicates (cognitive 19) crates/ruff_linter/src/rules/flake8_pie/rules/unnecessary_dict_kwargs.rs:186 — unnecessary_dict_kwargs::duplicates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lint · ×2
  • lint::to_lsp_diagnostic (cognitive 26) crates/ruff_server/src/lint.rs:269 — lint::to_lsp_diagnostic has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, loops 3, boolean chains 2, match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • lint::check (cognitive 17) crates/ruff_server/src/lint.rs:71 — lint::check has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, loops 4, boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · duplicate_exceptions · ×2
  • duplicate_exceptions::duplicate_exceptions (cognitive 25) crates/ruff_linter/src/rules/flake8_bugbear/rules/duplicate_exceptions.rs:193 — duplicate_exceptions::duplicate_exceptions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, loops 9, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • duplicate_exceptions::duplicate_handler_exceptions (cognitive 18) crates/ruff_linter/src/rules/flake8_bugbear/rules/duplicate_exceptions.rs:128 — duplicate_exceptions::duplicate_handler_exceptions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolver · ×2
  • resolver::match_any_exclusion (cognitive 25) crates/ruff_workspace/src/resolver.rs:875 — resolver::match_any_exclusion has cognitive complexity 25 (threshold 15). Drivers by points: if/else 24, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • resolver::project_files_in_path (cognitive 22) crates/ruff_workspace/src/resolver.rs:434 — resolver::project_files_in_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 6 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PathAssignments · ×2
  • PathAssignments::visit_inner (cognitive 24) crates/ty_python_semantic/src/types/constraints.rs:6732 — PathAssignments::visit_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, match/switch 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PathAssignments::add_assignment (cognitive 17) crates/ty_python_semantic/src/types/constraints.rs:7033 — PathAssignments::add_assignment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, match/switch 4, boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecoveryContextKind · ×2
  • RecoveryContextKind::list_terminator_kind (cognitive 22) crates/ruff_python_parser/src/parser/mod.rs:1278 — RecoveryContextKind::list_terminator_kind has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, match/switch 8, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RecoveryContextKind::create_error (cognitive 17) crates/ruff_python_parser/src/parser/mod.rs:1504 — RecoveryContextKind::create_error has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FoldingRangeVisitor · ×2
  • FoldingRangeVisitor::add_import_ranges (cognitive 22) crates/ty_ide/src/folding_range.rs:264 — FoldingRangeVisitor::add_import_ranges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FoldingRangeVisitor::add_comment_ranges (cognitive 22) crates/ty_ide/src/folding_range.rs:346 — FoldingRangeVisitor::add_comment_ranges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · directives · ×2
  • directives::extract_isort_directives (cognitive 21) crates/ruff_linter/src/directives.rs:205 — directives::extract_isort_directives has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • directives::extract_noqa_line_for (cognitive 20) crates/ruff_linter/src/directives.rs:109 — directives::extract_noqa_line_for has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 4, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · todos · ×2
  • todos::todos (cognitive 18) crates/ruff_linter/src/rules/flake8_todos/rules/todos.rs:258 — todos::todos has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, loops 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • todos::static_errors (cognitive 17) crates/ruff_linter/src/rules/flake8_todos/rules/todos.rs:354 — todos::static_errors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · typing · ×2
  • typing::match_annotated_subscript (cognitive 18) crates/ruff_python_semantic/src/analyze/typing.rs:57 — typing::match_annotated_subscript has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • typing::is_immutable_annotation (cognitive 17) crates/ruff_python_semantic/src/analyze/typing.rs:292 — typing::is_immutable_annotation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · completion · ×2
  • completion::completion (cognitive 18) crates/ty_ide/src/completion.rs:32 — completion::completion has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, loops 5, match/switch 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • completion::add_argument_completions (cognitive 16) crates/ty_ide/src/completion.rs:1898 — completion::add_argument_completions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 2, boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NodeId · ×2
  • NodeId::satisfied_by_all_typevars (cognitive 18) crates/ty_python_semantic/src/types/constraints.rs:2849 — NodeId::satisfied_by_all_typevars has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, loops 4, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NodeId::is_never_satisfied (cognitive 17) crates/ty_python_semantic/src/types/constraints.rs:2520 — NodeId::is_never_satisfied has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, match/switch 3, boolean chains 2, loops 1 (nesting depth added 7). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to one function item declared inside it (simple_conjunction_is_satisfiable). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · open_file_with_context_handler · ×2
  • open_file_with_context_handler::match_async_exit_stack (cognitive 16) crates/ruff_linter/src/rules/flake8_simplify/rules/open_file_with_context_handler.rs:49 — open_file_with_context_handler::match_async_exit_stack has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • open_file_with_context_handler::match_exit_stack (cognitive 16) crates/ruff_linter/src/rules/flake8_simplify/rules/open_file_with_context_handler.rs:91 — open_file_with_context_handler::match_exit_stack has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trailing_commas · ×2
  • trailing_commas::trailing_commas (cognitive 16) crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs:253 — trailing_commas::trailing_commas has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, match/switch 3, boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • trailing_commas::check_token (cognitive 16) crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs:327 — trailing_commas::check_token has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, match/switch 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D29 · Static Analysis (SAST) · Medium · ×2
  • Medium: dangerous-subprocess-use-tainted-env-args scripts/setup_primer_project.py:142 — Detected subprocess function 'run' with user controlled data. A malicious actor could leverage this to perform command injection. You may consider using 'shlex.quote()'. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
  • Medium: dangerous-subprocess-use-tainted-env-args scripts/setup_primer_project.py:148 — Detected subprocess function 'run' with user controlled data. A malicious actor could leverage this to perform command injection. You may consider using 'shlex.quote()'. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
D38 · OSV Dependency Vulnerabilities · Medium advisory (unmaintained) · ×2
  • Medium advisory (unmaintained): RUSTSEC-2024-0436 Cargo.lock — paste 1.0.15: RUSTSEC-2024-0436 — no fixed version exists: the advisory reports the package as unmaintained. paste is not declared in this repo's manifests: it is pulled in transitively by libcst 1.8.6, so the action is on the dependency that requires it — upgrade or replace that dependent. (in 2 lockfiles)
  • Medium advisory (unmaintained): RUSTSEC-2026-0173 Cargo.lock — proc-macro-error2 2.0.1: RUSTSEC-2026-0173 — no fixed version exists: the advisory reports the package as unmaintained. proc-macro-error2 is not declared in this repo's manifests: it is pulled in transitively by defmt-macros 1.1.0, so the action is on the dependency that requires it — upgrade or replace that dependent.
D38 · OSV Dependency Vulnerabilities · Medium vulnerability · ×2
  • Medium vulnerability: RUSTSEC-2026-0204 Cargo.lock — crossbeam-epoch 0.9.18: RUSTSEC-2026-0204 — crossbeam-epoch is not declared in this repo's manifests: it is pulled in transitively by crossbeam 0.8.4 and crossbeam-deque 0.8.6, so upgrade the dependency that requires it (or force it with `cargo update -p crossbeam-epoch@0.9.18 --precise 0.9.20`, or a `[patch.crates-io]` entry).
  • Medium vulnerability: [GHSA redacted] playground/package-lock.json — smol-toml 1.4.1: [GHSA redacted] — upgrade to 1.6.1
D1 · Cyclomatic Complexity · expression · ×1
  • expression::expression (cyclomatic 504) crates/ruff_linter/src/checkers/ast/analyze/expression.rs:25 — expression::expression has cyclomatic complexity 504 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · statement · ×1
  • statement::statement (cyclomatic 414) crates/ruff_linter/src/checkers/ast/analyze/statement.rs:19 — statement::statement has cyclomatic complexity 414 (threshold 15). Of this number, 412 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Bindings · ×1
  • Bindings::evaluate_known_cases (cyclomatic 214) crates/ty_python_semantic/src/types/call/bind.rs:1456 — Bindings::evaluate_known_cases has cyclomatic complexity 214 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · moved_to_provider_in_3 · ×1
  • moved_to_provider_in_3::check_names_moved_to_provider (cyclomatic 111) crates/ruff_linter/src/rules/airflow/rules/moved_to_provider_in_3.rs:111 — moved_to_provider_in_3::check_names_moved_to_provider has cyclomatic complexity 111 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DisplayRepresentation · ×1
  • DisplayRepresentation::fmt_detailed (cyclomatic 89) crates/ty_python_semantic/src/types/display.rs:949 — DisplayRepresentation::fmt_detailed has cyclomatic complexity 89 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ImportStatement · ×1
  • ImportStatement::detect (cyclomatic 77) crates/ty_ide/src/completion.rs:2502 — ImportStatement::detect has cyclomatic complexity 77 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · comparisons · ×1
  • comparisons::infer_binary_type_comparison_inner (cyclomatic 72) crates/ty_python_semantic/src/types/infer/comparisons.rs:296 — comparisons::infer_binary_type_comparison_inner has cyclomatic complexity 72 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · definition · ×1
  • definition::definition (cyclomatic 68) crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs:632 — definition::definition has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BindingError · ×1
  • BindingError::report_diagnostic (cyclomatic 66) crates/ty_python_semantic/src/types/call/bind.rs:7885 — BindingError::report_diagnostic has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BoundSuperType · ×1
  • BoundSuperType::build (cyclomatic 64) crates/ty_python_semantic/src/types/bound_super.rs:487 — BoundSuperType::build has cyclomatic complexity 64 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ResolvedPythonType · ×1
  • ResolvedPythonType::from (cyclomatic 61) crates/ruff_python_semantic/src/analyze/type_inference.rs:71 — ResolvedPythonType::from has cyclomatic complexity 61 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · KnownFunction · ×1
  • KnownFunction::check_call (cyclomatic 59) crates/ty_python_semantic/src/types/function.rs:2380 — KnownFunction::check_call has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimpleTokenizer · ×1
  • SimpleTokenizer::next_token_inner (cyclomatic 57) crates/ruff_python_trivia/src/tokenizer.rs:567 — SimpleTokenizer::next_token_inner has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · placement · ×1
  • placement::handle_enclosed_comment (cyclomatic 56) crates/ruff_python_formatter/src/comments/placement.rs:191 — placement::handle_enclosed_comment has cyclomatic complexity 56 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · suspicious_imports · ×1
  • suspicious_imports::suspicious_imports (cyclomatic 52) crates/ruff_linter/src/rules/flake8_bandit/rules/suspicious_imports.rs:367 — suspicious_imports::suspicious_imports has cyclomatic complexity 52 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LintConfiguration · ×1
  • LintConfiguration::as_rule_table (cyclomatic 52) crates/ruff_workspace/src/configuration.rs:899 — LintConfiguration::as_rule_table has cyclomatic complexity 52 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · deferred_scopes · ×1
  • deferred_scopes::deferred_scopes (cyclomatic 50) crates/ruff_linter/src/checkers/ast/analyze/deferred_scopes.rs:12 — deferred_scopes::deferred_scopes has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FitsMeasurer · ×1
  • FitsMeasurer::fits_element (cyclomatic 49) crates/ruff_formatter/src/printer/mod.rs:1166 — FitsMeasurer::fits_element has cyclomatic complexity 49 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · suspicious_function_call · ×1
  • suspicious_function_call::suspicious_function (cyclomatic 49) crates/ruff_linter/src/rules/flake8_bandit/rules/suspicious_function_call.rs:995 — suspicious_function_call::suspicious_function has cyclomatic complexity 49 (threshold 15). Of this number, 40 points are the body's own statements and 9 belong to 4 function items declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormatSuite · ×1
  • FormatSuite::fmt (cyclomatic 49) crates/ruff_python_formatter/src/statement/suite.rs:96 — FormatSuite::fmt has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProjectDatabase · ×1
  • ProjectDatabase::apply_changes (cyclomatic 49) crates/ty_project/src/db/changes.rs:33 — ProjectDatabase::apply_changes has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · configuration · ×1
  • configuration::warn_about_deprecated_top_level_lint_options (cyclomatic 47) crates/ruff_workspace/src/configuration.rs:1479 — configuration::warn_about_deprecated_top_level_lint_options has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · noqa · ×1
  • noqa::check_noqa (cyclomatic 46) crates/ruff_linter/src/checkers/noqa.rs:28 — noqa::check_noqa has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SemanticSyntaxError · ×1
  • SemanticSyntaxError::fmt (cyclomatic 44) crates/ruff_python_parser/src/semantic_errors.rs:1291 — SemanticSyntaxError::fmt has cyclomatic complexity 44 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AllMembers · ×1
  • AllMembers::extend_with_type (cyclomatic 43) crates/ty_python_semantic/src/types/list_members.rs:164 — AllMembers::extend_with_type has cyclomatic complexity 43 (threshold 15). Of this number, 41 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ImportReplacer · ×1
  • ImportReplacer::without_renames (cyclomatic 42) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs:483 — ImportReplacer::without_renames has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · check_docstring · ×1
  • check_docstring::check_docstring (cyclomatic 42) crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs:1230 — check_docstring::check_docstring has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ruff · ×1
  • ruff::check (cyclomatic 39) crates/ruff/src/lib.rs:237 — ruff::check has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hardcoded_sql_expression · ×1
  • hardcoded_sql_expression::is_explicit_concatenation (cyclomatic 39) crates/ruff_linter/src/rules/flake8_bandit/rules/hardcoded_sql_expression.rs:141 — hardcoded_sql_expression::is_explicit_concatenation has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · runtime_value_in_dag_or_task · ×1
  • runtime_value_in_dag_or_task::find_runtime_varying_call (cyclomatic 39) crates/ruff_linter/src/rules/airflow/rules/runtime_value_in_dag_or_task.rs:98 — runtime_value_in_dag_or_task::find_runtime_varying_call has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FormatExpr · ×1
  • FormatExpr::fmt (cyclomatic 39) crates/ruff_python_formatter/src/expression/mod.rs:76 — FormatExpr::fmt has cyclomatic complexity 39 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · definitions · ×1
  • definitions::definitions (cyclomatic 37) crates/ruff_linter/src/checkers/ast/analyze/definitions.rs:19 — definitions::definitions has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ErrorContext · ×1
  • ErrorContext::render (cyclomatic 36) crates/ty_python_semantic/src/types/relation_error.rs:154 — ErrorContext::render has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · overloaded_function · ×1
  • overloaded_function::check_overloaded_function (cyclomatic 36) crates/ty_python_semantic/src/types/infer/builder/post_inference/overloaded_function.rs:32 — overloaded_function::check_overloaded_function has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · extraneous_whitespace · ×1
  • extraneous_whitespace::extraneous_whitespace (cyclomatic 35) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/extraneous_whitespace.rs:131 — extraneous_whitespace::extraneous_whitespace has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Truthiness · ×1
  • Truthiness::from_expr (cyclomatic 35) crates/ruff_python_ast/src/helpers.rs:1393 — Truthiness::from_expr has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClassBase · ×1
  • ClassBase::try_from_type (cyclomatic 35) crates/ty_python_semantic/src/types/class_base.rs:129 — ClassBase::try_from_type has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · pydantic · ×1
  • pydantic::lax_input_type_impl (cyclomatic 35) crates/ty_python_semantic/src/types/dedicated/pydantic.rs:944 — pydantic::lax_input_type_impl has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · linter · ×1
  • linter::check_path (cyclomatic 34) crates/ruff_linter/src/linter.rs:119 — linter::check_path has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IterationError · ×1
  • IterationError::report_diagnostic (cyclomatic 34) crates/ty_python_semantic/src/types/iteration.rs:584 — IterationError::report_diagnostic has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FormatStatementsLastExpression · ×1
  • FormatStatementsLastExpression::fmt (cyclomatic 33) crates/ruff_python_formatter/src/statement/stmt_assign.rs:277 — FormatStatementsLastExpression::fmt has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DunderAllNamesCollector · ×1
  • DunderAllNamesCollector::visit_stmt (cyclomatic 33) crates/ty_python_semantic/src/dunder_all.rs:213 — DunderAllNamesCollector::visit_stmt has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RecoveryContext · ×1
  • RecoveryContext::from_kind (cyclomatic 32) crates/ruff_python_parser/src/parser/mod.rs:1643 — RecoveryContext::from_kind has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SymbolVisitor · ×1
  • SymbolVisitor::visit_stmt (cyclomatic 32) crates/ty_ide/src/symbols.rs:1245 — SymbolVisitor::visit_stmt has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DisplayKnownInstanceRepr · ×1
  • DisplayKnownInstanceRepr::fmt_detailed (cyclomatic 32) crates/ty_python_semantic/src/types/display.rs:3253 — DisplayKnownInstanceRepr::fmt_detailed has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · enums · ×1
  • enums::enum_metadata (cyclomatic 32) crates/ty_python_semantic/src/types/enums.rs:912 — enums::enum_metadata has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compound_statements · ×1
  • compound_statements::compound_statements (cyclomatic 31) crates/ruff_linter/src/rules/pycodestyle/rules/compound_statements.rs:104 — compound_statements::compound_statements has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · redefined_while_unused · ×1
  • redefined_while_unused::redefined_while_unused (cyclomatic 31) crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs:95 — redefined_while_unused::redefined_while_unused has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · non_slot_assignment · ×1
  • non_slot_assignment::is_attributes_not_in_slots (cyclomatic 31) crates/ruff_linter/src/rules/pylint/rules/non_slot_assignment.rs:104 — non_slot_assignment::is_attributes_not_in_slots has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · outdated_version_block · ×1
  • outdated_version_block::outdated_version_block (cyclomatic 31) crates/ruff_linter/src/rules/pyupgrade/rules/outdated_version_block.rs:91 — outdated_version_block::outdated_version_block has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClassInfoConstraintFunction · ×1
  • ClassInfoConstraintFunction::generate_constraint (cyclomatic 31) crates/ty_python_semantic/src/types/narrow.rs:431 — ClassInfoConstraintFunction::generate_constraint has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · BlockBuilder · ×1
  • BlockBuilder::visit_stmt (cyclomatic 30) crates/ruff_linter/src/rules/isort/block.rs:124 — BlockBuilder::visit_stmt has cyclomatic complexity 30 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · whitespace_around_named_parameter_equals · ×1
  • whitespace_around_named_parameter_equals::whitespace_around_named_parameter_equals (cyclomatic 30) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs:90 — whitespace_around_named_parameter_equals::whitespace_around_named_parameter_equals has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · literal_comparisons · ×1
  • literal_comparisons::literal_comparisons (cyclomatic 29) crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs:207 — literal_comparisons::literal_comparisons has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sections · ×1
  • sections::blanks_and_section_underline (cyclomatic 29) crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs:1475 — sections::blanks_and_section_underline has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalReferencesFinder · ×1
  • LocalReferencesFinder::enter_node (cyclomatic 29) crates/ty_ide/src/references.rs:380 — LocalReferencesFinder::enter_node has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bad_generator_return_type · ×1
  • bad_generator_return_type::bad_generator_return_type (cyclomatic 28) crates/ruff_linter/src/rules/flake8_pyi/rules/bad_generator_return_type.rs:92 — bad_generator_return_type::bad_generator_return_type has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · missing_whitespace_around_operator · ×1
  • missing_whitespace_around_operator::missing_whitespace_around_operator (cyclomatic 28) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_around_operator.rs:168 — missing_whitespace_around_operator::missing_whitespace_around_operator has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · general · ×1
  • general::render_with_indentation_mode (cyclomatic 28) crates/ty_ide/src/docstring/markdown/general.rs:74 — general::render_with_indentation_mode has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArgumentMatcher · ×1
  • ArgumentMatcher::match_variadic (cyclomatic 28) crates/ty_python_semantic/src/types/call/bind.rs:4631 — ArgumentMatcher::match_variadic has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SpecialFormType · ×1
  • SpecialFormType::in_type_expression (cyclomatic 28) crates/ty_python_semantic/src/types/special_form.rs:826 — SpecialFormType::in_type_expression has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Diff · ×1
  • Diff::fmt (cyclomatic 27) crates/ruff_db/src/diagnostic/render/full.rs:130 — Diff::fmt has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoopMutationsVisitor · ×1
  • LoopMutationsVisitor::visit_stmt (cyclomatic 27) crates/ruff_linter/src/rules/flake8_bugbear/rules/loop_iterator_mutation.rs:339 — LoopMutationsVisitor::visit_stmt has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KnownClass · ×1
  • KnownClass::canonical_module (cyclomatic 27) crates/ty_python_semantic/src/types/class/known.rs:1288 — KnownClass::canonical_module has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · tokens · ×1
  • tokens::check_tokens (cyclomatic 26) crates/ruff_linter/src/checkers/tokens.rs:23 — tokens::check_tokens has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · manual_list_comprehension · ×1
  • manual_list_comprehension::manual_list_comprehension (cyclomatic 26) crates/ruff_linter/src/rules/perflint/rules/manual_list_comprehension.rs:97 — manual_list_comprehension::manual_list_comprehension has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FoldingRangeVisitor · ×1
  • FoldingRangeVisitor::enter_node (cyclomatic 26) crates/ty_ide/src/folding_range.rs:587 — FoldingRangeVisitor::enter_node has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Debouncer · ×1
  • Debouncer::add_event (cyclomatic 26) crates/ty_project/src/watch/watcher.rs:230 — Debouncer::add_event has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LoopBindingsVisitor · ×1
  • LoopBindingsVisitor::visit_stmt (cyclomatic 26) crates/ty_python_core/src/builder/loop_bindings_visitor.rs:66 — LoopBindingsVisitor::visit_stmt has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · indent · ×1
  • indent::indent (cyclomatic 25) crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs:184 — indent::indent has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResolvedClientCapabilities · ×1
  • ResolvedClientCapabilities::new (cyclomatic 25) crates/ty_server/src/capabilities.rs:204 — ResolvedClientCapabilities::new has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DisplayParameters · ×1
  • DisplayParameters::fmt_detailed (cyclomatic 25) crates/ty_python_semantic/src/types/display.rs:2378 — DisplayParameters::fmt_detailed has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Mro · ×1
  • Mro::of_static_class (cyclomatic 25) crates/ty_python_semantic/src/types/mro.rs:54 — Mro::of_static_class has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · generate_ty_cli_reference · ×1
  • generate_ty_cli_reference::generate_command (cyclomatic 24) crates/ruff_dev/src/generate_ty_cli_reference.rs:91 — generate_ty_cli_reference::generate_command has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FStringConversion · ×1
  • FStringConversion::try_convert (cyclomatic 24) crates/ruff_linter/src/rules/pyupgrade/rules/f_strings.rs:246 — FStringConversion::try_convert has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unnecessary_lambda · ×1
  • unnecessary_lambda::unnecessary_lambda (cyclomatic 24) crates/ruff_linter/src/rules/pylint/rules/unnecessary_lambda.rs:73 — unnecessary_lambda::unnecessary_lambda has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · super_call_with_parameters · ×1
  • super_call_with_parameters::super_call_with_parameters (cyclomatic 24) crates/ruff_linter/src/rules/pyupgrade/rules/super_call_with_parameters.rs:72 — super_call_with_parameters::super_call_with_parameters has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · manual_dict_comprehension · ×1
  • manual_dict_comprehension::manual_dict_comprehension (cyclomatic 24) crates/ruff_linter/src/rules/perflint/rules/manual_dict_comprehension.rs:85 — manual_dict_comprehension::manual_dict_comprehension has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bindings · ×1
  • bindings::bindings (cyclomatic 24) crates/ruff_linter/src/checkers/ast/analyze/bindings.rs:12 — bindings::bindings has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormatImplicitConcatenatedStringFlat · ×1
  • FormatImplicitConcatenatedStringFlat::new::merge_flags (cyclomatic 24) crates/ruff_python_formatter/src/string/implicit.rs:137 — FormatImplicitConcatenatedStringFlat::new::merge_flags has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProjectFilesWalker · ×1
  • ProjectFilesWalker::collect_vec (cyclomatic 24) crates/ty_project/src/walk.rs:147 — ProjectFilesWalker::collect_vec has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArgumentTypeChecker · ×1
  • ArgumentTypeChecker::infer_specialization (cyclomatic 24) crates/ty_python_semantic/src/types/call/bind.rs:5300 — ArgumentTypeChecker::infer_specialization has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContextManagerError · ×1
  • ContextManagerError::report_diagnostic (cyclomatic 24) crates/ty_python_semantic/src/types/context_manager.rs:138 — ContextManagerError::report_diagnostic has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SubscriptErrorKind · ×1
  • SubscriptErrorKind::report_diagnostic (cyclomatic 24) crates/ty_python_semantic/src/types/subscript.rs:205 — SubscriptErrorKind::report_diagnostic has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · reachability · ×1
  • reachability::analyze_single_pattern_predicate_kind (cyclomatic 24) crates/ty_python_semantic/src/reachability.rs:1263 — reachability::analyze_single_pattern_predicate_kind has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unused_bindings · ×1
  • unused_bindings::unused_bindings (cyclomatic 24) crates/ty_python_semantic/src/types/ide_support/unused_bindings.rs:105 — unused_bindings::unused_bindings has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LinePreprocessor · ×1
  • LinePreprocessor::next (cyclomatic 23) crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs:429 — LinePreprocessor::next has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · missing_maxsplit_arg · ×1
  • missing_maxsplit_arg::missing_maxsplit_arg (cyclomatic 23) crates/ruff_linter/src/rules/pylint/rules/missing_maxsplit_arg.rs:90 — missing_maxsplit_arg::missing_maxsplit_arg has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unused_arguments · ×1
  • unused_arguments::unused_arguments (cyclomatic 23) crates/ruff_linter/src/rules/flake8_unused_arguments/rules/unused_arguments.rs:430 — unused_arguments::unused_arguments has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · native_literals · ×1
  • native_literals::native_literals (cyclomatic 23) crates/ruff_linter/src/rules/pyupgrade/rules/native_literals.rs:185 — native_literals::native_literals has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · xcom_pull_in_template_string · ×1
  • xcom_pull_in_template_string::parse_xcom_pull_template (cyclomatic 23) crates/ruff_linter/src/rules/airflow/rules/xcom_pull_in_template_string.rs:140 — xcom_pull_in_template_string::parse_xcom_pull_template has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormatInterpolatedElement · ×1
  • FormatInterpolatedElement::fmt (cyclomatic 23) crates/ruff_python_formatter/src/other/interpolated_string_element.rs:98 — FormatInterpolatedElement::fmt has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MatchPatternVisitor · ×1
  • MatchPatternVisitor::visit_pattern (cyclomatic 23) crates/ruff_python_parser/src/semantic_errors.rs:2122 — MatchPatternVisitor::visit_pattern has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BackwardsTokenizer · ×1
  • BackwardsTokenizer::next_token_inner (cyclomatic 23) crates/ruff_python_trivia/src/tokenizer.rs:918 — BackwardsTokenizer::next_token_inner has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PortableGlobPattern · ×1
  • PortableGlobPattern::parse (cyclomatic 23) crates/ty_project/src/glob/portable.rs:40 — PortableGlobPattern::parse has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Constraint · ×1
  • Constraint::new_node_with_bounds (cyclomatic 23) crates/ty_python_semantic/src/types/constraints.rs:1890 — Constraint::new_node_with_bounds has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · function · ×1
  • function::is_instance_truthiness (cyclomatic 23) crates/ty_python_semantic/src/types/function.rs:1877 — function::is_instance_truthiness has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · unused · ×1
  • unused::check_unused_suppressions (cyclomatic 23) crates/ty_python_semantic/src/suppression/unused.rs:18 — unused::check_unused_suppressions has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · no_method_decorator · ×1
  • no_method_decorator::get_undecorated_methods (cyclomatic 22) crates/ruff_linter/src/rules/pylint/rules/no_method_decorator.rs:102 — no_method_decorator::get_undecorated_methods has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · logical_lines · ×1
  • logical_lines::check_logical_lines (cyclomatic 22) crates/ruff_linter/src/checkers/logical_lines.rs:39 — logical_lines::check_logical_lines has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unnecessary_dunder_call · ×1
  • unnecessary_dunder_call::unnecessary_dunder_call (cyclomatic 22) crates/ruff_linter/src/rules/pylint/rules/unnecessary_dunder_call.rs:97 — unnecessary_dunder_call::unnecessary_dunder_call has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runtime_import_in_type_checking_block · ×1
  • runtime_import_in_type_checking_block::runtime_import_in_type_checking_block (cyclomatic 22) crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs:102 — runtime_import_in_type_checking_block::runtime_import_in_type_checking_block has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · reimplemented_builtin · ×1
  • reimplemented_builtin::convert_for_loop_to_any_all (cyclomatic 22) crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs:76 — reimplemented_builtin::convert_for_loop_to_any_all has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · IsortOptions · ×1
  • IsortOptions::try_into_settings (cyclomatic 22) crates/ruff_workspace/src/options.rs:2927 — IsortOptions::try_into_settings has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExplicitConfigOverrides · ×1
  • ExplicitConfigOverrides::transform (cyclomatic 21) crates/ruff/src/args.rs:1413 — ExplicitConfigOverrides::transform has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Document · ×1
  • Document::propagate_expand::propagate_expands (cyclomatic 21) crates/ruff_formatter/src/format_element/document.rs:57 — Document::propagate_expand::propagate_expands has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · GroupNameFinder · ×1
  • GroupNameFinder::visit_stmt (cyclomatic 21) crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs:117 — GroupNameFinder::visit_stmt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Suppressions · ×1
  • Suppressions::check_suppressions (cyclomatic 21) crates/ruff_linter/src/suppression.rs:442 — Suppressions::check_suppressions has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function item declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · typing_only_runtime_import · ×1
  • typing_only_runtime_import::typing_only_runtime_import (cyclomatic 21) crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs:273 — typing_only_runtime_import::typing_only_runtime_import has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · trailing_commas · ×1
  • trailing_commas::check_token (cyclomatic 21) crates/ruff_linter/src/rules/flake8_commas/rules/trailing_commas.rs:327 — trailing_commas::check_token has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · use_pep604_annotation · ×1
  • use_pep604_annotation::non_pep604_annotation (cyclomatic 21) crates/ruff_linter/src/rules/pyupgrade/rules/use_pep604_annotation.rs:148 — use_pep604_annotation::non_pep604_annotation has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unused_import · ×1
  • unused_import::unused_import (cyclomatic 21) crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs:324 — unused_import::unused_import has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · verbatim · ×1
  • verbatim::write_suppressed_statements (cyclomatic 21) crates/ruff_python_formatter/src/verbatim.rs:262 — verbatim::write_suppressed_statements has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · MainLoop · ×1
  • MainLoop::main_loop (cyclomatic 21) crates/ty/src/lib.rs:344 — MainLoop::main_loop has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · containment · ×1
  • containment::containment_behavior (cyclomatic 21) crates/ty_python_semantic/src/types/narrow/containment.rs:17 — containment::containment_behavior has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · diagnostic · ×1
  • diagnostic::report_invalid_method_override (cyclomatic 21) crates/ty_python_semantic/src/types/diagnostic.rs:3755 — diagnostic::report_invalid_method_override has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · place · ×1
  • place::place_from_bindings_impl (cyclomatic 21) crates/ty_python_semantic/src/place.rs:1470 — place::place_from_bindings_impl has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · UnittestAssert · ×1
  • UnittestAssert::generate_assert (cyclomatic 20) crates/ruff_linter/src/rules/flake8_pytest_style/rules/unittest_assert.rs:281 — UnittestAssert::generate_assert has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TypingTarget · ×1
  • TypingTarget::try_from_expr (cyclomatic 20) crates/ruff_linter/src/rules/ruff/typing.rs:73 — TypingTarget::try_from_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · whitespace_before_comment · ×1
  • whitespace_before_comment::whitespace_before_comment (cyclomatic 20) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_before_comment.rs:171 — whitespace_before_comment::whitespace_before_comment has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · type_alias_quotes · ×1
  • type_alias_quotes::quotes_are_unremovable (cyclomatic 20) crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs:329 — type_alias_quotes::quotes_are_unremovable has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · isort · ×1
  • isort::format_import_block (cyclomatic 20) crates/ruff_linter/src/rules/isort/mod.rs:154 — isort::format_import_block has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · shell_injection · ×1
  • shell_injection::shell_injection (cyclomatic 20) crates/ruff_linter/src/rules/flake8_bandit/rules/shell_injection.rs:322 — shell_injection::shell_injection has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnqualifiedName · ×1
  • UnqualifiedName::from_expr (cyclomatic 20) crates/ruff_python_ast/src/name.rs:491 — UnqualifiedName::from_expr has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Terminal · ×1
  • Terminal::from_body (cyclomatic 20) crates/ruff_python_semantic/src/analyze/terminal.rs:49 — Terminal::from_body has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ty · ×1
  • ty::run_check (cyclomatic 20) crates/ty/src/lib.rs:90 — ty::run_check has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContextCursor · ×1
  • ContextCursor::incomplete_keywords (cyclomatic 20) crates/ty_ide/src/completion.rs:1177 — ContextCursor::incomplete_keywords has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · PathBounds · ×1
  • PathBounds::default_solve (cyclomatic 20) crates/ty_python_semantic/src/types/constraints.rs:3847 — PathBounds::default_solve has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DisplayUnionType · ×1
  • DisplayUnionType::fmt_detailed (cyclomatic 20) crates/ty_python_semantic/src/types/display.rs:2693 — DisplayUnionType::fmt_detailed has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to 2 function items declared inside it. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnionElement · ×1
  • UnionElement::try_reduce (cyclomatic 20) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:378 — UnionElement::try_reduce has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fixes · ×1
  • fixes::fix_all (cyclomatic 20) crates/ty_python_semantic/src/fixes.rs:78 — fixes::fix_all has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GithubRenderer · ×1
  • GithubRenderer::render (cyclomatic 19) crates/ruff_db/src/diagnostic/render/github.rs:18 — GithubRenderer::render has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · blank_before_after_class · ×1
  • blank_before_after_class::blank_before_after_class (cyclomatic 19) crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_class.rs:168 — blank_before_after_class::blank_before_after_class has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sorted_min_max · ×1
  • sorted_min_max::sorted_min_max (cyclomatic 19) crates/ruff_linter/src/rules/refurb/rules/sorted_min_max.rs:88 — sorted_min_max::sorted_min_max has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FormatExprSlice · ×1
  • FormatExprSlice::fmt_fields (cyclomatic 19) crates/ruff_python_formatter/src/expression/expr_slice.rs:17 — FormatExprSlice::fmt_fields has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormatParameters · ×1
  • FormatParameters::fmt_fields (cyclomatic 19) crates/ruff_python_formatter/src/other/parameters.rs:49 — FormatParameters::fmt_fields has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StringNormalizer · ×1
  • StringNormalizer::preferred_quote_style (cyclomatic 19) crates/ruff_python_formatter/src/string/normalize.rs:44 — StringNormalizer::preferred_quote_style has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnicodeEscape · ×1
  • UnicodeEscape::normalize (cyclomatic 19) crates/ruff_python_formatter/src/string/normalize.rs:822 — UnicodeEscape::normalize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · class · ×1
  • class::any_member_declaration::any_stmt_in_body (cyclomatic 19) crates/ruff_python_semantic/src/analyze/class.rs:181 — class::any_member_declaration::any_stmt_in_body has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VariableLengthTuple · ×1
  • VariableLengthTuple::mixed_forward_slice_plan (cyclomatic 19) crates/ty_python_semantic/src/types/tuple.rs:1682 — VariableLengthTuple::mixed_forward_slice_plan has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · match_pattern · ×1
  • match_pattern::definite_match_pattern_type_for_subject (cyclomatic 19) crates/ty_python_semantic/src/types/match_pattern.rs:585 — match_pattern::definite_match_pattern_type_for_subject has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Collector · ×1
  • Collector::visit_stmt (cyclomatic 18) crates/ruff_graph/src/collector.rs:43 — Collector::visit_stmt has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SuspiciousVariablesVisitor · ×1
  • SuspiciousVariablesVisitor::visit_expr (cyclomatic 18) crates/ruff_linter/src/rules/flake8_bugbear/rules/function_uses_loop_variable.rs:126 — SuspiciousVariablesVisitor::visit_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UselessSuppressionComments · ×1
  • UselessSuppressionComments::check_suppression_comment (cyclomatic 18) crates/ruff_linter/src/rules/ruff/rules/invalid_formatter_suppression_comment.rs:128 — UselessSuppressionComments::check_suppression_comment has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReFunc · ×1
  • ReFunc::from_call_expr (cyclomatic 18) crates/ruff_linter/src/rules/ruff/rules/unnecessary_regular_expression.rs:172 — ReFunc::from_call_expr has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SuppressionsBuilder · ×1
  • SuppressionsBuilder::load_from_tokens (cyclomatic 18) crates/ruff_linter/src/suppression.rs:727 — SuppressionsBuilder::load_from_tokens has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · missing_whitespace · ×1
  • missing_whitespace::missing_whitespace (cyclomatic 18) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs:44 — missing_whitespace::missing_whitespace has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · function_is_too_complex · ×1
  • function_is_too_complex::get_complexity_number (cyclomatic 18) crates/ruff_linter/src/rules/mccabe/rules/function_is_too_complex.rs:78 — function_is_too_complex::get_complexity_number has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · static_join_to_fstring · ×1
  • static_join_to_fstring::build_fstring (cyclomatic 18) crates/ruff_linter/src/rules/flynt/rules/static_join_to_fstring.rs:73 — static_join_to_fstring::build_fstring has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · private_member_access · ×1
  • private_member_access::private_member_access (cyclomatic 18) crates/ruff_linter/src/rules/flake8_self/rules/private_member_access.rs:73 — private_member_access::private_member_access has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · non_self_return_type · ×1
  • non_self_return_type::non_self_return_type (cyclomatic 18) crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs:148 — non_self_return_type::non_self_return_type has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · verbose_decimal_constructor · ×1
  • verbose_decimal_constructor::verbose_decimal_constructor (cyclomatic 18) crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs:74 — verbose_decimal_constructor::verbose_decimal_constructor has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BinaryLike · ×1
  • BinaryLike::fmt (cyclomatic 18) crates/ruff_python_formatter/src/expression/binary_like.rs:268 — BinaryLike::fmt has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RangedValue · ×1
  • RangedValue::to_override (cyclomatic 18) crates/ty_project/src/metadata/options.rs:1897 — RangedValue::to_override has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NotebookDocument · ×1
  • NotebookDocument::update (cyclomatic 18) crates/ruff_server/src/edit/notebook.rs:106 — NotebookDocument::update has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RuffSettingsIndex · ×1
  • RuffSettingsIndex::new (cyclomatic 18) crates/ruff_server/src/session/index/ruff_settings.rs:166 — RuffSettingsIndex::new has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PythonFilesVisitor · ×1
  • PythonFilesVisitor::visit (cyclomatic 18) crates/ruff_workspace/src/resolver.rs:606 — PythonFilesVisitor::visit has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExportFinder · ×1
  • ExportFinder::visit_stmt (cyclomatic 18) crates/ty_python_core/src/re_exports.rs:175 — ExportFinder::visit_stmt has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InteriorNode · ×1
  • InteriorNode::simplify (cyclomatic 18) crates/ty_python_semantic/src/types/constraints.rs:4560 — InteriorNode::simplify has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · known_instance · ×1
  • known_instance::walk_known_instance_type (cyclomatic 18) crates/ty_python_semantic/src/types/known_instance.rs:164 — known_instance::walk_known_instance_type has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ConciseRenderer · ×1
  • ConciseRenderer::render (cyclomatic 17) crates/ruff_db/src/diagnostic/render/concise.rs:18 — ConciseRenderer::render has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReturnVisitor · ×1
  • ReturnVisitor::visit_stmt (cyclomatic 17) crates/ruff_linter/src/rules/flake8_return/visitor.rs:63 — ReturnVisitor::visit_stmt has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unnecessary_spread · ×1
  • unnecessary_spread::unnecessary_spread_fix (cyclomatic 17) crates/ruff_linter/src/rules/flake8_pie/rules/unnecessary_spread.rs:67 — unnecessary_spread::unnecessary_spread_fix has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · needless_bool · ×1
  • needless_bool::needless_bool (cyclomatic 17) crates/ruff_linter/src/rules/flake8_simplify/rules/needless_bool.rs:93 — needless_bool::needless_bool has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · missing_fstring_syntax · ×1
  • missing_fstring_syntax::should_be_fstring (cyclomatic 17) crates/ruff_linter/src/rules/ruff/rules/missing_fstring_syntax.rs:188 — missing_fstring_syntax::should_be_fstring has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unspecified_encoding · ×1
  • unspecified_encoding::is_violation (cyclomatic 17) crates/ruff_linter/src/rules/pylint/rules/unspecified_encoding.rs:210 — unspecified_encoding::is_violation has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · f_strings · ×1
  • f_strings::f_strings (cyclomatic 17) crates/ruff_linter/src/rules/pyupgrade/rules/f_strings.rs:405 — f_strings::f_strings has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · if_stmt_min_max · ×1
  • if_stmt_min_max::if_stmt_min_max (cyclomatic 17) crates/ruff_linter/src/rules/pylint/rules/if_stmt_min_max.rs:85 — if_stmt_min_max::if_stmt_min_max has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · FormatExprAttribute · ×1
  • FormatExprAttribute::fmt_fields (cyclomatic 17) crates/ruff_python_formatter/src/expression/expr_attribute.rs:28 — FormatExprAttribute::fmt_fields has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MaybeParenthesizeExpression · ×1
  • MaybeParenthesizeExpression::fmt (cyclomatic 17) crates/ruff_python_formatter/src/expression/mod.rs:346 — MaybeParenthesizeExpression::fmt has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CFGBuilder · ×1
  • CFGBuilder::process_stmts (cyclomatic 17) crates/ruff_python_semantic/src/cfg/graph.rs:194 — CFGBuilder::process_stmts has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · InlayHintVisitor · ×1
  • InlayHintVisitor::visit_expr (cyclomatic 17) crates/ty_ide/src/inlay_hints.rs:476 — InlayHintVisitor::visit_expr has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hover · ×1
  • hover::hover (cyclomatic 17) crates/ty_ide/src/hover.rs:15 — hover::hover has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · resolve · ×1
  • resolve::dynamic_resolution_paths (cyclomatic 17) crates/ty_module_resolver/src/resolve.rs:870 — resolve::dynamic_resolution_paths has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · module_glob · ×1
  • module_glob::glob_to_regex (cyclomatic 17) crates/ty_module_resolver/src/module_glob.rs:267 — module_glob::glob_to_regex has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Tuple · ×1
  • Tuple::try_for_each_element_pair (cyclomatic 17) crates/ty_python_semantic/src/types/tuple.rs:2433 — Tuple::try_for_each_element_pair has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · paramspec_validation · ×1
  • paramspec_validation::validate_paramspec_components (cyclomatic 17) crates/ty_python_semantic/src/types/infer/builder/paramspec_validation.rs:12 — paramspec_validation::validate_paramspec_components has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · order · ×1
  • order::order_imports (cyclomatic 16) crates/ruff_linter/src/rules/isort/order.rs:10 — order::order_imports has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bit_count · ×1
  • bit_count::bit_count (cyclomatic 16) crates/ruff_linter/src/rules/refurb/rules/bit_count.rs:67 — bit_count::bit_count has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · deprecated_mock_import · ×1
  • deprecated_mock_import::deprecated_mock_import (cyclomatic 16) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs:284 — deprecated_mock_import::deprecated_mock_import has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · string_in_exception · ×1
  • string_in_exception::string_in_exception (cyclomatic 16) crates/ruff_linter/src/rules/flake8_errmsg/rules/string_in_exception.rs:187 — string_in_exception::string_in_exception has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · replaceable_by_pathlib · ×1
  • replaceable_by_pathlib::replaceable_by_pathlib (cyclomatic 16) crates/ruff_linter/src/rules/flake8_use_pathlib/rules/replaceable_by_pathlib.rs:13 — replaceable_by_pathlib::replaceable_by_pathlib has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ambiguous_unicode_character · ×1
  • ambiguous_unicode_character::ambiguous_unicode_character (cyclomatic 16) crates/ruff_linter/src/rules/ruff/rules/ambiguous_unicode_character.rs:225 — ambiguous_unicode_character::ambiguous_unicode_character has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · not_missing · ×1
  • not_missing::not_missing (cyclomatic 16) crates/ruff_linter/src/rules/pydocstyle/rules/not_missing.rs:565 — not_missing::not_missing has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · simple_defaults · ×1
  • simple_defaults::is_valid_default_value_with_annotation (cyclomatic 16) crates/ruff_linter/src/rules/flake8_pyi/rules/simple_defaults.rs:292 — simple_defaults::is_valid_default_value_with_annotation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · invalid_literal_comparisons · ×1
  • invalid_literal_comparisons::locate_cmp_ops (cyclomatic 16) crates/ruff_linter/src/rules/pyflakes/rules/invalid_literal_comparisons.rs:147 — invalid_literal_comparisons::locate_cmp_ops has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · class_as_data_structure · ×1
  • class_as_data_structure::class_as_data_structure (cyclomatic 16) crates/ruff_linter/src/rules/flake8_bugbear/rules/class_as_data_structure.rs:48 — class_as_data_structure::class_as_data_structure has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HashableExpr · ×1
  • HashableExpr::from (cyclomatic 16) crates/ruff_python_ast/src/comparable.rs:2014 — HashableExpr::from has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points are its own statements and the rest belongs to 3 function items declared inside it (as_number, as_hashable_constant, as_hashable). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · recovery · ×1
  • recovery::pattern_to_expr (cyclomatic 16) crates/ruff_python_parser/src/parser/recovery.rs:28 — recovery::pattern_to_expr has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · terminal · ×1
  • terminal::sometimes_breaks (cyclomatic 16) crates/ruff_python_semantic/src/analyze/terminal.rs:290 — terminal::sometimes_breaks has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommentRanges · ×1
  • CommentRanges::block_comments (cyclomatic 16) crates/ruff_python_trivia/src/comment_ranges.rs:157 — CommentRanges::block_comments has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · lint · ×1
  • lint::to_lsp_diagnostic (cyclomatic 16) crates/ruff_server/src/lint.rs:269 — lint::to_lsp_diagnostic has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · resolve_definition · ×1
  • resolve_definition::map_stub_definition (cyclomatic 16) crates/ty_python_semantic/src/types/ide_support.rs:2388 — resolve_definition::map_stub_definition has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ide_support · ×1
  • ide_support::definitions_for_attribute (cyclomatic 16) crates/ty_python_semantic/src/types/ide_support.rs:231 — ide_support::definitions_for_attribute has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D19 · Documentation Quality · LLM evaluation failed · ×1
  • LLM evaluation failed — JSON parse error: Expected end of string, but instead reached end of data. Path: $.findings[0].issue | LineNumber: 0 | BytePositionInLine: 991.
D2 · Cognitive Complexity · statement · ×1
  • statement::statement (cognitive 708) crates/ruff_linter/src/checkers/ast/analyze/statement.rs:19 — statement::statement has cognitive complexity 708 (threshold 15). Drivers by points: if/else 648, loops 57, boolean chains 2, match/switch 1 (nesting depth added 308). Of this number, 700 points are the body's own statements and 8 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · definition · ×1
  • definition::definition (cognitive 160) crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs:632 — definition::definition has cognitive complexity 160 (threshold 15). Drivers by points: if/else 133, boolean chains 16, match/switch 8, loops 3 (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpecializationBuilder · ×1
  • SpecializationBuilder::infer_map_impl (cognitive 142) crates/ty_python_semantic/src/types/generics.rs:2833 — SpecializationBuilder::infer_map_impl has cognitive complexity 142 (threshold 15). Drivers by points: if/else 94, loops 30, boolean chains 10, match/switch 8 (nesting depth added 80). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LintConfiguration · ×1
  • LintConfiguration::as_rule_table (cognitive 122) crates/ruff_workspace/src/configuration.rs:899 — LintConfiguration::as_rule_table has cognitive complexity 122 (threshold 15). Drivers by points: loops 57, if/else 56, boolean chains 6, match/switch 3 (nesting depth added 69). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ProjectDatabase · ×1
  • ProjectDatabase::apply_changes (cognitive 122) crates/ty_project/src/db/changes.rs:33 — ProjectDatabase::apply_changes has cognitive complexity 122 (threshold 15). Drivers by points: if/else 91, match/switch 24, boolean chains 4, loops 3 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BindingError · ×1
  • BindingError::report_diagnostic (cognitive 120) crates/ty_python_semantic/src/types/call/bind.rs:7885 — BindingError::report_diagnostic has cognitive complexity 120 (threshold 15). Drivers by points: if/else 105, match/switch 10, loops 4, boolean chains 1 (nesting depth added 67). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · extraneous_whitespace · ×1
  • extraneous_whitespace::extraneous_whitespace (cognitive 114) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/extraneous_whitespace.rs:131 — extraneous_whitespace::extraneous_whitespace has cognitive complexity 114 (threshold 15). Drivers by points: if/else 103, boolean chains 5, match/switch 5, loops 1 (nesting depth added 85). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnownFunction · ×1
  • KnownFunction::check_call (cognitive 109) crates/ty_python_semantic/src/types/function.rs:2380 — KnownFunction::check_call has cognitive complexity 109 (threshold 15). Drivers by points: if/else 82, match/switch 14, loops 10, boolean chains 3 (nesting depth added 63). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GotoTarget · ×1
  • GotoTarget::from_covering_node (cognitive 108) crates/ty_ide/src/goto.rs:935 — GotoTarget::from_covering_node has cognitive complexity 108 (threshold 15). Drivers by points: if/else 77, match/switch 16, boolean chains 13, loops 2 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · deferred_scopes · ×1
  • deferred_scopes::deferred_scopes (cognitive 99) crates/ruff_linter/src/checkers/ast/analyze/deferred_scopes.rs:12 — deferred_scopes::deferred_scopes has cognitive complexity 99 (threshold 15). Drivers by points: if/else 88, boolean chains 6, loops 5 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · literal_comparisons · ×1
  • literal_comparisons::literal_comparisons (cognitive 96) crates/ruff_linter/src/rules/pycodestyle/rules/literal_comparisons.rs:207 — literal_comparisons::literal_comparisons has cognitive complexity 96 (threshold 15). Drivers by points: if/else 74, match/switch 17, loops 3, boolean chains 2 (nesting depth added 63). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatSuite · ×1
  • FormatSuite::fmt (cognitive 94) crates/ruff_python_formatter/src/statement/suite.rs:96 — FormatSuite::fmt has cognitive complexity 94 (threshold 15). Drivers by points: if/else 47, match/switch 35, boolean chains 11, loops 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ruff · ×1
  • ruff::check (cognitive 88) crates/ruff/src/lib.rs:237 — ruff::check has cognitive complexity 88 (threshold 15). Drivers by points: if/else 75, boolean chains 5, loops 4, match/switch 4 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · whitespace_around_named_parameter_equals · ×1
  • whitespace_around_named_parameter_equals::whitespace_around_named_parameter_equals (cognitive 80) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs:90 — whitespace_around_named_parameter_equals::whitespace_around_named_parameter_equals has cognitive complexity 80 (threshold 15). Drivers by points: if/else 63, loops 9, boolean chains 6, match/switch 2 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · redefined_while_unused · ×1
  • redefined_while_unused::redefined_while_unused (cognitive 78) crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs:95 — redefined_while_unused::redefined_while_unused has cognitive complexity 78 (threshold 15). Drivers by points: if/else 67, loops 7, boolean chains 4 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · non_slot_assignment · ×1
  • non_slot_assignment::is_attributes_not_in_slots (cognitive 78) crates/ruff_linter/src/rules/pylint/rules/non_slot_assignment.rs:104 — non_slot_assignment::is_attributes_not_in_slots has cognitive complexity 78 (threshold 15). Drivers by points: if/else 48, loops 20, match/switch 6, boolean chains 4 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatStatementsLastExpression · ×1
  • FormatStatementsLastExpression::fmt (cognitive 75) crates/ruff_python_formatter/src/statement/stmt_assign.rs:277 — FormatStatementsLastExpression::fmt has cognitive complexity 75 (threshold 15). Drivers by points: if/else 66, boolean chains 8, match/switch 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayRepresentation · ×1
  • DisplayRepresentation::fmt_detailed (cognitive 75) crates/ty_python_semantic/src/types/display.rs:949 — DisplayRepresentation::fmt_detailed has cognitive complexity 75 (threshold 15). Drivers by points: if/else 38, match/switch 29, loops 8 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Diff · ×1
  • Diff::fmt (cognitive 70) crates/ruff_db/src/diagnostic/render/full.rs:130 — Diff::fmt has cognitive complexity 70 (threshold 15). Drivers by points: if/else 40, loops 21, match/switch 6, boolean chains 3 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleTokenizer · ×1
  • SimpleTokenizer::next_token_inner (cognitive 69) crates/ruff_python_trivia/src/tokenizer.rs:567 — SimpleTokenizer::next_token_inner has cognitive complexity 69 (threshold 15). Drivers by points: if/else 66, boolean chains 2, match/switch 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · no_method_decorator · ×1
  • no_method_decorator::get_undecorated_methods (cognitive 67) crates/ruff_linter/src/rules/pylint/rules/no_method_decorator.rs:102 — no_method_decorator::get_undecorated_methods has cognitive complexity 67 (threshold 15). Drivers by points: if/else 52, match/switch 11, boolean chains 2, loops 2 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate_ty_cli_reference · ×1
  • generate_ty_cli_reference::generate_command (cognitive 62) crates/ruff_dev/src/generate_ty_cli_reference.rs:91 — generate_ty_cli_reference::generate_command has cognitive complexity 62 (threshold 15). Drivers by points: if/else 38, loops 23, boolean chains 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BinaryLike · ×1
  • BinaryLike::fmt (cognitive 60) crates/ruff_python_formatter/src/expression/binary_like.rs:268 — BinaryLike::fmt has cognitive complexity 60 (threshold 15). Drivers by points: if/else 54, boolean chains 4, loops 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · whitespace_before_comment · ×1
  • whitespace_before_comment::whitespace_before_comment (cognitive 58) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_before_comment.rs:171 — whitespace_before_comment::whitespace_before_comment has cognitive complexity 58 (threshold 15). Drivers by points: if/else 54, boolean chains 3, loops 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Truthiness · ×1
  • Truthiness::from_expr (cognitive 58) crates/ruff_python_ast/src/helpers.rs:1393 — Truthiness::from_expr has cognitive complexity 58 (threshold 15). Drivers by points: if/else 48, match/switch 8, boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · definitions · ×1
  • definitions::definitions (cognitive 56) crates/ruff_linter/src/checkers/ast/analyze/definitions.rs:19 — definitions::definitions has cognitive complexity 56 (threshold 15). Drivers by points: if/else 50, boolean chains 4, loops 1, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DunderAllNamesCollector · ×1
  • DunderAllNamesCollector::visit_stmt (cognitive 56) crates/ty_python_semantic/src/dunder_all.rs:213 — DunderAllNamesCollector::visit_stmt has cognitive complexity 56 (threshold 15). Drivers by points: if/else 38, match/switch 12, loops 5, boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · verbatim · ×1
  • verbatim::write_suppressed_statements (cognitive 55) crates/ruff_python_formatter/src/verbatim.rs:262 — verbatim::write_suppressed_statements has cognitive complexity 55 (threshold 15). Drivers by points: if/else 25, loops 24, match/switch 6 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoundSuperType · ×1
  • BoundSuperType::build (cognitive 54) crates/ty_python_semantic/src/types/bound_super.rs:487 — BoundSuperType::build has cognitive complexity 54 (threshold 15). Drivers by points: match/switch 27, if/else 20, loops 7 (nesting depth added 28). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · suspicious_imports · ×1
  • suspicious_imports::suspicious_imports (cognitive 52) crates/ruff_linter/src/rules/flake8_bandit/rules/suspicious_imports.rs:367 — suspicious_imports::suspicious_imports has cognitive complexity 52 (threshold 15). Drivers by points: if/else 22, loops 20, match/switch 10 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · use_pep604_annotation · ×1
  • use_pep604_annotation::non_pep604_annotation (cognitive 52) crates/ruff_linter/src/rules/pyupgrade/rules/use_pep604_annotation.rs:148 — use_pep604_annotation::non_pep604_annotation has cognitive complexity 52 (threshold 15). Drivers by points: if/else 37, match/switch 7, boolean chains 4, loops 4 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnicodeEscape · ×1
  • UnicodeEscape::normalize (cognitive 52) crates/ruff_python_formatter/src/string/normalize.rs:822 — UnicodeEscape::normalize has cognitive complexity 52 (threshold 15). Drivers by points: if/else 40, match/switch 8, loops 4 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NotebookDocument · ×1
  • NotebookDocument::update (cognitive 52) crates/ruff_server/src/edit/notebook.rs:106 — NotebookDocument::update has cognitive complexity 52 (threshold 15). Drivers by points: if/else 32, loops 20 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MainLoop · ×1
  • MainLoop::main_loop (cognitive 52) crates/ty/src/lib.rs:344 — MainLoop::main_loop has cognitive complexity 52 (threshold 15). Drivers by points: if/else 34, match/switch 17, loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectFilesWalker · ×1
  • ProjectFilesWalker::collect_vec (cognitive 52) crates/ty_project/src/walk.rs:147 — ProjectFilesWalker::collect_vec has cognitive complexity 52 (threshold 15). Drivers by points: if/else 36, match/switch 11, boolean chains 5 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · general · ×1
  • general::render_with_indentation_mode (cognitive 50) crates/ty_ide/src/docstring/markdown/general.rs:74 — general::render_with_indentation_mode has cognitive complexity 50 (threshold 15). Drivers by points: if/else 33, boolean chains 9, match/switch 7, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · enums · ×1
  • enums::enum_metadata (cognitive 50) crates/ty_python_semantic/src/types/enums.rs:912 — enums::enum_metadata has cognitive complexity 50 (threshold 15). Drivers by points: if/else 33, match/switch 12, boolean chains 3, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · suspicious_function_call · ×1
  • suspicious_function_call::suspicious_function (cognitive 49) crates/ruff_linter/src/rules/flake8_bandit/rules/suspicious_function_call.rs:995 — suspicious_function_call::suspicious_function has cognitive complexity 49 (threshold 15). Drivers by points: if/else 36, boolean chains 6, match/switch 6, loops 1 (nesting depth added 24). Of this number, 38 points are the body's own statements and 11 belong to 4 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · missing_whitespace_around_operator · ×1
  • missing_whitespace_around_operator::missing_whitespace_around_operator (cognitive 49) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_around_operator.rs:168 — missing_whitespace_around_operator::missing_whitespace_around_operator has cognitive complexity 49 (threshold 15). Drivers by points: if/else 37, boolean chains 6, match/switch 5, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResolvedPythonType · ×1
  • ResolvedPythonType::from (cognitive 49) crates/ruff_python_semantic/src/analyze/type_inference.rs:71 — ResolvedPythonType::from has cognitive complexity 49 (threshold 15). Drivers by points: match/switch 34, if/else 15 (nesting depth added 30). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · unused · ×1
  • unused::check_unused_suppressions (cognitive 49) crates/ty_python_semantic/src/suppression/unused.rs:18 — unused::check_unused_suppressions has cognitive complexity 49 (threshold 15). Drivers by points: if/else 29, loops 9, boolean chains 7, match/switch 4 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_lambda · ×1
  • unnecessary_lambda::unnecessary_lambda (cognitive 48) crates/ruff_linter/src/rules/pylint/rules/unnecessary_lambda.rs:73 — unnecessary_lambda::unnecessary_lambda has cognitive complexity 48 (threshold 15). Drivers by points: if/else 38, match/switch 5, loops 4, boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · indent · ×1
  • indent::indent (cognitive 48) crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs:184 — indent::indent has cognitive complexity 48 (threshold 15). Drivers by points: if/else 37, boolean chains 7, loops 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unused_bindings · ×1
  • unused_bindings::unused_bindings (cognitive 48) crates/ty_python_semantic/src/types/ide_support/unused_bindings.rs:105 — unused_bindings::unused_bindings has cognitive complexity 48 (threshold 15). Drivers by points: if/else 31, boolean chains 10, loops 7 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime_import_in_type_checking_block · ×1
  • runtime_import_in_type_checking_block::runtime_import_in_type_checking_block (cognitive 47) crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs:102 — runtime_import_in_type_checking_block::runtime_import_in_type_checking_block has cognitive complexity 47 (threshold 15). Drivers by points: if/else 29, loops 11, boolean chains 5, match/switch 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FStringConversion · ×1
  • FStringConversion::try_convert (cognitive 46) crates/ruff_linter/src/rules/pyupgrade/rules/f_strings.rs:246 — FStringConversion::try_convert has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22, match/switch 17, loops 4, boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · outdated_version_block · ×1
  • outdated_version_block::outdated_version_block (cognitive 46) crates/ruff_linter/src/rules/pyupgrade/rules/outdated_version_block.rs:91 — outdated_version_block::outdated_version_block has cognitive complexity 46 (threshold 15). Drivers by points: if/else 27, match/switch 15, boolean chains 3, loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · configuration · ×1
  • configuration::warn_about_deprecated_top_level_lint_options (cognitive 46) crates/ruff_workspace/src/configuration.rs:1479 — configuration::warn_about_deprecated_top_level_lint_options has cognitive complexity 46 (threshold 15). Drivers by points: if/else 46. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SymbolVisitor · ×1
  • SymbolVisitor::visit_stmt (cognitive 46) crates/ty_ide/src/symbols.rs:1245 — SymbolVisitor::visit_stmt has cognitive complexity 46 (threshold 15). Drivers by points: if/else 38, loops 6, boolean chains 1, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AllMembers · ×1
  • AllMembers::extend_with_type (cognitive 46) crates/ty_python_semantic/src/types/list_members.rs:164 — AllMembers::extend_with_type has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22, match/switch 18, boolean chains 4, loops 2 (nesting depth added 23). Of this number, 43 points are the body's own statements and 3 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SuspiciousVariablesVisitor · ×1
  • SuspiciousVariablesVisitor::visit_expr (cognitive 45) crates/ruff_linter/src/rules/flake8_bugbear/rules/function_uses_loop_variable.rs:126 — SuspiciousVariablesVisitor::visit_expr has cognitive complexity 45 (threshold 15). Drivers by points: if/else 30, loops 11, match/switch 3, boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PortableGlobPattern · ×1
  • PortableGlobPattern::parse (cognitive 44) crates/ty_project/src/glob/portable.rs:40 — PortableGlobPattern::parse has cognitive complexity 44 (threshold 15). Drivers by points: if/else 31, loops 7, boolean chains 3, match/switch 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolve · ×1
  • resolve::dynamic_resolution_paths (cognitive 43) crates/ty_module_resolver/src/resolve.rs:870 — resolve::dynamic_resolution_paths has cognitive complexity 43 (threshold 15). Drivers by points: if/else 27, match/switch 8, loops 6, boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlayHintVisitor · ×1
  • InlayHintVisitor::visit_expr (cognitive 42) crates/ty_ide/src/inlay_hints.rs:476 — InlayHintVisitor::visit_expr has cognitive complexity 42 (threshold 15). Drivers by points: if/else 38, loops 2, boolean chains 1, match/switch 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BlockBuilder · ×1
  • BlockBuilder::visit_stmt (cognitive 41) crates/ruff_linter/src/rules/isort/block.rs:124 — BlockBuilder::visit_stmt has cognitive complexity 41 (threshold 15). Drivers by points: loops 33, if/else 6, boolean chains 1, match/switch 1 (nesting depth added 18). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · order · ×1
  • order::order_imports (cognitive 41) crates/ruff_linter/src/rules/isort/order.rs:10 — order::order_imports has cognitive complexity 41 (threshold 15). Drivers by points: if/else 26, loops 10, match/switch 5 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · logical_lines · ×1
  • logical_lines::check_logical_lines (cognitive 41) crates/ruff_linter/src/checkers/logical_lines.rs:39 — logical_lines::check_logical_lines has cognitive complexity 41 (threshold 15). Drivers by points: if/else 37, boolean chains 3, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell_injection · ×1
  • shell_injection::shell_injection (cognitive 41) crates/ruff_linter/src/rules/flake8_bandit/rules/shell_injection.rs:322 — shell_injection::shell_injection has cognitive complexity 41 (threshold 15). Drivers by points: if/else 37, match/switch 3, boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatInterpolatedElement · ×1
  • FormatInterpolatedElement::fmt (cognitive 40) crates/ruff_python_formatter/src/other/interpolated_string_element.rs:98 — FormatInterpolatedElement::fmt has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27, loops 5, match/switch 5, boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · module_glob · ×1
  • module_glob::glob_to_regex (cognitive 40) crates/ty_module_resolver/src/module_glob.rs:267 — module_glob::glob_to_regex has cognitive complexity 40 (threshold 15). Drivers by points: if/else 33, loops 5, boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReFunc · ×1
  • ReFunc::from_call_expr (cognitive 39) crates/ruff_linter/src/rules/ruff/rules/unnecessary_regular_expression.rs:172 — ReFunc::from_call_expr has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22, loops 10, match/switch 4, boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PythonFilesVisitor · ×1
  • PythonFilesVisitor::visit (cognitive 39) crates/ruff_workspace/src/resolver.rs:606 — PythonFilesVisitor::visit has cognitive complexity 39 (threshold 15). Drivers by points: if/else 29, match/switch 10 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Suppressions · ×1
  • Suppressions::check_suppressions (cognitive 38) crates/ruff_linter/src/suppression.rs:442 — Suppressions::check_suppressions has cognitive complexity 38 (threshold 15). Drivers by points: if/else 31, loops 5, boolean chains 2 (nesting depth added 16). Of this number, 27 points are the body's own statements and 11 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · missing_maxsplit_arg · ×1
  • missing_maxsplit_arg::missing_maxsplit_arg (cognitive 38) crates/ruff_linter/src/rules/pylint/rules/missing_maxsplit_arg.rs:90 — missing_maxsplit_arg::missing_maxsplit_arg has cognitive complexity 38 (threshold 15). Drivers by points: if/else 25, match/switch 7, loops 5, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · missing_fstring_syntax · ×1
  • missing_fstring_syntax::should_be_fstring (cognitive 38) crates/ruff_linter/src/rules/ruff/rules/missing_fstring_syntax.rs:188 — missing_fstring_syntax::should_be_fstring has cognitive complexity 38 (threshold 15). Drivers by points: if/else 30, loops 8 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · xcom_pull_in_template_string · ×1
  • xcom_pull_in_template_string::parse_xcom_pull_template (cognitive 38) crates/ruff_linter/src/rules/airflow/rules/xcom_pull_in_template_string.rs:140 — xcom_pull_in_template_string::parse_xcom_pull_template has cognitive complexity 38 (threshold 15). Drivers by points: if/else 30, boolean chains 4, match/switch 3, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MatchPatternVisitor · ×1
  • MatchPatternVisitor::visit_pattern (cognitive 38) crates/ruff_python_parser/src/semantic_errors.rs:2122 — MatchPatternVisitor::visit_pattern has cognitive complexity 38 (threshold 15). Drivers by points: if/else 24, loops 12, boolean chains 1, match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GithubRenderer · ×1
  • GithubRenderer::render (cognitive 37) crates/ruff_db/src/diagnostic/render/github.rs:18 — GithubRenderer::render has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21, loops 8, match/switch 5, boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · blank_before_after_class · ×1
  • blank_before_after_class::blank_before_after_class (cognitive 37) crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_class.rs:168 — blank_before_after_class::blank_before_after_class has cognitive complexity 37 (threshold 15). Drivers by points: if/else 31, loops 4, boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unused_import · ×1
  • unused_import::unused_import (cognitive 37) crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs:324 — unused_import::unused_import has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26, boolean chains 6, loops 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Terminal · ×1
  • Terminal::from_body (cognitive 37) crates/ruff_python_semantic/src/analyze/terminal.rs:49 — Terminal::from_body has cognitive complexity 37 (threshold 15). Drivers by points: if/else 33, match/switch 3, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConciseRenderer · ×1
  • ConciseRenderer::render (cognitive 36) crates/ruff_db/src/diagnostic/render/concise.rs:18 — ConciseRenderer::render has cognitive complexity 36 (threshold 15). Drivers by points: if/else 30, match/switch 3, boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoopMutationsVisitor · ×1
  • LoopMutationsVisitor::visit_stmt (cognitive 36) crates/ruff_linter/src/rules/flake8_bugbear/rules/loop_iterator_mutation.rs:339 — LoopMutationsVisitor::visit_stmt has cognitive complexity 36 (threshold 15). Drivers by points: if/else 29, loops 4, boolean chains 2, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinePreprocessor · ×1
  • LinePreprocessor::next (cognitive 36) crates/ruff_linter/src/rules/pycodestyle/rules/blank_lines.rs:429 — LinePreprocessor::next has cognitive complexity 36 (threshold 15). Drivers by points: if/else 29, boolean chains 3, match/switch 3, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bad_generator_return_type · ×1
  • bad_generator_return_type::bad_generator_return_type (cognitive 36) crates/ruff_linter/src/rules/flake8_pyi/rules/bad_generator_return_type.rs:92 — bad_generator_return_type::bad_generator_return_type has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17, match/switch 15, boolean chains 2, loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BodyVisitor · ×1
  • BodyVisitor::visit_stmt (cognitive 35) crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs:979 — BodyVisitor::visit_stmt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24, loops 10, match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IterationError · ×1
  • IterationError::report_diagnostic (cognitive 35) crates/ty_python_semantic/src/types/iteration.rs:584 — IterationError::report_diagnostic has cognitive complexity 35 (threshold 15). Drivers by points: if/else 23, match/switch 9, loops 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UselessSuppressionComments · ×1
  • UselessSuppressionComments::check_suppression_comment (cognitive 34) crates/ruff_linter/src/rules/ruff/rules/invalid_formatter_suppression_comment.rs:128 — UselessSuppressionComments::check_suppression_comment has cognitive complexity 34 (threshold 15). Drivers by points: if/else 30, boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tokens · ×1
  • tokens::check_tokens (cognitive 34) crates/ruff_linter/src/checkers/tokens.rs:23 — tokens::check_tokens has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24, match/switch 6, loops 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_dunder_call · ×1
  • unnecessary_dunder_call::unnecessary_dunder_call (cognitive 34) crates/ruff_linter/src/rules/pylint/rules/unnecessary_dunder_call.rs:97 — unnecessary_dunder_call::unnecessary_dunder_call has cognitive complexity 34 (threshold 15). Drivers by points: if/else 30, boolean chains 2, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ambiguous_unicode_character · ×1
  • ambiguous_unicode_character::ambiguous_unicode_character (cognitive 34) crates/ruff_linter/src/rules/ruff/rules/ambiguous_unicode_character.rs:225 — ambiguous_unicode_character::ambiguous_unicode_character has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23, loops 9, boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unused_variable · ×1
  • unused_variable::remove_unused_variable (cognitive 34) crates/ruff_linter/src/rules/pyflakes/rules/unused_variable.rs:157 — unused_variable::remove_unused_variable has cognitive complexity 34 (threshold 15). Drivers by points: if/else 30, boolean chains 2, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unresolved_references · ×1
  • unresolved_references::unresolved_references (cognitive 34) crates/ruff_linter/src/checkers/ast/analyze/unresolved_references.rs:9 — unresolved_references::unresolved_references has cognitive complexity 34 (threshold 15). Drivers by points: if/else 33, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImportStatement · ×1
  • ImportStatement::detect (cognitive 34) crates/ty_ide/src/completion.rs:2502 — ImportStatement::detect has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20, match/switch 7, boolean chains 5, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplaySpecialization · ×1
  • DisplaySpecialization::fmt_normal (cognitive 34) crates/ty_python_semantic/src/types/display.rs:2007 — DisplaySpecialization::fmt_normal has cognitive complexity 34 (threshold 15). Drivers by points: if/else 26, loops 5, match/switch 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayUnionType · ×1
  • DisplayUnionType::fmt_detailed (cognitive 34) crates/ty_python_semantic/src/types/display.rs:2693 — DisplayUnionType::fmt_detailed has cognitive complexity 34 (threshold 15). Drivers by points: if/else 26, loops 6, boolean chains 1, match/switch 1 (nesting depth added 15). Of this number, 32 points are the body's own statements and 2 belong to 2 function items declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paramspec_validation · ×1
  • paramspec_validation::validate_paramspec_components (cognitive 34) crates/ty_python_semantic/src/types/infer/builder/paramspec_validation.rs:12 — paramspec_validation::validate_paramspec_components has cognitive complexity 34 (threshold 15). Drivers by points: if/else 31, boolean chains 2, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolve_definition · ×1
  • resolve_definition::map_stub_definition (cognitive 34) crates/ty_python_semantic/src/types/ide_support.rs:2388 — resolve_definition::map_stub_definition has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23, loops 9, boolean chains 1, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repeated_equality_comparison · ×1
  • repeated_equality_comparison::repeated_equality_comparison (cognitive 33) crates/ruff_linter/src/rules/pylint/rules/repeated_equality_comparison.rs:88 — repeated_equality_comparison::repeated_equality_comparison has cognitive complexity 33 (threshold 15). Drivers by points: if/else 24, loops 6, match/switch 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · single_string_slots · ×1
  • single_string_slots::single_string_slots (cognitive 33) crates/ruff_linter/src/rules/pylint/rules/single_string_slots.rs:62 — single_string_slots::single_string_slots has cognitive complexity 33 (threshold 15). Drivers by points: if/else 27, loops 4, match/switch 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bindings · ×1
  • bindings::bindings (cognitive 33) crates/ruff_linter/src/checkers/ast/analyze/bindings.rs:12 — bindings::bindings has cognitive complexity 33 (threshold 15). Drivers by points: if/else 30, boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · native_literals · ×1
  • native_literals::native_literals (cognitive 33) crates/ruff_linter/src/rules/pyupgrade/rules/native_literals.rs:185 — native_literals::native_literals has cognitive complexity 33 (threshold 15). Drivers by points: if/else 26, match/switch 4, boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · typing_only_runtime_import · ×1
  • typing_only_runtime_import::typing_only_runtime_import (cognitive 33) crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs:273 — typing_only_runtime_import::typing_only_runtime_import has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20, loops 7, match/switch 4, boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · never_union · ×1
  • never_union::never_union (cognitive 33) crates/ruff_linter/src/rules/ruff/rules/never_union.rs:75 — never_union::never_union has cognitive complexity 33 (threshold 15). Drivers by points: if/else 30, loops 2, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config · ×1
  • config::derive_impl (cognitive 33) crates/ruff_macros/src/config.rs:12 — config::derive_impl has cognitive complexity 33 (threshold 15). Drivers by points: if/else 25, loops 7, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Collector · ×1
  • Collector::visit_stmt (cognitive 32) crates/ruff_graph/src/collector.rs:43 — Collector::visit_stmt has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20, loops 10, boolean chains 1, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unused_arguments · ×1
  • unused_arguments::unused_arguments (cognitive 32) crates/ruff_linter/src/rules/flake8_unused_arguments/rules/unused_arguments.rs:430 — unused_arguments::unused_arguments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21, boolean chains 8, match/switch 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · super_call_with_parameters · ×1
  • super_call_with_parameters::super_call_with_parameters (cognitive 32) crates/ruff_linter/src/rules/pyupgrade/rules/super_call_with_parameters.rs:72 — super_call_with_parameters::super_call_with_parameters has cognitive complexity 32 (threshold 15). Drivers by points: if/else 25, match/switch 3, boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compound_statements · ×1
  • compound_statements::compound_statements (cognitive 32) crates/ruff_linter/src/rules/pycodestyle/rules/compound_statements.rs:104 — compound_statements::compound_statements has cognitive complexity 32 (threshold 15). Drivers by points: if/else 23, match/switch 6, boolean chains 2, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unspecified_encoding · ×1
  • unspecified_encoding::is_violation (cognitive 32) crates/ruff_linter/src/rules/pylint/rules/unspecified_encoding.rs:210 — unspecified_encoding::is_violation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 24, match/switch 8 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequentMap · ×1
  • SequentMap::add_nested_typevar_sequents (cognitive 32) crates/ty_python_semantic/src/types/constraints.rs:5720 — SequentMap::add_nested_typevar_sequents has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18, boolean chains 10, match/switch 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · whitespace_around_keywords · ×1
  • whitespace_around_keywords::whitespace_around_keywords (cognitive 31) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs:130 — whitespace_around_keywords::whitespace_around_keywords has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, match/switch 7, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · space_around_operator · ×1
  • space_around_operator::space_around_operator (cognitive 31) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs:205 — space_around_operator::space_around_operator has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, match/switch 7, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compare · ×1
  • compare::compare (cognitive 31) crates/ruff_linter/src/rules/flake8_2020/rules/compare.rs:240 — compare::compare has cognitive complexity 31 (threshold 15). Drivers by points: if/else 28, boolean chains 2, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommentRanges · ×1
  • CommentRanges::block_comments (cognitive 31) crates/ruff_python_trivia/src/comment_ranges.rs:157 — CommentRanges::block_comments has cognitive complexity 31 (threshold 15). Drivers by points: if/else 25, boolean chains 5, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RangedValue · ×1
  • RangedValue::to_override (cognitive 31) crates/ty_project/src/metadata/options.rs:1897 — RangedValue::to_override has cognitive complexity 31 (threshold 15). Drivers by points: if/else 26, boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IsortOptions · ×1
  • IsortOptions::try_into_settings (cognitive 31) crates/ruff_workspace/src/options.rs:2927 — IsortOptions::try_into_settings has cognitive complexity 31 (threshold 15). Drivers by points: if/else 22, boolean chains 4, loops 4, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AddBinding · ×1
  • AddBinding::insert (cognitive 31) crates/ty_python_semantic/src/types/infer/builder.rs:11979 — AddBinding::insert has cognitive complexity 31 (threshold 15). Drivers by points: if/else 29, boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClassInfoConstraintFunction · ×1
  • ClassInfoConstraintFunction::generate_constraint (cognitive 31) crates/ty_python_semantic/src/types/narrow.rs:431 — ClassInfoConstraintFunction::generate_constraint has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16, match/switch 12, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · builder · ×1
  • builder::normalize_enum_complement_unions (cognitive 31) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:220 — builder::normalize_enum_complement_unions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18, loops 12, boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_paren_on_raise_exception · ×1
  • unnecessary_paren_on_raise_exception::unnecessary_paren_on_raise_exception (cognitive 30) crates/ruff_linter/src/rules/flake8_raise/rules/unnecessary_paren_on_raise_exception.rs:61 — unnecessary_paren_on_raise_exception::unnecessary_paren_on_raise_exception has cognitive complexity 30 (threshold 15). Drivers by points: if/else 23, match/switch 6, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · blank_before_after_function · ×1
  • blank_before_after_function::blank_before_after_function (cognitive 30) crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_function.rs:119 — blank_before_after_function::blank_before_after_function has cognitive complexity 30 (threshold 15). Drivers by points: if/else 24, loops 4, boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · multi_line_summary_start · ×1
  • multi_line_summary_start::multi_line_summary_start (cognitive 30) crates/ruff_linter/src/rules/pydocstyle/rules/multi_line_summary_start.rs:143 — multi_line_summary_start::multi_line_summary_start has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27, loops 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mutable_class_default · ×1
  • mutable_class_default::mutable_class_default (cognitive 30) crates/ruff_linter/src/rules/ruff/rules/mutable_class_default.rs:103 — mutable_class_default::mutable_class_default has cognitive complexity 30 (threshold 15). Drivers by points: if/else 24, boolean chains 3, match/switch 2, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · verbose_decimal_constructor · ×1
  • verbose_decimal_constructor::verbose_decimal_constructor (cognitive 30) crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs:74 — verbose_decimal_constructor::verbose_decimal_constructor has cognitive complexity 30 (threshold 15). Drivers by points: if/else 26, match/switch 3, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · suppression · ×1
  • suppression::suppressions (cognitive 30) crates/ty_python_semantic/src/suppression.rs:78 — suppression::suppressions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13, match/switch 11, loops 4, boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · error_instead_of_exception · ×1
  • error_instead_of_exception::error_instead_of_exception (cognitive 29) crates/ruff_linter/src/rules/tryceratops/rules/error_instead_of_exception.rs:76 — error_instead_of_exception::error_instead_of_exception has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, match/switch 5, loops 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StringNormalizer · ×1
  • StringNormalizer::preferred_quote_style (cognitive 29) crates/ruff_python_formatter/src/string/normalize.rs:44 — StringNormalizer::preferred_quote_style has cognitive complexity 29 (threshold 15). Drivers by points: if/else 24, boolean chains 4, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Definitions · ×1
  • Definitions::resolve (cognitive 29) crates/ruff_python_semantic/src/definition.rs:217 — Definitions::resolve has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20, match/switch 5, boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoopBindingsVisitor · ×1
  • LoopBindingsVisitor::visit_stmt (cognitive 29) crates/ty_python_core/src/builder/loop_bindings_visitor.rs:66 — LoopBindingsVisitor::visit_stmt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14, loops 14, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExportFinder · ×1
  • ExportFinder::visit_stmt (cognitive 29) crates/ty_python_core/src/re_exports.rs:175 — ExportFinder::visit_stmt has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16, loops 11, boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InteriorNode · ×1
  • InteriorNode::simplify (cognitive 29) crates/ty_python_semantic/src/types/constraints.rs:4560 — InteriorNode::simplify has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, match/switch 5, boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · string_annotation · ×1
  • string_annotation::parse_string_annotation (cognitive 29) crates/ty_python_semantic/src/types/string_annotation.rs:50 — string_annotation::parse_string_annotation has cognitive complexity 29 (threshold 15). Drivers by points: if/else 23, boolean chains 3, match/switch 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · string_in_exception · ×1
  • string_in_exception::string_in_exception (cognitive 28) crates/ruff_linter/src/rules/flake8_errmsg/rules/string_in_exception.rs:187 — string_in_exception::string_in_exception has cognitive complexity 28 (threshold 15). Drivers by points: if/else 23, boolean chains 3, match/switch 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · codemods · ×1
  • codemods::remove_imports (cognitive 28) crates/ruff_linter/src/fix/codemods.rs:42 — codemods::remove_imports has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21, match/switch 4, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · static_join_to_fstring · ×1
  • static_join_to_fstring::build_fstring (cognitive 28) crates/ruff_linter/src/rules/flynt/rules/static_join_to_fstring.rs:73 — static_join_to_fstring::build_fstring has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22, boolean chains 4, loops 1, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatExprSlice · ×1
  • FormatExprSlice::fmt_fields (cognitive 28) crates/ruff_python_formatter/src/expression/expr_slice.rs:17 — FormatExprSlice::fmt_fields has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22, boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResolvedClientCapabilities · ×1
  • ResolvedClientCapabilities::new (cognitive 28) crates/ty_server/src/capabilities.rs:204 — ResolvedClientCapabilities::new has cognitive complexity 28 (threshold 15). Drivers by points: if/else 28 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Debouncer · ×1
  • Debouncer::add_event (cognitive 28) crates/ty_project/src/watch/watcher.rs:230 — Debouncer::add_event has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 14, if/else 13, boolean chains 1 (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ContextManagerError · ×1
  • ContextManagerError::report_diagnostic (cognitive 28) crates/ty_python_semantic/src/types/context_manager.rs:138 — ContextManagerError::report_diagnostic has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 9, if/else 8, loops 8, boolean chains 3 (nesting depth added 8). Of this number, 27 points are the body's own statements and 1 belong to one function item declared inside it. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SubscriptErrorKind · ×1
  • SubscriptErrorKind::report_diagnostic (cognitive 28) crates/ty_python_semantic/src/types/subscript.rs:205 — SubscriptErrorKind::report_diagnostic has cognitive complexity 28 (threshold 15). Drivers by points: if/else 25, match/switch 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · containment · ×1
  • containment::containment_behavior (cognitive 28) crates/ty_python_semantic/src/types/narrow/containment.rs:17 — containment::containment_behavior has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16, match/switch 8, loops 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · format_stdin · ×1
  • format_stdin::format_stdin (cognitive 27) crates/ruff/src/commands/format_stdin.rs:21 — format_stdin::format_stdin has cognitive complexity 27 (threshold 15). Drivers by points: if/else 24, match/switch 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ends_with_punctuation · ×1
  • ends_with_punctuation::ends_with_punctuation (cognitive 27) crates/ruff_linter/src/rules/pydocstyle/rules/ends_with_punctuation.rs:66 — ends_with_punctuation::ends_with_punctuation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23, loops 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · function_is_too_complex · ×1
  • function_is_too_complex::get_complexity_number (cognitive 27) crates/ruff_linter/src/rules/mccabe/rules/function_is_too_complex.rs:78 — function_is_too_complex::get_complexity_number has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14, loops 10, match/switch 2, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · enumerate_for_loop · ×1
  • enumerate_for_loop::enumerate_for_loop (cognitive 27) crates/ruff_linter/src/rules/flake8_simplify/rules/enumerate_for_loop.rs:60 — enumerate_for_loop::enumerate_for_loop has cognitive complexity 27 (threshold 15). Drivers by points: if/else 22, boolean chains 4, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · annotate · ×1
  • annotate::annotate_imports (cognitive 27) crates/ruff_linter/src/rules/isort/annotate.rs:13 — annotate::annotate_imports has cognitive complexity 27 (threshold 15). Drivers by points: loops 18, if/else 7, boolean chains 1, match/switch 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ends_with_period · ×1
  • ends_with_period::ends_with_period (cognitive 27) crates/ruff_linter/src/rules/pydocstyle/rules/ends_with_period.rs:72 — ends_with_period::ends_with_period has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23, loops 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · private_member_access · ×1
  • private_member_access::private_member_access (cognitive 27) crates/ruff_linter/src/rules/flake8_self/rules/private_member_access.rs:73 — private_member_access::private_member_access has cognitive complexity 27 (threshold 15). Drivers by points: if/else 26, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MaybeParenthesizeExpression · ×1
  • MaybeParenthesizeExpression::fmt (cognitive 27) crates/ruff_python_formatter/src/expression/mod.rs:346 — MaybeParenthesizeExpression::fmt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17, match/switch 8, boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlayHint · ×1
  • InlayHint::variable_type (cognitive 27) crates/ty_ide/src/inlay_hints.rs:28 — InlayHint::variable_type has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23, match/switch 2, boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VariableLengthTuple · ×1
  • VariableLengthTuple::mixed_forward_slice_plan (cognitive 27) crates/ty_python_semantic/src/types/tuple.rs:1682 — VariableLengthTuple::mixed_forward_slice_plan has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20, boolean chains 5, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Tuple · ×1
  • Tuple::try_for_each_element_pair (cognitive 27) crates/ty_python_semantic/src/types/tuple.rs:2433 — Tuple::try_for_each_element_pair has cognitive complexity 27 (threshold 15). Drivers by points: loops 26, match/switch 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · unnecessary_literal_union · ×1
  • unnecessary_literal_union::unnecessary_literal_union (cognitive 26) crates/ruff_linter/src/rules/flake8_pyi/rules/unnecessary_literal_union.rs:72 — unnecessary_literal_union::unnecessary_literal_union has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, loops 4, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Notebook · ×1
  • Notebook::from_raw_notebook (cognitive 26) crates/ruff_notebook/src/notebook.rs:124 — Notebook::from_raw_notebook has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13, loops 8, match/switch 4, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlatBinaryExpressionSlice · ×1
  • FlatBinaryExpressionSlice::fmt (cognitive 26) crates/ruff_python_formatter/src/expression/binary_like.rs:641 — FlatBinaryExpressionSlice::fmt has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, match/switch 4, boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ErrorAssertionParser · ×1
  • ErrorAssertionParser::parse (cognitive 25) crates/mdtest/src/assertion.rs:408 — ErrorAssertionParser::parse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 22, match/switch 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buffer · ×1
  • buffer::clean_interned (cognitive 25) crates/ruff_formatter/src/buffer.rs:377 — buffer::clean_interned has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, match/switch 8, loops 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReturnVisitor · ×1
  • ReturnVisitor::visit_stmt (cognitive 25) crates/ruff_linter/src/rules/flake8_return/visitor.rs:63 — ReturnVisitor::visit_stmt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, loops 4, match/switch 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TypingTarget · ×1
  • TypingTarget::try_from_expr (cognitive 25) crates/ruff_linter/src/rules/ruff/typing.rs:73 — TypingTarget::try_from_expr has cognitive complexity 25 (threshold 15). Drivers by points: if/else 23, boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · verbose_raise · ×1
  • verbose_raise::verbose_raise (cognitive 25) crates/ruff_linter/src/rules/tryceratops/rules/verbose_raise.rs:54 — verbose_raise::verbose_raise has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21, loops 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_type_union · ×1
  • unnecessary_type_union::unnecessary_type_union (cognitive 25) crates/ruff_linter/src/rules/flake8_pyi/rules/unnecessary_type_union.rs:62 — unnecessary_type_union::unnecessary_type_union has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, match/switch 4, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · django_extra · ×1
  • django_extra::is_call_insecure (cognitive 25) crates/ruff_linter/src/rules/flake8_bandit/rules/django_extra.rs:62 — django_extra::is_call_insecure has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12, match/switch 11, boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_future_import · ×1
  • unnecessary_future_import::unnecessary_future_import (cognitive 25) crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_future_import.rs:121 — unnecessary_future_import::unnecessary_future_import has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, loops 4, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatParameters · ×1
  • FormatParameters::fmt_fields (cognitive 25) crates/ruff_python_formatter/src/other/parameters.rs:49 — FormatParameters::fmt_fields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, loops 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ty_completion_eval · ×1
  • ty_completion_eval::main (cognitive 25) crates/ty_completion_eval/src/main.rs:126 — ty_completion_eval::main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, loops 7, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnownClass · ×1
  • KnownClass::check_call (cognitive 25) crates/ty_python_semantic/src/types/class/known.rs:1781 — KnownClass::check_call has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19, match/switch 6 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Constraint · ×1
  • Constraint::new_node_with_bounds (cognitive 25) crates/ty_python_semantic/src/types/constraints.rs:1890 — Constraint::new_node_with_bounds has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13, loops 6, boolean chains 3, match/switch 3 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · dynamic_class · ×1
  • dynamic_class::report_mro_error_kind (cognitive 25) crates/ty_python_semantic/src/types/infer/builder/dynamic_class.rs:281 — dynamic_class::report_mro_error_kind has cognitive complexity 25 (threshold 15). Drivers by points: if/else 22, loops 2, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · match_pattern · ×1
  • match_pattern::definite_match_pattern_type_for_subject (cognitive 25) crates/ty_python_semantic/src/types/match_pattern.rs:585 — match_pattern::definite_match_pattern_type_for_subject has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21, match/switch 3, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · implicit · ×1
  • implicit::implicit (cognitive 24) crates/ruff_linter/src/rules/flake8_implicit_str_concat/rules/implicit.rs:106 — implicit::implicit has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 11, if/else 10, boolean chains 2, loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · deprecated_c_element_tree · ×1
  • deprecated_c_element_tree::deprecated_c_element_tree (cognitive 24) crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_c_element_tree.rs:56 — deprecated_c_element_tree::deprecated_c_element_tree has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, loops 6, boolean chains 2, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reimplemented_builtin · ×1
  • reimplemented_builtin::convert_for_loop_to_any_all (cognitive 24) crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs:76 — reimplemented_builtin::convert_for_loop_to_any_all has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18, match/switch 5, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rule_namespace · ×1
  • rule_namespace::derive_impl (cognitive 24) crates/ruff_macros/src/rule_namespace.rs:8 — rule_namespace::derive_impl has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12, match/switch 7, loops 4, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generics · ×1
  • generics::bind_typevar (cognitive 24) crates/ty_python_semantic/src/types/generics.rs:86 — generics::bind_typevar has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, match/switch 4, loops 3, boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InlineFileAssertions · ×1
  • InlineFileAssertions::from_comment_ranges (cognitive 23) crates/mdtest/src/assertion.rs:92 — InlineFileAssertions::from_comment_ranges has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, loops 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compare_to_empty_string · ×1
  • compare_to_empty_string::compare_to_empty_string (cognitive 23) crates/ruff_linter/src/rules/pylint/rules/compare_to_empty_string.rs:62 — compare_to_empty_string::compare_to_empty_string has cognitive complexity 23 (threshold 15). Drivers by points: if/else 22, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · blank_after_summary · ×1
  • blank_after_summary::blank_after_summary (cognitive 23) crates/ruff_linter/src/rules/pydocstyle/rules/blank_after_summary.rs:74 — blank_after_summary::blank_after_summary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, loops 7, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · call_datetime_strptime_without_zone · ×1
  • call_datetime_strptime_without_zone::call_datetime_strptime_without_zone (cognitive 23) crates/ruff_linter/src/rules/flake8_datetimez/rules/call_datetime_strptime_without_zone.rs:88 — call_datetime_strptime_without_zone::call_datetime_strptime_without_zone has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, match/switch 6, loops 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalReferencesFinder · ×1
  • LocalReferencesFinder::enter_node (cognitive 23) crates/ty_ide/src/references.rs:380 — LocalReferencesFinder::enter_node has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, loops 4, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoundSuperError · ×1
  • BoundSuperError::report_diagnostic (cognitive 23) crates/ty_python_semantic/src/types/bound_super.rs:93 — BoundSuperError::report_diagnostic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, match/switch 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Binding · ×1
  • Binding::partial_application (cognitive 23) crates/ty_python_semantic/src/types/call/bind.rs:7078 — Binding::partial_application has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12, loops 7, boolean chains 2, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnionElement · ×1
  • UnionElement::try_reduce (cognitive 23) crates/ty_python_semantic/src/types/set_theoretic/builder.rs:378 — UnionElement::try_reduce has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, match/switch 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodeActionRequestHandler · ×1
  • CodeActionRequestHandler::run_with_snapshot (cognitive 23) crates/ty_server/src/server/api/requests/code_action.rs:33 — CodeActionRequestHandler::run_with_snapshot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9, match/switch 8, loops 4, boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JunitRenderer · ×1
  • JunitRenderer::render (cognitive 22) crates/ruff_db/src/diagnostic/render/junit.rs:28 — JunitRenderer::render has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 5, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate_rules_table · ×1
  • generate_rules_table::generate (cognitive 22) crates/ruff_dev/src/generate_rules_table.rs:106 — generate_rules_table::generate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, match/switch 7, loops 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileNoqaDirectives · ×1
  • FileNoqaDirectives::extract (cognitive 22) crates/ruff_linter/src/noqa.rs:259 — FileNoqaDirectives::extract has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, loops 5, match/switch 5, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoggerCandidateVisitor · ×1
  • LoggerCandidateVisitor::visit_expr (cognitive 22) crates/ruff_linter/src/rules/tryceratops/helpers.rs:26 — LoggerCandidateVisitor::visit_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, match/switch 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · raises · ×1
  • raises::raises_call (cognitive 22) crates/ruff_linter/src/rules/flake8_pytest_style/rules/raises.rs:191 — raises::raises_call has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_string_quotes · ×1
  • check_string_quotes::strings (cognitive 22) crates/ruff_linter/src/rules/flake8_quotes/rules/check_string_quotes.rs:307 — check_string_quotes::strings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · import_private_name · ×1
  • import_private_name::import_private_name (cognitive 22) crates/ruff_linter/src/rules/pylint/rules/import_private_name.rs:74 — import_private_name::import_private_name has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 4, match/switch 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assertion · ×1
  • assertion::fix_composite_condition (cognitive 22) crates/ruff_linter/src/rules/flake8_pytest_style/rules/assertion.rs:724 — assertion::fix_composite_condition has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatExprAttribute · ×1
  • FormatExprAttribute::fmt_fields (cognitive 22) crates/ruff_python_formatter/src/expression/expr_attribute.rs:28 — FormatExprAttribute::fmt_fields has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, boolean chains 5, match/switch 3 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · StringParser · ×1
  • StringParser::parse_interpolated_string_middle (cognitive 22) crates/ruff_python_parser/src/string.rs:280 — StringParser::parse_interpolated_string_middle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, match/switch 7, boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeActions · ×1
  • CodeActions::run_with_snapshot (cognitive 22) crates/ruff_server/src/server/api/requests/code_action.rs:27 — CodeActions::run_with_snapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SectionItem · ×1
  • SectionItem::render (cognitive 22) crates/ty_ide/src/docstring/markdown/structured.rs:249 — SectionItem::render has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, match/switch 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · structured · ×1
  • structured::render_sections_into (cognitive 22) crates/ty_ide/src/docstring/markdown/structured.rs:27 — structured::render_sections_into has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, match/switch 2, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayKnownInstanceRepr · ×1
  • DisplayKnownInstanceRepr::fmt_detailed (cognitive 22) crates/ty_python_semantic/src/types/display.rs:3253 — DisplayKnownInstanceRepr::fmt_detailed has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, loops 2, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ty_site_packages · ×1
  • ty_site_packages::site_packages_directories_from_sys_prefix (cognitive 22) crates/ty_site_packages/src/lib.rs:1612 — ty_site_packages::site_packages_directories_from_sys_prefix has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, loops 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryWalker · ×1
  • MemoryWalker::walk (cognitive 21) crates/ruff_db/src/system/memory_fs.rs:618 — MemoryWalker::walk has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 10, if/else 8, loops 3 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Document · ×1
  • Document::propagate_expand::propagate_expands (cognitive 21) crates/ruff_formatter/src/format_element/document.rs:57 — Document::propagate_expand::propagate_expands has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, match/switch 8, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_list_cast · ×1
  • unnecessary_list_cast::match_mutation (cognitive 21) crates/ruff_linter/src/rules/perflint/rules/unnecessary_list_cast.rs:188 — unnecessary_list_cast::match_mutation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_spread · ×1
  • unnecessary_spread::unnecessary_spread_fix (cognitive 21) crates/ruff_linter/src/rules/flake8_pie/rules/unnecessary_spread.rs:67 — unnecessary_spread::unnecessary_spread_fix has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, match/switch 4, boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · collapsible_if · ×1
  • collapsible_if::nested_if_statements (cognitive 21) crates/ruff_linter/src/rules/flake8_simplify/rules/collapsible_if.rs:83 — collapsible_if::nested_if_statements has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, match/switch 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · missing_whitespace · ×1
  • missing_whitespace::missing_whitespace (cognitive 21) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs:44 — missing_whitespace::missing_whitespace has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, match/switch 7, boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hardcoded_bind_all_interfaces · ×1
  • hardcoded_bind_all_interfaces::hardcoded_bind_all_interfaces (cognitive 21) crates/ruff_linter/src/rules/flake8_bandit/rules/hardcoded_bind_all_interfaces.rs:41 — hardcoded_bind_all_interfaces::hardcoded_bind_all_interfaces has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, loops 6, match/switch 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · invalid_literal_comparisons · ×1
  • invalid_literal_comparisons::invalid_literal_comparison (cognitive 21) crates/ruff_linter/src/rules/pyflakes/rules/invalid_literal_comparisons.rs:78 — invalid_literal_comparisons::invalid_literal_comparison has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 4, boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocstringLinePrinter · ×1
  • DocstringLinePrinter::run_action_queue (cognitive 21) crates/ruff_python_formatter/src/string/docstring.rs:312 — DocstringLinePrinter::run_action_queue has cognitive complexity 21 (threshold 15). Drivers by points: loops 16, match/switch 5 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Options · ×1
  • Options::to_search_paths (cognitive 21) crates/ty_project/src/metadata/options.rs:299 — Options::to_search_paths has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, boolean chains 4, match/switch 3, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Unpacker · ×1
  • Unpacker::unpack_inner (cognitive 21) crates/ty_python_semantic/src/types/unpacker.rs:184 — Unpacker::unpack_inner has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 10, if/else 7, loops 4 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · pydantic · ×1
  • pydantic::lax_input_type_impl (cognitive 21) crates/ty_python_semantic/src/types/dedicated/pydantic.rs:944 — pydantic::lax_input_type_impl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, match/switch 2, boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · semantic_tokens · ×1
  • semantic_tokens::generate_semantic_tokens (cognitive 21) crates/ty_server/src/server/api/semantic_tokens.rs:12 — semantic_tokens::generate_semantic_tokens has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, loops 7 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExplicitConfigOverrides · ×1
  • ExplicitConfigOverrides::transform (cognitive 20) crates/ruff/src/args.rs:1413 — ExplicitConfigOverrides::transform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · check · ×1
  • check::check (cognitive 20) crates/ruff/src/commands/check.rs:34 — check::check has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, boolean chains 2, loops 2, match/switch 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · print_empty_string · ×1
  • print_empty_string::print_empty_string (cognitive 20) crates/ruff_linter/src/rules/refurb/rules/print_empty_string.rs:79 — print_empty_string::print_empty_string has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unused_loop_control_variable · ×1
  • unused_loop_control_variable::unused_loop_control_variable (cognitive 20) crates/ruff_linter/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs:84 — unused_loop_control_variable::unused_loop_control_variable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sorted_min_max · ×1
  • sorted_min_max::sorted_min_max (cognitive 20) crates/ruff_linter/src/rules/refurb/rules/sorted_min_max.rs:88 — sorted_min_max::sorted_min_max has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, match/switch 8, boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · class_as_data_structure · ×1
  • class_as_data_structure::class_as_data_structure (cognitive 20) crates/ruff_linter/src/rules/flake8_bugbear/rules/class_as_data_structure.rs:48 — class_as_data_structure::class_as_data_structure has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, boolean chains 5, match/switch 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · f_strings · ×1
  • f_strings::f_strings (cognitive 20) crates/ruff_linter/src/rules/pyupgrade/rules/f_strings.rs:405 — f_strings::f_strings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, match/switch 7, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · indentation · ×1
  • indentation::indentation (cognitive 20) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/indentation.rs:269 — indentation::indentation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stylist · ×1
  • stylist::detect_indentation (cognitive 20) crates/ruff_python_codegen/src/stylist.rs:71 — stylist::detect_indentation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Indentation · ×1
  • Indentation::trim_start (cognitive 20) crates/ruff_python_formatter/src/string/docstring.rs:1749 — Indentation::trim_start has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, match/switch 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RuffSettingsIndex · ×1
  • RuffSettingsIndex::new (cognitive 20) crates/ruff_server/src/session/index/ruff_settings.rs:166 — RuffSettingsIndex::new has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, match/switch 7, boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TyFormat · ×1
  • TyFormat::format_event (cognitive 20) crates/ty/src/logging.rs:224 — TyFormat::format_event has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, match/switch 3, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MroLookup · ×1
  • MroLookup::instance_member (cognitive 20) crates/ty_python_semantic/src/types/class.rs:2672 — MroLookup::instance_member has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, match/switch 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayParameters · ×1
  • DisplayParameters::fmt_detailed::display_parameters (cognitive 20) crates/ty_python_semantic/src/types/display.rs:2379 — DisplayParameters::fmt_detailed::display_parameters has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwaitError · ×1
  • AwaitError::report_diagnostic (cognitive 20) crates/ty_python_semantic/src/types.rs:8525 — AwaitError::report_diagnostic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 3, boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatCommandError · ×1
  • FormatCommandError::fmt (cognitive 19) crates/ruff/src/commands/format.rs:925 — FormatCommandError::fmt has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assert_on_string_literal · ×1
  • assert_on_string_literal::assert_on_string_literal (cognitive 19) crates/ruff_linter/src/rules/pylint/rules/assert_on_string_literal.rs:50 — assert_on_string_literal::assert_on_string_literal has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, match/switch 9 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · needless_bool · ×1
  • needless_bool::needless_bool (cognitive 19) crates/ruff_linter/src/rules/flake8_simplify/rules/needless_bool.rs:93 — needless_bool::needless_bool has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, match/switch 5 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · backslashes · ×1
  • backslashes::backslashes (cognitive 19) crates/ruff_linter/src/rules/pydocstyle/rules/backslashes.rs:66 — backslashes::backslashes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ast_with · ×1
  • ast_with::multiple_with_statements (cognitive 19) crates/ruff_linter/src/rules/flake8_simplify/rules/ast_with.rs:127 — ast_with::multiple_with_statements has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, match/switch 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · repeated_keyword_argument · ×1
  • repeated_keyword_argument::repeated_keyword_argument (cognitive 19) crates/ruff_linter/src/rules/pylint/rules/repeated_keyword_argument.rs:40 — repeated_keyword_argument::repeated_keyword_argument has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mutable_argument_default · ×1
  • mutable_argument_default::move_initialization (cognitive 19) crates/ruff_linter/src/rules/flake8_bugbear/rules/mutable_argument_default.rs:151 — mutable_argument_default::move_initialization has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · multiple_starts_ends_with · ×1
  • multiple_starts_ends_with::multiple_starts_ends_with (cognitive 19) crates/ruff_linter/src/rules/flake8_pie/rules/multiple_starts_ends_with.rs:71 — multiple_starts_ends_with::multiple_starts_ends_with has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · raise_vanilla_args · ×1
  • raise_vanilla_args::contains_message (cognitive 19) crates/ruff_linter/src/rules/tryceratops/rules/raise_vanilla_args.rs:88 — raise_vanilla_args::contains_message has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, loops 6, match/switch 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · non_self_return_type · ×1
  • non_self_return_type::non_self_return_type (cognitive 19) crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs:148 — non_self_return_type::non_self_return_type has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 6, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · expr_number_literal · ×1
  • expr_number_literal::normalize_floating_number (cognitive 19) crates/ruff_python_formatter/src/expression/expr_number_literal.rs:110 — expr_number_literal::normalize_floating_number has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, match/switch 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ty · ×1
  • ty::run_check (cognitive 19) crates/ty/src/lib.rs:90 — ty::run_check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Group · ×1
  • Group::merge (cognitive 19) crates/ty_ide/src/all_symbols.rs:388 — Group::merge has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, loops 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextCursor · ×1
  • ContextCursor::incomplete_keywords (cognitive 19) crates/ty_ide/src/completion.rs:1177 — ContextCursor::incomplete_keywords has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, boolean chains 7, match/switch 4 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Lister · ×1
  • Lister::add_path (cognitive 19) crates/ty_module_resolver/src/list.rs:150 — Lister::add_path has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NarrowingProjector · ×1
  • NarrowingProjector::project (cognitive 19) crates/ty_python_semantic/src/reachability.rs:1088 — NarrowingProjector::project has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, match/switch 5, boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayCallableType · ×1
  • DisplayCallableType::fmt_detailed (cognitive 19) crates/ty_python_semantic/src/types/display.rs:2158 — DisplayCallableType::fmt_detailed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, loops 2, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayParameter · ×1
  • DisplayParameter::fmt_detailed (cognitive 19) crates/ty_python_semantic/src/types/display.rs:2541 — DisplayParameter::fmt_detailed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, match/switch 7, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigArgumentParser · ×1
  • ConfigArgumentParser::parse_ref (cognitive 18) crates/ruff/src/args.rs:990 — ConfigArgumentParser::parse_ref has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, match/switch 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · format_dev · ×1
  • format_dev::format_dev_multi_project (cognitive 18) crates/ruff_dev/src/format_dev.rs:317 — format_dev::format_dev_multi_project has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, loops 6, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnittestAssert · ×1
  • UnittestAssert::generate_assert (cognitive 18) crates/ruff_linter/src/rules/flake8_pytest_style/rules/unittest_assert.rs:281 — UnittestAssert::generate_assert has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · logging · ×1
  • logging::logging_call (cognitive 18) crates/ruff_linter/src/rules/pylint/rules/logging.rs:98 — logging::logging_call has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · if_else_block_instead_of_dict_lookup · ×1
  • if_else_block_instead_of_dict_lookup::if_else_block_instead_of_dict_lookup (cognitive 18) crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_dict_lookup.rs:49 — if_else_block_instead_of_dict_lookup::if_else_block_instead_of_dict_lookup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 2, boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unnecessary_map · ×1
  • unnecessary_map::unnecessary_map (cognitive 18) crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_map.rs:68 — unnecessary_map::unnecessary_map has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fastapi_unused_path_parameter · ×1
  • fastapi_unused_path_parameter::fastapi_unused_path_parameter (cognitive 18) crates/ruff_linter/src/rules/fastapi/rules/fastapi_unused_path_parameter.rs:110 — fastapi_unused_path_parameter::fastapi_unused_path_parameter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, loops 2, boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · except_handler · ×1
  • except_handler::except_handler (cognitive 18) crates/ruff_linter/src/checkers/ast/analyze/except_handler.rs:11 — except_handler::except_handler has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · inplace_argument · ×1
  • inplace_argument::inplace_argument (cognitive 18) crates/ruff_linter/src/rules/pandas_vet/rules/inplace_argument.rs:60 — inplace_argument::inplace_argument has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · all_with_model_form · ×1
  • all_with_model_form::all_with_model_form (cognitive 18) crates/ruff_linter/src/rules/flake8_django/rules/all_with_model_form.rs:52 — all_with_model_form::all_with_model_form has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, loops 6, match/switch 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · redundant_backslash · ×1
  • redundant_backslash::redundant_backslash (cognitive 18) crates/ruff_linter/src/rules/pycodestyle/rules/logical_lines/redundant_backslash.rs:48 — redundant_backslash::redundant_backslash has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, loops 5, match/switch 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExprSubscript · ×1
  • ExprSubscript::needs_parentheses (cognitive 18) crates/ruff_python_formatter/src/expression/expr_subscript.rs:84 — ExprSubscript::needs_parentheses has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QualifiedName · ×1
  • QualifiedName::fmt (cognitive 18) crates/ruff_python_ast/src/name.rs:399 — QualifiedName::fmt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnyStringFlags · ×1
  • AnyStringFlags::prefix (cognitive 18) crates/ruff_python_ast/src/nodes.rs:2348 — AnyStringFlags::prefix has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormatBody · ×1
  • FormatBody::fmt (cognitive 18) crates/ruff_python_formatter/src/expression/expr_lambda.rs:261 — FormatBody::fmt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FieldNamePart · ×1
  • FieldNamePart::parse_part (cognitive 18) crates/ruff_python_literal/src/format.rs:481 — FieldNamePart::parse_part has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 4, boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hover · ×1
  • hover::hover (cognitive 18) crates/ty_ide/src/hover.rs:15 — hover::hover has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 3, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AmbiguousNameCollector · ×1
  • AmbiguousNameCollector::record (cognitive 18) crates/ty_python_semantic/src/types/display.rs:487 — AmbiguousNameCollector::record has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DisplayTuple · ×1
  • DisplayTuple::fmt_detailed (cognitive 18) crates/ty_python_semantic/src/types/display.rs:1532 — DisplayTuple::fmt_detailed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, match/switch 3, boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OverloadLiteral · ×1
  • OverloadLiteral::raw_signature (cognitive 18) crates/ty_python_semantic/src/types/function.rs:544 — OverloadLiteral::raw_signature has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, boolean chains 5 (nesting depth added 2). Of this number, 13 points are the body's own statements and 5 belong to one function item declared inside it. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TypedDictType · ×1
  • TypedDictType::openness::class_based_openness (cognitive 18) crates/ty_python_semantic/src/types/typed_dict.rs:243 — TypedDictType::openness::class_based_openness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoundTypeVarInstance · ×1
  • BoundTypeVarInstance::apply_type_mapping_impl (cognitive 18) crates/ty_python_semantic/src/types/typevar.rs:1126 — BoundTypeVarInstance::apply_type_mapping_impl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.