Public report — sdk, published 23 Sep 2026.
Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches,
dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase surveyMeasured under the Code Assurance Index · rubric rubric-2026.09.15 (frozen) · verify this surveyFiledcd_330bb2a0ad894beda4f793f10bdfc2e2
Filed 25 September 2026, 05:09 UTC
Public
Very large · 2,050,617 LoC · rebuild ~27.5 person-years · weakest lens: Code Health (28%)
Findings by grade
13 critical15507 serious18 minor46 could not be resolved — could be critical — see Limitations
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
23 September 2026, 18:58 UTC
A measurement, not a certificate. The Code Assurance Index does not certify,
approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The
standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said
here so the number is checked rather than believed.
Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸
15528findings with an exact file:lineof 15538 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
37/131dimensions across the health lenses2050617 LoC — wide & deep
This massive asset, valued at approximately four million euros to rebuild, is currently in a fragile state with an overall health score of 41%. While the underlying architecture is robust, the system carries significant operational risk due to severe deficiencies in code maintainability. This imbalance threatens delivery speed and increases the cost of every change, making immediate intervention essential to protect the business’s investment.
The primary risk is code quality erosion. With a code health score of just 28%, the system suffers from high complexity and duplication. This creates a velocity tax on every modification, plausibly increasing effort by 4–9% compared to clean code. As the codebase grows, this inefficiency compounds, leading to slower feature delivery, higher defect rates, and increased long-term maintenance costs. The sheer size of the codebase amplifies this burden, turning routine updates into expensive, risky endeavors.
A secondary concern is frontend instability. The frontend lacks type safety, with no files currently typed. This absence of structural checks increases the likelihood of runtime errors and makes refactoring dangerous. Without type checking, developers cannot rely on the compiler to catch mistakes, leading to potential outages and security exposures that are difficult to detect before they reach production. This area represents a significant gap in production readiness and reliability.
Despite these risks, the system’s architecture is strong, scoring 92%, and documentation maturity is acceptable at 69%. This means the core logic is well-structured and a new team could potentially navigate the system, provided the code quality issues are addressed. The architectural foundation provides a stable base for remediation efforts, ensuring that fixes to code quality will not require a complete architectural overhaul.
The highest-leverage action is to adopt TypeScript for the frontend. Adding a typecheck step to the build process will immediately improve stability and reduce runtime errors. This should be followed by splitting oversized files into focused modules and deleting dead code to reduce maintenance overhead. These steps offer the best return on investment, directly addressing the most critical risks to delivery speed and reliability.
Note that event-driven patterns, event sourcing, and performance metrics were not measured, so the picture is partial. However, the current data clearly indicates that code quality and frontend stability are the immediate priorities.
How the score is built — each lens's share of the headlineWidth 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.
0.7× (at 41% quality) — the last 20% of quality is most of the work
Size & shape
Very large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~27.5 person-years of build effort (about ~€4,000,000 to rebuild). Its weakest lens is Code Health at 28% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.7× 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
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Value concentrated against a weak lens · REDACTED · Value at risk
This is a Very large asset (~27.5 person-years to rebuild), and its weakest lens is Code Health at 28%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
Evidence: valuation: Very large, ~27.5 person-years rebuild (2,050,617 LoC) · weakest lens: Code Health 28%
→ Direct remediation budget at Code Health first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · REDACTED · Leverage
Of everything flagged, the best return on effort is: Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
A velocity tax on every change · REDACTED · Economics
The code-quality signals (complexity, duplication, cohesion) average 6.5/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 4–9% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4/D6 code quality: averaging 6.5/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency matrix
Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
161 modules, 378 dependencies. 1 dependency cycle across 46 modules, marked above the diagonal.
Showing the 40 most-connected modules; 121 more are not drawn.
Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
71 distinct (type in transformations → type in _internal) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
209 distinct (type in transformations → type in repository) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
35 distinct (type in _internal → type in transformations) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
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 category
Findings
Severity
A03:2021 — Injection
15
REDACTED / Critical
Roadmap
Begin by establishing type safety in the frontend by integrating a typecheck step and converting high-traffic modules. Next, improve maintainability by splitting oversized files into smaller, focused modules and removing dead code to reduce maintenance costs. Finally, ensure accessibility and structural integrity by correcting ARIA roles, adding required page landmarks, and fixing document structure issues.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Enforce accessibility in the toolchain your project already uses: assert accessibility in your UI test suite with your toolkit's own matcher (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in CI so a regression blocks the merge.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 13
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 15507
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 18
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 46
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
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. 34 of 37 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 3 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.7 — 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 — 37 dimensions across the health lenses
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
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, 15528 of 15538 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.)
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.
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.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
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.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.py, .dart) but the built-in reliability runner does not support this repository's ecosystem, so flakiness couldn't be assessed. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository's dependency manifest (a Dart pubspec.yaml) was found, but this pass cannot parse it for hygiene, so no package was assessed. Zero packages read is NOT a clean dependency tree, so this is NOT SCORED — a gap in the analyzer, not a verdict about this repository. This row is about dependency HYGIENE — outdated, deprecated or unmaintained direct dependencies; known CVEs in the same dependency graph are a separate question, reported under D30 wherever the manifest is OSV-readable.
D14 License Compliance — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 Dart pubspec.yaml), which this pass does not parse yet — so this dimension asserts nothing about this repository's licensing in either direction.
D15 Churn × Complexity Hotspots — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-commit history — no usable git history window to measure hotspots: a single-commit clone exposes no history window, so the churn × complexity hotspot signal is unavailable — not scored for this run.
D16 Bus Factor — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The bus factor is computed from the commit log, and no commits were sampled for this run — git history was unavailable, shallow, or could not be read — so knowledge concentration could not be assessed and is not scored. This is a gap in the analyzer, not a finding about this repository.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: D22 has no public-API collector for any other ecosystem, and the remedy is to write one — no change to the scan image can close it.
D28 Secrets (history) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `gitleaks` TIMED OUT after 180s against a 180s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. Nothing about this repository is asserted by the absence of a result; the budget is ours to raise, and raising it is our backlog item, not an action for this repository's owner.
D34 Knowledge Freshness — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Too few commits to judge knowledge freshness (0 commit(s) sampled).
D35 Change Coupling — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Change coupling is mined from the co-change history of production source files, and this target has none to mine — a thin or very young history, or an unversioned tree. Not scored for this run.
D44 Platform End-of-Life — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (go.mod, a Gemfile's ruby directive, a Dockerfile) is simply not read here yet.
AX3 Project dependency cycles — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which project references which — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX4 Dependency direction — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the direction each project reference points — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AX8 Test isolation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which projects are test projects, and what they reference — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
X1 Async correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X14 Bypassable address classification — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X26 Unsynchronised callback handoff — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X27 Collection changed while being enumerated — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X30 Support guard that admits what it rejects — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
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 — an in-process token-stream comparison over sliding windows, with type-aware normalization — so 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.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
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").
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
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.
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").
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 click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled 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.
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. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
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.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
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.
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.
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 (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They 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.
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.
1219 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Intrinsifier.generateStaticIntrinsic at 374. A further 121 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 TokensContext.binaryToAstTokenType at 143 — they are counted neither in the figure above nor in this dimension's score. 40 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: pkg/analyzer/lib/src/summary2/tokens_context.dart (TokensContext.binaryToAstTokenType at 143), pkg/analyzer/lib/src/summary2/ast_binary_reader.dart (AstBinaryReader._readNode at 114), pkg/front_end/testcases/patterns/const_patterns.dart (Class.test at 100), pkg/front_end/parser_testcases/patterns/const_patterns.dart (Class.test at 94), pkg/kernel/lib/binary/ast_from_binary.dart (BinaryBuilder.readExpression at 84), and 35 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 1197 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 3 _ChunkedJsonParser.parseNumber (cyclomatic 42) finding(s) in Cyclomatic Complexity — start with convert_patch.dart (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 3 _ChunkedJsonParser.parsePartialNumber (cyclomatic 25) finding(s) in Cyclomatic Complexity — start with convert_patch.dart (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 3 _BigIntImpl.toDouble (cyclomatic 16) finding(s) in Cyclomatic Complexity — start with bigint_patch.dart (3). — One of this dimension's main actionable groups (3 warning-level).
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.
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.
+ 2316 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 3 _ChunkedJsonParser.parseNumber (cognitive 96) finding(s) in Cognitive Complexity — start with convert_patch.dart (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 3 _ChunkedJsonParser.parsePartialNumber (cognitive 47) finding(s) in Cognitive Complexity — start with convert_patch.dart (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 3 _BigIntImpl.toDouble (cognitive 33) finding(s) in Cognitive Complexity — start with bigint_patch.dart (3). — One of this dimension's main actionable groups (3 warning-level).
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.
Do you agree with this assessment?
D3 · God Classes8.4 / 10Strong✓ 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.
Resolve the 445 FileTooLong finding(s) in God Classes — start with types.dart (6), encoding.dart (6), builder.dart (4). — One of this dimension's main actionable groups (445 warning-level).
Resolve the 430 TooManyMethods finding(s) in God Classes — start with element.dart (12), nodes.dart (11), ast.dart (8). — One of this dimension's main actionable groups (430 warning-level).
Resolve the 328 MethodTooLong finding(s) in God Classes — start with inference_visitor.dart (29), inference_visitor_base.dart (12), builder.dart (7). — One of this dimension's main actionable groups (328 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
2219 duplicated block group(s) detected. A further 124 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 32 of the 2343 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 343 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 128 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with compiler.dart (15), element_map_impl.dart (7), relevance_metrics.dart (5). — One of this dimension's main actionable groups (128 warning-level).
Resolve the 123 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with compiler.dart (11), native_typed_data.dart (8), compact_hash.dart (6). — One of this dimension's main actionable groups (123 warning-level).
Resolve the 121 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with relevance_metrics.dart (12), compiler.dart (9), builder.dart (4). — One of this dimension's main actionable groups (121 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 1319 REDACTED cohesion finding(s) in Cohesion (LCOM4) — start with ast.dart (244), nodes.dart (72), expressions.dart (67). — One of this dimension's main actionable groups (1319 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
60 test methods: 60 unit, 0 integration, 0 BDD, 0 e2e. The Python suite contributes 60 test function(s) across 8 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
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.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
7153 deducted task-comment markers across 2050617 LoC (0.3/KLoC) → score 9.3. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
TodoComment repeated across 19 filespkg/_fe_analyzer_shared/test/exhaustiveness/data/variable_pattern.dart:207
TodoComment repeated across 114 filespkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart:20
+ 4 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6690 TodoComment finding(s) in Explicit Debt — start with builder.dart (135), compiler_new.dart (99), compiler.dart (94). — One of this dimension's main actionable groups (6690 warning-level).
Resolve the 39 FixmeComment finding(s) in Explicit Debt — start with directory_impl.dart (4), non_utf8_link_test.dart (4), non_utf8_file_test.dart (4). — One of this dimension's main actionable groups (39 warning-level).
Resolve the 33 HackComment finding(s) in Explicit Debt — start with lib1.dart (3), static_separate_lib1.dart (3), binary_md_dill_reader.dart (3). — One of this dimension's main actionable groups (33 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The documentation is comprehensive and well-organized for a Dart SDK project. It includes an overview of the language (approachable/portable/productive with native compilation to ARM/x64/RISC-V, WebAssembly, and DevTools), license/patent information, usage guidance covering API docs at api.dart.dev, contribution/contributing.md, building instructions, and a dedicated tools/verify_docs README that explains how to validate DartDoc samples. A focused package-validation doc (pkg/) plus several test directories round out the documentation. The Dart VM documentation is comprehensive: a work-in-progress README (work-in-progress warning) gives an introduction and outlines the document's contents; several architecture/Docs markdown packages cover runtime components like JIT/AOT pipelines, snapshot analysis, service protocol decoding, testing infrastructure, crash reporting, source-map stepping, and telemetry. The package-level READMEs are thin but each one is a focused documentation file for its own purpose (e.g., vm_snapshot_analysis, vm_service_protos).
Documentation: no installation or build instructions · ×5README.md
What to do
Resolve the 5 Documentation finding(s) in Documentation Quality — start with README.md (5). — One of this dimension's main actionable groups (5 recommendation-level).
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. 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.
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).
15 finding(s): 0 critical, 4 high, 4 medium, 7 low. semgrep hit a parse error in 56 file(s) — `pkg/analysis_server/tool/performance/scenarios/logs/DAS-test1-norm.json`, `pkg/analysis_server/tool/performance/scenarios/logs/package_build_find_references.json`, `pkg/analysis_server/tool/performance/scenarios/logs/project_pigeon_format_generated_file.json`, `pkg/analysis_server/tool/performance/scenarios/logs/sdk_rename_driver_class.json`, `pkg/analysis_server/tool/spec/spec_input.html` (lines 4085–4087), … (+51 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 7 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (7 recommendation-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.
✓ On the Gold path — maintain.
Detailed fixes: d37_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC2 · Forms & labels5.4 / 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, a click handler on a plain element names the control it declares, 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.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — pkg/front_end/tool/benchmark_visualiser.html:68
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.
Do you agree with this assessment?
AC3 · Page structure3.8 / 10Weak✓ Tool-verified
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.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×4) — pkg/front_end/tool/benchmark_visualiser.html:1, pkg/vm_snapshot_analysis/lib/src/assets/index.html:6, runtime/tools/wiki/templates/page.html:2, …
A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>. — pkg/front_end/tool/benchmark_visualiser.html:1
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×3) — pkg/front_end/tool/benchmark_visualiser.html:1, pkg/vm_snapshot_analysis/lib/src/assets/index.html:6, tools/dart2js/sourceMapViewer/web/display.html:2
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). — tools/dart2js/sourceMapViewer/web/display.html:37
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
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.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
aria-hidden="true" hides the element from assistive tech but leaves it keyboard-focusable — a confusing dead stop. Remove aria-hidden or make the element non-focusable. — tools/bots/dartdoc_footer.html:1
What to do
Use valid, non-abstract roles, supply the ARIA state each role requires, and never put aria-hidden on a focusable element.
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.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`span.marker` sets color: green on background-color: red — 1.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — tools/dart2js/sourceMapViewer/web/display.html:7
`nav.nav-bar > ul` sets color: white on background-color: #0489c3 — 3.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — pkg/observatory/lib/src/elements/css/shared.css:2049
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no accessibility linting at author time and no automated accessibility check in tests or CI. Add your UI toolkit's own accessibility assertion to the test suite (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in the pipeline. What was searched, so you can tell an absence from a miss: the 13 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the toolchain your project already uses: assert accessibility in your UI test suite with your toolkit's own matcher (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in CI so a regression blocks the merge.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
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.
Other · Domain Modelling — Whether domain identifiers are strongly typed (an extension-type / value-class 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. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. 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.
Other · Domain Modelling — Whether an entity protects its own invariants — a class whose identity is derived from its fields (value equality) but whose fields are publicly mutable bypasses that invariant. Encapsulated state keeps identity-bearing fields immutable.
Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain entity fused to a persistence ORM (drift/floor/isar/objectbox/hive) 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.
`DefinedTable` is a domain concept fused to persistence ON ITS OWN DECLARATION (the drift `Table`/`@DataClassName`/`@DriftDatabase` mapping) with no separate pure-domain layer — the domain entity IS the ORM row (active-record), and it carries domain behaviour on the persistence type. A schema/persistence change ripples straight into the domain. Keep the ORM/table mapping on a boundary data-model + a mapper, and the domain entity framework-free (map row↔domain through a repository). — pkg/wasm_builder/lib/src/ir/table.dart:52
`ImportedTable` is a domain concept fused to persistence ON ITS OWN DECLARATION (the drift `Table`/`@DataClassName`/`@DriftDatabase` mapping) with no separate pure-domain layer — the domain entity IS the ORM row (active-record), and it carries domain behaviour on the persistence type. A schema/persistence change ripples straight into the domain. Keep the ORM/table mapping on a boundary data-model + a mapper, and the domain entity framework-free (map row↔domain through a repository). — pkg/wasm_builder/lib/src/ir/table.dart:83
What to do
Keep the ORM/table mapping on a boundary data-model + mapper; leave the domain entity framework-free (map row↔domain through a repository).
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 a 'Testing' section to the root README — how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
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 — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
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.
Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
What to do
Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
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.
Do you agree with this assessment?
P1 · CI/CD gates6.5 / 10Adequate✓ Tool-verified
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.
A CI pipeline exists but no build step was matched — changes may merge without the build ever running. A build step may be invoked directly as a command, or declared as a task that a runner named in the pipeline resolves.
What to do
Add an explicit build step to your CI pipeline — your stack's own build command, or, if the pipeline delegates to a task runner, a build task that runner executes in CI — so every change is built before merge.
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.
`scorecards-analysis.yml` run(s) a static-analysis scan, but no workflow that runs one is triggered by a pull request (or a merge queue, or an unfiltered push) — the scan fires on a schedule or a manual dispatch only. A vulnerable change therefore merges clean and is reported on the next scheduled run, by which time it is on the default branch and the only remedy is a follow-up fix. Add the pull-request trigger to the workflow that runs the scan so the finding arrives before the merge rather than after it.
What to do
Trigger your SAST workflow on pull requests — a scan that only runs on a cron reports history, it does not gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
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.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ 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.
0 typed · 20 plain JS — the untyped files are pkg/compiler/tool/used_names/used_names.js, REDACTED, pkg/dartpad_worker/lib/src/asset/sandbox_flutter_patch.js, pkg/dartpad_worker/lib/src/asset/worker.js, pkg/dev_compiler/lib/js/common/run.js, REDACTED (+14 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js:10 · sdk/lib/_internal/js_runtime/lib/preambles/d8.js:10 · sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js:7 — these 3 files are line-for-line copies of one another — 189 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js:10
pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:387 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:572 — the two spans are one implementation copied and then locally edited — 324 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:387
REDACTED:1705 · REDACTED:1736 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1705
pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:443 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:609 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:443
pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:884 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:884
REDACTED:388 · REDACTED:428 — the two spans are one implementation copied and then locally edited — 82 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:388
pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:500 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:500
runtime/tools/graphexplorer/graphexplorer.js:1768 · runtime/tools/graphexplorer/graphexplorer.js:1813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:1768
REDACTED:879 · REDACTED:1246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:879
runtime/tools/graphexplorer/graphexplorer.js:1446 · runtime/tools/graphexplorer/graphexplorer.js:1943 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — runtime/tools/graphexplorer/graphexplorer.js:1446
pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:868 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:902 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:868
runtime/tools/graphexplorer/graphexplorer.js:32 · runtime/tools/graphexplorer/graphexplorer.js:46 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:32
runtime/tools/graphexplorer/graphexplorer.js:1078 · runtime/tools/graphexplorer/graphexplorer.js:1091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:1078
pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:521 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:521
pkg/observatory/web/timeline.js:711 · pkg/observatory/web/timeline.js:750 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — pkg/observatory/web/timeline.js:711
runtime/tools/graphexplorer/graphexplorer.js:144 · runtime/tools/graphexplorer/graphexplorer.js:299 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — runtime/tools/graphexplorer/graphexplorer.js:144
runtime/tools/graphexplorer/graphexplorer.js:1682 · runtime/tools/graphexplorer/graphexplorer.js:1695 · runtime/tools/graphexplorer/graphexplorer.js:1709 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — runtime/tools/graphexplorer/graphexplorer.js:1682
runtime/tools/graphexplorer/graphexplorer.js:326 · runtime/tools/graphexplorer/graphexplorer.js:378 · runtime/tools/graphexplorer/graphexplorer.js:573 · runtime/tools/graphexplorer/graphexplorer.js:699 · +2 more site(s) not listed — all 6 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — runtime/tools/graphexplorer/graphexplorer.js:326
runtime/tools/graphexplorer/graphexplorer.js:341 · runtime/tools/graphexplorer/graphexplorer.js:359 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — runtime/tools/graphexplorer/graphexplorer.js:341
runtime/tools/graphexplorer/graphexplorer.js:392 · runtime/tools/graphexplorer/graphexplorer.js:796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:392
REDACTED:405 · REDACTED:879 · REDACTED:1246 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — REDACTED:405
runtime/tools/graphexplorer/graphexplorer.js:1212 · runtime/tools/graphexplorer/graphexplorer.js:1224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:1212
runtime/tools/graphexplorer/graphexplorer.js:70 · runtime/tools/graphexplorer/graphexplorer.js:202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:70
runtime/tools/graphexplorer/graphexplorer.js:981 · runtime/tools/graphexplorer/graphexplorer.js:994 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:981
runtime/tools/graphexplorer/graphexplorer.js:1878 · runtime/tools/graphexplorer/graphexplorer.js:1887 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — runtime/tools/graphexplorer/graphexplorer.js:1878
runtime/tools/graphexplorer/graphexplorer.js:1797 · runtime/tools/graphexplorer/graphexplorer.js:1805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — runtime/tools/graphexplorer/graphexplorer.js:1797
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
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.
loadDartHeapSnapshot has cyclomatic complexity 21 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — runtime/tools/graphexplorer/graphexplorer.js:155
rewriteEdgesForOwners has cyclomatic complexity 19 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — runtime/tools/graphexplorer/graphexplorer.js:381
onRcpMessage has cyclomatic complexity 18 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:58
createTreemapTile has cyclomatic complexity 17 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — runtime/tools/graphexplorer/graphexplorer.js:1279
_clone has cyclomatic complexity 17 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:286
hotRestart has cyclomatic complexity 17 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:481
_showInfoBox has cyclomatic complexity 16 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:774
start has cyclomatic complexity 15 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:652
load has cyclomatic complexity 12 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:214
computeDominators has cyclomatic complexity 11 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — runtime/tools/graphexplorer/graphexplorer.js:576
computeOwnedSizes has cyclomatic complexity 11 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — runtime/tools/graphexplorer/graphexplorer.js:702
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
5 file(s) over 400 lines (counted as significant lines — blank lines excluded — over production source only, tests excluded), largest first: REDACTED (2137), runtime/tools/graphexplorer/graphexplorer.js (1749), pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js (887), pkg/observatory/web/timeline.js (783), REDACTED (439).
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R7 · Dead Code1.5 / 10Critical✓ 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.
Unreachable from the 8 application, 0 tooling and 4 test entry point(s) detected in this repo. This repository declares no build, type-check or test script, so nothing here would fail on a wrong deletion — confirm by hand that nothing loads each file (including by a path built at runtime) before removing it. An undetected custom entry would make these reachable.
no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×8) — REDACTED, REDACTED, sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js, …
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
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.
Other · Security — Only what this repository's own non-C# files could be read for was assessed — markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
`https://www.gstatic.com/charts/loader.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 3 such include(s) across the repository's markup. — pkg/front_end/tool/benchmark_visualiser.html:4
What to do
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 10 of 55 WCAG 2.2 Level A/AA success criteria (18%; ≈20% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 45 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).
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.
Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Unscored — 1 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 5 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises 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 a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises 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 a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises 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.
P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 88 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.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AX1 Captive dependencies — no DI registrations detected
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects 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 a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects 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 a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects 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 a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects 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 a project graph (which projects are test projects, and what they reference) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises 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 a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises 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.
D10 Test Quality — ~2641314 lines of test source are present (.py, .dart) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — 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 — no .dart test runner
D12 Dependency Hygiene — Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
D14 License Compliance — Package manifest not parsed for licence data — analyzer language-coverage gap
D15 Churn × Complexity Hotspots — single-commit history — no usable git history window to measure hotspots
D16 Bus Factor — bus factor not measured — no commits were sampled
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.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — Production source is present (.dart, .java, .py) 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 module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/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 — Navigability analysis does not read .dart, and .dart is this repository's production source, so no call sites were sampled and tracing effort was not assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D28 Secrets (history) — gitleaks killed before it finished — this repository's git history not scanned
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 Dart pubspec.yaml — not scanned yet).
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D34 Knowledge Freshness — too few commits to judge knowledge freshness
D35 Change Coupling — no production change history to mine for change-coupling
D36 Supply-chain Provenance & Signing — The CI pipeline builds and tests but publishes no released artifact — no package publish, container push, GitHub release or deployment step. Supply-chain provenance, signing and SBOM attest RELEASED artifacts, so there is nothing to attest here. Add them to the release pipeline when this repo starts shipping artifacts (a published package, a container image, a deployed service or a tagged release). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
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.
D43 Malicious Dependencies — 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 Dart pubspec.yaml — not scanned yet).
D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
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.)
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage NOT MEASURED: `--collect:"XPlat Code Coverage"` names a data collector that ships in the `coverlet.collector` package, and this repository wires up none — no test project references it and no runsettings declares one. The absence of coverage here is therefore not evidence about the suite or about our analyzer environment: without a collector, `--collect` produces nothing even from a suite that builds and passes. Add a `coverlet.collector` PackageReference to the test project(s) (or commit the Cobertura/OpenCover/lcov report your CI produces) and real coverage will be measured. It is excluded from the score rather than counted as a near-zero defect.
DM1 Aggregate boundaries — not scored for Dart: aggregate-vs-value-object classification cannot be told apart in source (every class-holding-class reads alike), and a child COLLECTION (legitimate membership) vs a single embedded aggregate is indistinguishable — reported as guidance rather than measured
DM3 Integration-event coupling — not scored for Dart: a cross-package domain leak cannot be told apart in source from a legitimate shared-kernel package, and most repositories ship a single package — reported as guidance rather than measured
DM4 Rich vs anemic domain model — this Dart repository declares no domain-layer entity carrying stored data (every type is a typed-id wrapper, DTO/config, ORM row or presentation container), so DM4's rich-vs-anemic read has no population to be taken over
DM7 Repository granularity — not scored for Dart: 'a repository per CHILD entity' needs the aggregate-root structure, which is not source-resolvable — reported as guidance rather than measured
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, which this analysis does not build from source alone for this language. Reported as guidance rather than measured
ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises 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.
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — not assessed — schema-migration practice is read from a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model or because its projects 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 — `flutter test --coverage` (or `dart test --coverage=coverage` then `dart run coverage:format_coverage --lcov`)) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects 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 a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects 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 a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects 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.
R4 Test Coverage — 4 test file(s) reach none of 16 production file(s) via imports — exercised outside the JS import graph (integration/bundled), not import-reachable
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects 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 read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects 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.
<html> without a lang pkg/front_end/tool/benchmark_visualiser.html:1— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang pkg/vm_snapshot_analysis/lib/src/assets/index.html:6— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang runtime/tools/wiki/templates/page.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang tools/dart2js/sourceMapViewer/web/display.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
Domain fused to persistence infrastructure: DefinedTable pkg/wasm_builder/lib/src/ir/table.dart:52— `DefinedTable` is a domain concept fused to persistence ON ITS OWN DECLARATION (the drift `Table`/`@DataClassName`/`@DriftDatabase` mapping) with no separate pure-domain layer — the domain entity IS the ORM row (active-record), and it carries domain behaviour on the persistence type. A schema/persistence change ripples straight into the domain. Keep the ORM/table mapping on a boundary data-model + a mapper, and the domain entity framework-free (map row↔domain through a repository).
Domain fused to persistence infrastructure: ImportedTable pkg/wasm_builder/lib/src/ir/table.dart:83— `ImportedTable` is a domain concept fused to persistence ON ITS OWN DECLARATION (the drift `Table`/`@DataClassName`/`@DriftDatabase` mapping) with no separate pure-domain layer — the domain entity IS the ORM row (active-record), and it carries domain behaviour on the persistence type. A schema/persistence change ripples straight into the domain. Keep the ORM/table mapping on a boundary data-model + a mapper, and the domain entity framework-free (map row↔domain through a repository).
AC2 · Forms & labels· <textarea> without a programmatic label · ×1
<textarea> without a programmatic label pkg/front_end/tool/benchmark_visualiser.html:68— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure· Document without a <title> · ×1
Document without a <title> pkg/front_end/tool/benchmark_visualiser.html:1— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
AC5 · ARIA correctness· aria-hidden on a focusable element · ×1
aria-hidden on a focusable element tools/bots/dartdoc_footer.html:1— aria-hidden="true" hides the element from assistive tech but leaves it keyboard-focusable — a confusing dead stop. Remove aria-hidden or make the element non-focusable.
TodoComment PRESUBMIT.py:149— # TODO(https://github.com/dart-lang/sdk/issues/46947): Remove this hack.
TodoComment PRESUBMIT.py:439— # TODO(srawlins): Check more: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/FfiCall/dart/dlopen_helper.dart:84— // TODO(https://dartbug.com/50105): enable dlopen global via package:ffi.
TodoComment tests/ffi/dylib_utils.dart:51— // TODO(https://dartbug.com/50105): enable dlopen global via package:ffi.
TodoComment benchmarks/FfiMemory/dart/FfiMemory.dart:5— // TODO(37581): Generate this file. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/Iterators/dart/Iterators.dart:491— // TODO(sra): Do we need to add anything here? There are a lot of benchmarks, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/SimdSearch/dart/SimdSearch.dart:13— // TODO: `direct` is a workaround to measure SIMD search throughput without the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/SoundSplayTreeSieve/dart/sound_splay_tree.dart:29— // TODO: implement key — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/SoundSplayTreeSieve/dart/sound_splay_tree.dart:53— // TODO: implement key — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/SoundSplayTreeSieve/dart/sound_splay_tree.dart:64— /// TODO(kallentu): Add a variance modifier to the Node type parameter. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment benchmarks/UiMatrix/dart/uimatrix.dart:262— // TODO: possible specializations — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/witness.dart:22— // TODO(johnniwinther): In order to model exhaustiveness on enum types, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/test_helper.dart:73— // TODO(johnniwinther): Sort types. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/exhaustive.dart:94— // TODO(johnniwinther): Perform reachability checking. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/exhaustive.dart:400— // TODO(johnniwinther): Enable this assert when extension members are — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/exhaustive.dart:416— // TODO(johnniwinther): Enable this assert when extension members are — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/dart_template_buffer.dart:35— /// TODO(paulberry): add the necessary semantics tracking to the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/dart_template_buffer.dart:44— /// TODO(paulberry): consider replacing [SimpleDartBuffer] with a CFE — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/dart_template_buffer.dart:65— /// TODO(paulberry): consider replacing [SimpleDartBuffer] with a CFE — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/dart_template_buffer.dart:56— /// TODO(paulberry): investigate when this method is used. Is it possible — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/dart_template_buffer.dart:69— /// TODO(paulberry): what happens if the type is a typedef (e.g. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:176— // TODO(johnniwinther): Can the rest key have head/tail sizes that don't — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:4075— /// TODO(paulberry): if the type is non-nullable, should this method mark the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:4114— /// TODO(paulberry): if the type is non-nullable, should this method mark the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:4807— // TODO(paulberry): remove demotions from demotionResult.nonPromotionHistory — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
REDACTED cohesion: WrapperClass (LCOM4 69) pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart:2— WrapperClass's methods fall into 69 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 69 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: WrapperClass (LCOM4 69) pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods_2.dart:1— WrapperClass's methods fall into 69 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 69 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: _ReferenceDependenciesCollector (LCOM4 61) pkg/dart2wasm/lib/deferred_load/dependencies.dart:205— _ReferenceDependenciesCollector's methods fall into 61 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 61 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: LibraryElementImpl (LCOM4 61) pkg/analyzer/lib/src/dart/element/element.dart:6699— LibraryElementImpl's methods fall into 61 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 61 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: Simplification (LCOM4 56) pkg/cfg/lib/passes/simplification.dart:12— Simplification's methods fall into 56 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 56 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: BinaryPrinter (LCOM4 55) pkg/kernel/lib/binary/ast_to_binary.dart:14— BinaryPrinter's methods fall into 55 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 55 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: RelevanceDataCollector (LCOM4 53) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:251— RelevanceDataCollector's methods fall into 53 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 53 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: AnnotationsListener (LCOM4 53) pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart:24— AnnotationsListener's methods fall into 53 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 53 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: CommonMasks (LCOM4 52) pkg/compiler/lib/src/inferrer/typemasks/masks.dart:46— CommonMasks's methods fall into 52 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 52 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: InferenceVisitorImpl (LCOM4 49) pkg/front_end/lib/src/type_inference/inference_visitor.dart:110— InferenceVisitorImpl's methods fall into 49 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 49 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: MiniAstBuilder (LCOM4 48) pkg/analyzer/tool/summary/mini_ast.dart:172— MiniAstBuilder's methods fall into 48 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 48 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: RelevanceDataCollector (LCOM4 47) pkg/analysis_server/tool/code_completion/relevance_metrics.dart:212— RelevanceDataCollector's methods fall into 47 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 47 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: FlowGraphChecker (LCOM4 44) pkg/cfg/lib/ir/flow_graph_checker.dart:14— FlowGraphChecker's methods fall into 44 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 44 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: CatchVariable (LCOM4 40) pkg/kernel/lib/src/ast/variables.dart:1231— CatchVariable's methods fall into 40 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 40 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: ProxyService (LCOM4 39) pkg/dwds/lib/src/services/proxy_service.dart:57— ProxyService's methods fall into 39 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 39 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: ThisVariable (LCOM4 39) pkg/kernel/lib/src/ast/variables.dart:1903— ThisVariable's methods fall into 39 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 39 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: TypeProviderImpl (LCOM4 38) pkg/analyzer/lib/src/dart/element/type_provider.dart:99— TypeProviderImpl's methods fall into 38 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 38 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: _ElementCollector (LCOM4 38) pkg/analyzer/lib/src/fine/manifest_ast.dart:215— _ElementCollector's methods fall into 38 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 38 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: PreTranslationAnalysis (LCOM4 37) pkg/dev_compiler/lib/src/compiler/rewrite_async.dart:2973— PreTranslationAnalysis's methods fall into 37 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 37 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: BodyBuilderContext (LCOM4 36) pkg/front_end/lib/src/kernel/body_builder_context.dart:35— BodyBuilderContext's methods fall into 36 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 36 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: LocalVariable (LCOM4 36) pkg/kernel/lib/src/ast/variables.dart:180— LocalVariable's methods fall into 36 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 36 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: LocalFunctionVariable (LCOM4 36) pkg/kernel/lib/src/ast/variables.dart:440— LocalFunctionVariable's methods fall into 36 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 36 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: LateVariable (LCOM4 36) pkg/kernel/lib/src/ast/variables.dart:702— LateVariable's methods fall into 36 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 36 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: ConstVariable (LCOM4 36) pkg/kernel/lib/src/ast/variables.dart:966— ConstVariable's methods fall into 36 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 36 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
REDACTED cohesion: SyntheticVariable (LCOM4 35) pkg/kernel/lib/src/ast/variables.dart:2110— SyntheticVariable's methods fall into 35 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 35 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
FileTooLong: dartfuzz/dartfuzz_type_table.dart runtime/tools/dartfuzz/dartfuzz_type_table.dart— FileTooLong — 228059 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: DartType (13-173146). The bar is 500 significant lines; this is 227559 over it, 456.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: ast/ast.dart pkg/analyzer/lib/src/dart/ast/ast.dart— FileTooLong — 39261 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 38761 over it, 78.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: type_inference/inference_visitor.dart pkg/front_end/lib/src/type_inference/inference_visitor.dart— FileTooLong — 10132 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: InferenceVisitorImpl (110-14466). The bar is 500 significant lines; this is 9632 over it, 20.26× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: util/parser_ast_helper.dart pkg/front_end/lib/src/util/parser_ast_helper.dart— FileTooLong — 9982 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 9482 over it, 19.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: kernel/body_builder.dart pkg/front_end/lib/src/kernel/body_builder.dart— FileTooLong — 7948 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 7448 over it, 15.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: parser/parser_impl.dart pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart— FileTooLong — 7924 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 7424 over it, 15.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: element/element.dart pkg/analyzer/lib/src/dart/element/element.dart— FileTooLong — 7793 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 7293 over it, 15.59× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ssa/builder.dart pkg/compiler/lib/src/ssa/builder.dart— FileTooLong — 6303 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: KernelSsaGraphBuilder (102-8611). The bar is 500 significant lines; this is 5803 over it, 12.61× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: kernel/compiler_new.dart pkg/dev_compiler/lib/src/kernel/compiler_new.dart— FileTooLong — 5700 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5200 over it, 11.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: kernel/internal_ast.dart pkg/front_end/lib/src/kernel/internal_ast.dart— FileTooLong — 5491 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4991 over it, 10.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: kernel/compiler.dart pkg/dev_compiler/lib/src/kernel/compiler.dart— FileTooLong — 5257 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4757 over it, 10.51× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: kernel/expression_generator.dart pkg/front_end/lib/src/kernel/expression_generator.dart— FileTooLong — 5127 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4627 over it, 10.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: fasta/ast_builder.dart pkg/analyzer/lib/src/fasta/ast_builder.dart— FileTooLong — 5125 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: AstBuilder (52-6750). The bar is 500 significant lines; this is 4625 over it, 10.25× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: flow_analysis/flow_analysis.dart pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart— FileTooLong — 4834 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4334 over it, 9.67× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: type_inference/inference_visitor_base.dart pkg/front_end/lib/src/type_inference/inference_visitor_base.dart— FileTooLong — 4701 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: InferenceVisitorBase (133-5879). The bar is 500 significant lines; this is 4201 over it, 9.40× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/vm_service.dart pkg/vm_service/lib/src/vm_service.dart— FileTooLong — 4617 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4117 over it, 9.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: kernel/constant_evaluator.dart pkg/front_end/lib/src/kernel/constant_evaluator.dart— FileTooLong — 4362 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3862 over it, 8.72× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/typed_data_patch.dart sdk/lib/_internal/vm/lib/typed_data_patch.dart— FileTooLong — 4167 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3667 over it, 8.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: builder/instructions.dart pkg/wasm_builder/lib/src/builder/instructions.dart— FileTooLong — 4125 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: InstructionsBuilder (172-6601). The bar is 500 significant lines; this is 3625 over it, 8.25× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: lib/code_generator.dart pkg/dart2wasm/lib/code_generator.dart— FileTooLong — 4103 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3603 over it, 8.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: binary/ast_from_binary.dart pkg/kernel/lib/binary/ast_from_binary.dart— FileTooLong — 3650 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: BinaryBuilder (129-4777). The bar is 500 significant lines; this is 3150 over it, 7.30× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: lib/intrinsics.dart pkg/dart2wasm/lib/intrinsics.dart— FileTooLong — 3607 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: Intrinsifier (507-4223). The bar is 500 significant lines; this is 3107 over it, 7.21× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: service/object.dart pkg/observatory/lib/src/service/object.dart— FileTooLong — 3460 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2960 over it, 6.92× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: source/outline_builder.dart pkg/front_end/lib/src/source/outline_builder.dart— FileTooLong — 3412 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: OutlineBuilder (481-5013). The bar is 500 significant lines; this is 2912 over it, 6.82× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: ir/instruction.dart pkg/wasm_builder/lib/src/ir/instruction.dart— FileTooLong — 3404 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2904 over it, 6.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
TooManyMethods: InstructionsBuilder pkg/wasm_builder/lib/src/builder/instructions.dart:165— TooManyMethods — 510 methods. The bar is 30 methods; this is 480 over it, 17.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BodyBuilderImpl pkg/front_end/lib/src/kernel/body_builder.dart:179— TooManyMethods — 380 methods. The bar is 30 methods; this is 350 over it, 12.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ForwardingListener pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart:10— TooManyMethods — 379 methods. The bar is 30 methods; this is 349 over it, 12.63× the bar. Most of these members implement src.Listener (378 of 379 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: Listener pkg/_fe_analyzer_shared/lib/src/parser/listener.dart:39— TooManyMethods — 378 methods. The bar is 30 methods; this is 348 over it, 12.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AbstractParserAstListener pkg/front_end/lib/src/util/parser_ast_helper.dart:88— TooManyMethods — 377 methods. The bar is 30 methods; this is 347 over it, 12.57× the bar. Most of these members implement src.Listener (376 of 377 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: RecursiveParserAstVisitorWithDefaultNodeAsync pkg/front_end/lib/src/util/parser_ast_helper.dart:12490— TooManyMethods — 377 methods. The bar is 30 methods; this is 347 over it, 12.57× the bar. Most of these members implement src.ParserAstVisitor (376 of 377 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: ParserAstVisitor pkg/front_end/lib/src/util/parser_ast_helper.dart:10622— TooManyMethods — 376 methods. The bar is 30 methods; this is 346 over it, 12.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RecursiveParserAstVisitor pkg/front_end/lib/src/util/parser_ast_helper.dart:11051— TooManyMethods — 376 methods. The bar is 30 methods; this is 346 over it, 12.53× the bar. Most of these members implement src.ParserAstVisitor (376 of 376 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: LibraryCompiler pkg/dev_compiler/lib/src/kernel/compiler_new.dart:279— TooManyMethods — 363 methods. The bar is 30 methods; this is 333 over it, 12.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ProgramCompiler pkg/dev_compiler/lib/src/kernel/compiler.dart:80— TooManyMethods — 353 methods. The bar is 30 methods; this is 323 over it, 11.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BinaryBuilder pkg/kernel/lib/binary/ast_from_binary.dart:129— TooManyMethods — 324 methods. The bar is 30 methods; this is 294 over it, 10.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BinaryPrinter pkg/kernel/lib/binary/ast_to_binary.dart:14— TooManyMethods — 320 methods. The bar is 30 methods; this is 290 over it, 10.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AstBuilder pkg/analyzer/lib/src/fasta/ast_builder.dart:51— TooManyMethods — 312 methods. The bar is 30 methods; this is 282 over it, 10.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Parser pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:133— TooManyMethods — 273 methods. The bar is 30 methods; this is 243 over it, 9.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: KernelSsaGraphBuilder pkg/compiler/lib/src/ssa/builder.dart:102— TooManyMethods — 266 methods. The bar is 30 methods; this is 236 over it, 8.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InferenceVisitorImpl pkg/front_end/lib/src/type_inference/inference_visitor.dart:110— TooManyMethods — 264 methods. The bar is 30 methods; this is 234 over it, 8.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Printer pkg/kernel/lib/text/ast_to_text.dart:291— TooManyMethods — 241 methods. The bar is 30 methods; this is 211 over it, 8.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ToSourceVisitor pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart:9— TooManyMethods — 238 methods. The bar is 30 methods; this is 208 over it, 7.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BytecodeGenerator pkg/dart2bytecode/lib/bytecode_generator.dart:112— TooManyMethods — 210 methods. The bar is 30 methods; this is 180 over it, 7.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InScopeCompletionPass pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:38— TooManyMethods — 206 methods. The bar is 30 methods; this is 176 over it, 6.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RelevanceDataCollector pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:251— TooManyMethods — 194 methods. The bar is 30 methods; this is 164 over it, 6.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SsaCodeGenerator pkg/compiler/lib/src/ssa/codegen.dart:296— TooManyMethods — 191 methods. The bar is 30 methods; this is 161 over it, 6.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Arm64Assembler pkg/native_compiler/lib/back_end/arm64/assembler.dart:351— TooManyMethods — 182 methods. The bar is 30 methods; this is 152 over it, 6.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CloneVisitorNotMembers pkg/kernel/lib/clone.dart:10— TooManyMethods — 174 methods. The bar is 30 methods; this is 144 over it, 5.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: _FlowAnalysisImpl pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:6243— TooManyMethods — 173 methods. The bar is 30 methods; this is 143 over it, 5.77× the bar. Most of these members implement src.FlowAnalysis (129 of 173 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
MethodTooLong: Intrinsifier.generateStaticIntrinsic pkg/dart2wasm/lib/intrinsics.dart:1362— MethodTooLong — generateStaticIntrinsic runs 1944 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1844 over it, 19.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Types.performSubtypeCheck pkg/kernel/lib/src/types.dart:65— MethodTooLong — performSubtypeCheck runs 746 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 646 over it, 7.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RequirementsManifest.isSatisfied pkg/analyzer/lib/src/fine/requirements.dart:956— MethodTooLong — isSatisfied runs 522 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 422 over it, 5.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Instruction.deserialize pkg/wasm_builder/lib/src/ir/instruction.dart:87— MethodTooLong — deserialize runs 507 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 407 over it, 5.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: NodeCreator._createExpressionFromKind pkg/kernel/lib/src/node_creator.dart:812— MethodTooLong — _createExpressionFromKind runs 506 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 406 over it, 5.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: JsNodeDeserializer.read pkg/compiler/lib/src/common/codegen.dart:1564— MethodTooLong — read runs 416 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 316 over it, 4.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Intrinsifier.generateMemberIntrinsic pkg/dart2wasm/lib/intrinsics.dart:3594— MethodTooLong — generateMemberIntrinsic runs 410 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 310 over it, 4.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: VmServerConnection._delegateRequest pkg/vm_service_interface/lib/src/vm_service_interface.dart:1403— MethodTooLong — _delegateRequest runs 402 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 302 over it, 4.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceVisitorBase._inferInvocation pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:1734— MethodTooLong — _inferInvocation runs 361 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 261 over it, 3.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: _FfiUseSiteTransformer._visitStaticInvocation pkg/vm/lib/modular/transformations/ffi/use_sites.dart:352— MethodTooLong — _visitStaticInvocation runs 360 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 260 over it, 3.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TypeUseGenerator.buildSelectorAccess pkg/front_end/lib/src/kernel/expression_generator.dart:4698— MethodTooLong — buildSelectorAccess runs 344 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 244 over it, 3.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: _HttpParser._doParse sdk/lib/_http/http_parser.dart:486— MethodTooLong — _doParse runs 339 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 239 over it, 3.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InspectPage._visitObject pkg/observatory/lib/src/app/page.dart:249— MethodTooLong — _visitObject runs 315 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 215 over it, 3.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: InferenceVisitorBase.inferMethodInvocation pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3621— MethodTooLong — inferMethodInvocation runs 294 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 194 over it, 2.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ClassMembersNodeBuilder.build pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:617— MethodTooLong — build runs 292 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 192 over it, 2.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TokensContext.binaryToAstTokenType pkg/analyzer/lib/src/summary2/tokens_context.dart:10— MethodTooLong — binaryToAstTokenType runs 288 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TokensWriter.astToBinaryTokenType pkg/analyzer/lib/src/summary2/tokens_writer.dart:9— MethodTooLong — astToBinaryTokenType runs 287 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 187 over it, 2.87× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Intrinsifier.generateInstanceIntrinsic pkg/dart2wasm/lib/intrinsics.dart:761— MethodTooLong — generateInstanceIntrinsic runs 277 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 177 over it, 2.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: FrontendCompiler.compile pkg/frontend_server/lib/frontend_server.dart:689— MethodTooLong — compile runs 271 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 171 over it, 2.71× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RuntimeTypesNeedBuilderImpl.computeRuntimeTypesNeed pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart:1075— MethodTooLong — computeRuntimeTypesNeed runs 269 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: StandardBounds.getStandardUpperBoundInternal pkg/kernel/lib/src/standard_bounds.dart:593— MethodTooLong — getStandardUpperBoundInternal runs 258 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 158 over it, 2.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DillExtensionTypeDeclarationBuilder.DillExtensionTypeDeclarationBuilder pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:38— MethodTooLong — DillExtensionTypeDeclarationBuilder runs 257 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 157 over it, 2.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ImpactData.apply pkg/compiler/lib/src/ir/impact_data.dart:1438— MethodTooLong — apply runs 255 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HeapSnapshotElement._createReport pkg/observatory/lib/src/elements/heap_snapshot.dart:670— MethodTooLong — _createReport runs 255 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SourceClassBuilder.checkSupertypes pkg/front_end/lib/src/source/source_class_builder.dart:740— MethodTooLong — checkSupertypes runs 254 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 154 over it, 2.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
ClassTooLong: DartType runtime/tools/dartfuzz/dartfuzz_type_table.dart:9— ClassTooLong — 142422 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 142022 over it, 356.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DartTypeNoFp runtime/tools/dartfuzz/dartfuzz_type_table.dart:173148— ClassTooLong — 50499 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 50099 over it, 126.25× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DartTypeFlatTp runtime/tools/dartfuzz/dartfuzz_type_table.dart:237028— ClassTooLong — 17795 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 17395 over it, 44.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DartTypeNoFpFlatTp runtime/tools/dartfuzz/dartfuzz_type_table.dart:261194— ClassTooLong — 17343 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 16943 over it, 43.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InferenceVisitorImpl pkg/front_end/lib/src/type_inference/inference_visitor.dart:110— ClassTooLong — 10049 significant lines (blank, comment-only and punctuation-only lines excluded), 264 methods. The bar is 400 significant lines; this is 9649 over it, 25.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: KernelSsaGraphBuilder pkg/compiler/lib/src/ssa/builder.dart:102— ClassTooLong — 5394 significant lines (blank, comment-only and punctuation-only lines excluded), 266 methods. The bar is 400 significant lines; this is 4994 over it, 13.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AstBuilder pkg/analyzer/lib/src/fasta/ast_builder.dart:51— ClassTooLong — 4737 significant lines (blank, comment-only and punctuation-only lines excluded), 312 methods. The bar is 400 significant lines; this is 4337 over it, 11.84× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InferenceVisitorBase pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:133— ClassTooLong — 4092 significant lines (blank, comment-only and punctuation-only lines excluded), 133 methods. The bar is 400 significant lines; this is 3692 over it, 10.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InstructionsBuilder pkg/wasm_builder/lib/src/builder/instructions.dart:165— ClassTooLong — 4032 significant lines (blank, comment-only and punctuation-only lines excluded), 510 methods. The bar is 400 significant lines; this is 3632 over it, 10.08× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BinaryBuilder pkg/kernel/lib/binary/ast_from_binary.dart:129— ClassTooLong — 3324 significant lines (blank, comment-only and punctuation-only lines excluded), 324 methods. The bar is 400 significant lines; this is 2924 over it, 8.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BytecodeGenerator pkg/dart2bytecode/lib/bytecode_generator.dart:112— ClassTooLong — 3286 significant lines (blank, comment-only and punctuation-only lines excluded), 210 methods. The bar is 400 significant lines; this is 2886 over it, 8.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: OutlineBuilder pkg/front_end/lib/src/source/outline_builder.dart:481— ClassTooLong — 3173 significant lines (blank, comment-only and punctuation-only lines excluded), 158 methods. The bar is 400 significant lines; this is 2773 over it, 7.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Intrinsifier pkg/dart2wasm/lib/intrinsics.dart:503— ClassTooLong — 3129 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 2729 over it, 7.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AbstractParserAstListener pkg/front_end/lib/src/util/parser_ast_helper.dart:88— ClassTooLong — 2866 significant lines (blank, comment-only and punctuation-only lines excluded), 377 methods. The bar is 400 significant lines; this is 2466 over it, 7.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SsaCodeGenerator pkg/compiler/lib/src/ssa/codegen.dart:296— ClassTooLong — 2605 significant lines (blank, comment-only and punctuation-only lines excluded), 191 methods. The bar is 400 significant lines; this is 2205 over it, 6.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BinaryPrinter pkg/kernel/lib/binary/ast_to_binary.dart:14— ClassTooLong — 2562 significant lines (blank, comment-only and punctuation-only lines excluded), 320 methods. The bar is 400 significant lines; this is 2162 over it, 6.41× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Printer pkg/kernel/lib/text/ast_to_text.dart:291— ClassTooLong — 2260 significant lines (blank, comment-only and punctuation-only lines excluded), 241 methods. The bar is 400 significant lines; this is 1860 over it, 5.65× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Arm64CodeGenerator pkg/native_compiler/lib/back_end/arm64/code_generator.dart:28— ClassTooLong — 2248 significant lines (blank, comment-only and punctuation-only lines excluded), 68 methods. The bar is 400 significant lines; this is 1848 over it, 5.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DeclarationHelper pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:28— ClassTooLong — 2025 significant lines (blank, comment-only and punctuation-only lines excluded), 89 methods. The bar is 400 significant lines; this is 1625 over it, 5.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SourceLoader pkg/front_end/lib/src/source/source_loader.dart:103— ClassTooLong — 2019 significant lines (blank, comment-only and punctuation-only lines excluded), 114 methods. The bar is 400 significant lines; this is 1619 over it, 5.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DartFixKind pkg/analysis_server/lib/src/services/correction/fix.dart:33— ClassTooLong — 1933 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 1533 over it, 4.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: NodeCreator pkg/kernel/lib/src/node_creator.dart:18— ClassTooLong — 1910 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 1510 over it, 4.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PropertyElementResolver pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:34— ClassTooLong — 1886 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods. The bar is 400 significant lines; this is 1486 over it, 4.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: FragmentFactoryImpl pkg/front_end/lib/src/source/fragment_factory_impl.dart:70— ClassTooLong — 1801 significant lines (blank, comment-only and punctuation-only lines excluded), 86 methods. The bar is 400 significant lines; this is 1401 over it, 4.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SsaInstructionSimplifier pkg/compiler/lib/src/ssa/optimize.dart:276— ClassTooLong — 1705 significant lines (blank, comment-only and punctuation-only lines excluded), 88 methods. The bar is 400 significant lines; this is 1305 over it, 4.26× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (7 lines × 2) pkg/dart2bytecode/lib/declarations.dart:164— pkg/dart2bytecode/lib/declarations.dart:164-170 | pkg/dart2bytecode/lib/declarations.dart:1125-1131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) pkg/dart2wasm/lib/await_transformer.dart:985— pkg/dart2wasm/lib/await_transformer.dart:985-991 | pkg/dart2wasm/lib/await_transformer.dart:1005-1011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) pkg/dart2wasm/lib/code_generator.dart:2159— pkg/dart2wasm/lib/code_generator.dart:2159-2165 | pkg/dart2wasm/lib/state_machine.dart:1408-1414 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) pkg/dart2wasm/lib/constants.dart:648— pkg/dart2wasm/lib/constants.dart:648-654 | pkg/dart2wasm/lib/constants.dart:684-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) pkg/front_end/testcases/general/constants/potentially_constant_type.dart:57— pkg/front_end/testcases/general/constants/potentially_constant_type.dart:57-63 | pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:38-44 — before extracting anything, compare `pkg/front_end/testcases/general/constants/potentially_constant_type.dart` and `pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) pkg/heap_snapshot/lib/intset.dart:54— pkg/heap_snapshot/lib/intset.dart:54-60 | pkg/heap_snapshot/lib/intset.dart:81-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) tools/dom/src/AttributeMap.dart:48— tools/dom/src/AttributeMap.dart:48-54 | tools/dom/src/AttributeMap.dart:61-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:216— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:216-222 | sdk/lib/_internal/js_runtime/lib/js_array.dart:313-321 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:637— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:637-643 | sdk/lib/_internal/js_runtime/lib/js_array.dart:826-832 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:646— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:646-652 | sdk/lib/_internal/js_runtime/lib/js_array.dart:835-841 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:160— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:160-166 | sdk/lib/_internal/js_dev_runtime/private/js_number.dart:187-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:763— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:763-769 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1221-1227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:284— sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:284-290 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:523-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/vm/lib/typed_data_patch.dart:560— sdk/lib/_internal/vm/lib/typed_data_patch.dart:560-566 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:903-909 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1060— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1060-1066 | sdk/lib/_internal/wasm/common/compact_hash.dart:980-986 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1082— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1082-1088 | sdk/lib/_internal/wasm/common/compact_hash.dart:1002-1008 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) sdk/lib/_internal/vm_shared/lib/integers_patch.dart:73— sdk/lib/_internal/vm_shared/lib/integers_patch.dart:73-79 | sdk/lib/_internal/vm_shared/lib/integers_patch.dart:127-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:1080— sdk/lib/_internal/wasm/common/convert_patch.dart:1080-1086 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:939-945 — `sdk/lib/_internal/wasm/common/convert_patch.dart` and `sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 265 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/common/list.dart:231— sdk/lib/_internal/wasm/common/list.dart:231-237 | sdk/lib/_internal/wasm/common/list.dart:456-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/common/simd.dart:731— sdk/lib/_internal/wasm/common/simd.dart:731-737 | sdk/lib/_internal/wasm/common/simd.dart:745-751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:593— sdk/lib/_internal/wasm/common/typed_data.dart:593-599 | sdk/lib/_internal/wasm/common/typed_data.dart:662-668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:2107— sdk/lib/_internal/wasm/common/typed_data.dart:2107-2113 | sdk/lib/_internal/wasm/common/typed_data.dart:2462-2468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:515— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:515-521 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2005-2011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:524— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:524-530 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2014-2020 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:692— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:692-698 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2183-2189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link.dart:25— pkg/_fe_analyzer_shared/lib/src/util/link.dart:25-32 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart:166-173 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:101— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:101-108 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:135-142 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) pkg/dart2wasm/lib/code_generator.dart:642— pkg/dart2wasm/lib/code_generator.dart:642-649 | pkg/dart2wasm/lib/code_generator.dart:651-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart:210— sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart:210-217 | sdk/lib/_internal/js_runtime/lib/js_patch.dart:324-331 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart` and `sdk/lib/_internal/js_runtime/lib/js_patch.dart` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_string.dart:395— sdk/lib/_internal/js_dev_runtime/private/js_string.dart:395-402 | sdk/lib/_internal/js_runtime/lib/js_string.dart:371-378 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_string.dart` and `sdk/lib/_internal/js_runtime/lib/js_string.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1833— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1833-1840 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:2121-2128 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1842— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1842-1849 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:2130-2137 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) sdk/lib/_internal/js_runtime/lib/js_number.dart:200— sdk/lib/_internal/js_runtime/lib/js_number.dart:200-207 | sdk/lib/_internal/js_runtime/lib/js_number.dart:225-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:2089— sdk/lib/_internal/vm/lib/convert_patch.dart:2089-2096 | sdk/lib/_internal/vm/lib/convert_patch.dart:2110-2117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm/lib/mirrors_impl.dart:764— sdk/lib/_internal/vm/lib/mirrors_impl.dart:764-771 | sdk/lib/_internal/vm/lib/mirrors_impl.dart:993-1000 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm/lib/string_patch.dart:1089— sdk/lib/_internal/vm/lib/string_patch.dart:1089-1096 | sdk/lib/_internal/vm/lib/string_patch.dart:1111-1118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:298— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:298-305 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:315-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:331— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:331-338 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:348-355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:543— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:543-550 | sdk/lib/_internal/wasm/common/compact_hash.dart:508-515 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1104— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1104-1111 | sdk/lib/_internal/wasm/common/compact_hash.dart:1024-1031 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:2683— sdk/lib/_internal/wasm/common/convert_patch.dart:2683-2690 | sdk/lib/_internal/wasm/common/convert_patch.dart:2704-2711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:285— sdk/lib/_internal/wasm/common/typed_data.dart:285-292 | sdk/lib/_internal/wasm/common/typed_data.dart:382-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:280— sdk/lib/_internal/wasm/common/typed_data.dart:280-287 | sdk/lib/_internal/wasm/common/typed_data.dart:373-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:1061— sdk/lib/_internal/wasm/common/typed_data.dart:1061-1068 | sdk/lib/_internal/wasm/common/typed_data.dart:1139-1146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:1137— sdk/lib/_internal/wasm/common/typed_data.dart:1137-1144 | sdk/lib/_internal/wasm/common/typed_data.dart:1191-1198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:591— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:591-598 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2082-2089 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:630— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:630-637 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2121-2128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1735— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1735-1742 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1823-1830 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) pkg/kernel/lib/binary/ast_from_binary.dart:1925— pkg/kernel/lib/binary/ast_from_binary.dart:1925-1932 | pkg/kernel/lib/binary/ast_from_binary.dart:1985-1992 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) pkg/_fe_analyzer_shared/lib/src/metadata/expressions.dart:408— pkg/_fe_analyzer_shared/lib/src/metadata/expressions.dart:408-415 | pkg/_fe_analyzer_shared/lib/src/metadata/expressions.dart:432-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1965— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1965-1973 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1513-1521 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:82— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:82-90 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:125-133 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) pkg/analysis_server/tool/code_completion/completion_metrics.dart:1220— pkg/analysis_server/tool/code_completion/completion_metrics.dart:1220-1228 | pkg/analysis_server/tool/code_completion/completion_metrics.dart:1403-1411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:725— pkg/analyzer/tool/generators/ast_generator.dart:725-733 | pkg/analyzer/tool/generators/ast_generator.dart:740-748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/dart2bytecode/lib/bytecode_generator.dart:3205— pkg/dart2bytecode/lib/bytecode_generator.dart:3205-3213 | pkg/dart2bytecode/lib/bytecode_generator.dart:3903-3911 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/dart2bytecode/testcases/type_ops.dart:36— pkg/dart2bytecode/testcases/type_ops.dart:36-44 | pkg/front_end/testcases/general/vm_type_ops.dart:38-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) pkg/dart2wasm/lib/async.dart:351— pkg/dart2wasm/lib/async.dart:351-359 | pkg/dart2wasm/lib/code_generator.dart:1069-1077 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) pkg/dart2wasm/lib/async.dart:460— pkg/dart2wasm/lib/async.dart:460-468 | pkg/dart2wasm/lib/sync_star.dart:336-344 — before extracting anything, compare `pkg/dart2wasm/lib/async.dart` and `pkg/dart2wasm/lib/sync_star.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) pkg/dart2wasm/lib/types.dart:950— pkg/dart2wasm/lib/types.dart:950-958 | pkg/dart2wasm/lib/types.dart:977-985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/front_end/testcases/general/super_signature_access.dart:46— pkg/front_end/testcases/general/super_signature_access.dart:46-54 | pkg/front_end/testcases/general/super_signature_access.dart:91-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/front_end/testcases/no_such_method_forwarders/regress_53656.dart:12— pkg/front_end/testcases/no_such_method_forwarders/regress_53656.dart:12-20 | pkg/front_end/testcases/no_such_method_forwarders/regress_53656.dart:28-36 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/vm_service/tool/dart/generate_dart_common.dart:1263— pkg/vm_service/tool/dart/generate_dart_common.dart:1263-1271 | pkg/vm_service/tool/dart/generate_dart_common.dart:1303-1311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:183— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:183-191 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:183-191 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/internal_patch.dart:32— sdk/lib/_internal/js_dev_runtime/patch/internal_patch.dart:32-40 | sdk/lib/_internal/js_runtime/lib/internal_patch.dart:32-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:446— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:446-454 | sdk/lib/_internal/js_runtime/lib/js_number.dart:536-544 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:262— sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:262-270 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:232-241 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) sdk/lib/_internal/vm/lib/async_patch.dart:316— sdk/lib/_internal/vm/lib/async_patch.dart:316-324 | sdk/lib/_internal/vm/lib/async_patch.dart:343-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:1265— sdk/lib/_internal/vm/lib/convert_patch.dart:1265-1273 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1143-1151 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 193 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) sdk/lib/_internal/vm/lib/double.dart:223— sdk/lib/_internal/vm/lib/double.dart:223-231 | sdk/lib/_internal/wasm/common/boxed_double.dart:293-301 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) sdk/lib/_internal/vm/lib/string_patch.dart:1140— sdk/lib/_internal/vm/lib/string_patch.dart:1140-1148 | sdk/lib/_internal/vm/lib/string_patch.dart:1394-1402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:1019— sdk/lib/_internal/wasm/common/typed_data.dart:1019-1027 | sdk/lib/_internal/wasm/common/typed_data.dart:1105-1113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) sdk/lib/_internal/wasm/js_common/js_string.dart:109— sdk/lib/_internal/wasm/js_common/js_string.dart:109-117 | sdk/lib/_internal/wasm/js_common/js_string.dart:131-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/native_compiler/lib/back_end/arm64/assembler.dart:1620— pkg/native_compiler/lib/back_end/arm64/assembler.dart:1620-1628 | pkg/native_compiler/lib/back_end/arm64/assembler.dart:1634-1642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2018— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2018-2027 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2082-2090 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/kernel/lib/binary/ast_to_binary.dart:2899— pkg/kernel/lib/binary/ast_to_binary.dart:2899-2907 | pkg/kernel/lib/binary/ast_to_binary.dart:2941-2949 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:977— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:977-986 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:943-952 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1280— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1280-1289 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1947-1956 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_semantic_token_full_in_big_file.dart:78— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_semantic_token_full_in_big_file.dart:78-87 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file_ask_for_completion.dart:80-89 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) pkg/analyzer/tool/wolf/generate.dart:96— pkg/analyzer/tool/wolf/generate.dart:96-105 | pkg/analyzer/tool/wolf/generate.dart:110-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/dart2native/lib/macho.dart:1007— pkg/dart2native/lib/macho.dart:1007-1016 | pkg/dart2native/lib/macho.dart:1300-1309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/dart2wasm/lib/code_generator.dart:4731— pkg/dart2wasm/lib/code_generator.dart:4731-4740 | pkg/dart2wasm/lib/code_generator.dart:4743-4752 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/dart2wasm/lib/constants.dart:656— pkg/dart2wasm/lib/constants.dart:656-665 | pkg/dart2wasm/lib/constants.dart:692-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_index_full.dart:50— pkg/front_end/testcases/inference/infer_assign_to_index_full.dart:50-59 | pkg/front_end/testcases/inference_new/infer_assign_to_index_full.dart:47-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2141— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2141-2150 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:2159-2168 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:458— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:458-467 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:468-477 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart:294— sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart:294-303 | sdk/lib/_internal/js_runtime/lib/js_patch.dart:409-418 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart` and `sdk/lib/_internal/js_runtime/lib/js_patch.dart` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:493— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:493-502 | sdk/lib/_internal/js_runtime/lib/js_array.dart:679-688 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:145— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:145-154 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:110-119 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/vm/lib/array.dart:140— sdk/lib/_internal/vm/lib/array.dart:140-149 | sdk/lib/_internal/vm/lib/array.dart:152-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:42— sdk/lib/_internal/vm/lib/convert_patch.dart:42-51 | sdk/lib/_internal/wasm/common/convert_patch.dart:34-43 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/vm/lib/integers.dart:417— sdk/lib/_internal/vm/lib/integers.dart:417-426 | sdk/lib/_internal/wasm/common/boxed_int.dart:309-318 — before extracting anything, compare `sdk/lib/_internal/vm/lib/integers.dart` and `sdk/lib/_internal/wasm/common/boxed_int.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:630— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:630-639 | sdk/lib/_internal/wasm/common/compact_hash.dart:595-604 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:2219— sdk/lib/_internal/wasm/common/convert_patch.dart:2219-2228 | sdk/lib/_internal/wasm/common/convert_patch.dart:2311-2320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:640— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:640-649 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2131-2140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:780— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:780-789 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2263-2272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) sdk/lib/async/stream_impl.dart:243— sdk/lib/async/stream_impl.dart:243-252 | sdk/lib/async/stream_impl.dart:783-792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/kernel/lib/binary/ast_from_binary.dart:4495— pkg/kernel/lib/binary/ast_from_binary.dart:4495-4504 | pkg/kernel/lib/binary/ast_from_binary.dart:4514-4523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/compiler/lib/src/deferred_load/import_set.dart:285— pkg/compiler/lib/src/deferred_load/import_set.dart:285-294 | pkg/dart2wasm/lib/deferred_load/import_set.dart:279-288 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) pkg/cfg/lib/front_end/ast_to_ir.dart:1052— pkg/cfg/lib/front_end/ast_to_ir.dart:1052-1061 | pkg/cfg/lib/front_end/ast_to_ir.dart:1106-1115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/cfg/lib/front_end/ast_to_ir.dart:1747— pkg/cfg/lib/front_end/ast_to_ir.dart:1747-1756 | pkg/cfg/lib/front_end/ast_to_ir.dart:1772-1781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1940— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1940-1950 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1804-1814 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:119— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:119-129 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:153-163 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2540— pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2540-2550 | pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2616-2626 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/analysis_server/tool/instrumentation/page/stats_page.dart:205— pkg/analysis_server/tool/instrumentation/page/stats_page.dart:205-215 | pkg/analysis_server/tool/instrumentation/page/stats_page.dart:241-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:360— pkg/analyzer/tool/generators/ast_generator.dart:360-370 | pkg/analyzer/tool/generators/ast_generator.dart:376-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:1218— pkg/analyzer/tool/generators/ast_generator.dart:1218-1228 | pkg/analyzer/tool/generators/ast_generator.dart:1263-1273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/dart2bytecode/lib/declarations.dart:520— pkg/dart2bytecode/lib/declarations.dart:520-530 | pkg/dart2bytecode/lib/declarations.dart:771-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/dart2bytecode/lib/declarations.dart:750— pkg/dart2bytecode/lib/declarations.dart:750-760 | pkg/dart2bytecode/lib/declarations.dart:1203-1213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/dart2js_info/lib/binary_serialization.dart:320— pkg/dart2js_info/lib/binary_serialization.dart:320-330 | pkg/dart2js_info/lib/json_info_codec.dart:87-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) pkg/dart2wasm/lib/async.dart:294— pkg/dart2wasm/lib/async.dart:294-304 | pkg/dart2wasm/lib/sync_star.dart:236-246 — before extracting anything, compare `pkg/dart2wasm/lib/async.dart` and `pkg/dart2wasm/lib/sync_star.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) pkg/dart2wasm/lib/transformers.dart:1281— pkg/dart2wasm/lib/transformers.dart:1281-1291 | pkg/dart2wasm/lib/transformers.dart:1436-1446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/front_end/testcases/general/missing_static_super.dart:8— pkg/front_end/testcases/general/missing_static_super.dart:8-18 | pkg/front_end/testcases/general/missing_static_super.dart:34-44 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/front_end/testcases/general/missing_static_super.dart:20— pkg/front_end/testcases/general/missing_static_super.dart:20-30 | pkg/front_end/testcases/general/missing_static_super.dart:46-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:28— pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:28-38 | pkg/front_end/testcases/inference_new/infer_assign_to_property_upwards.dart:28-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) pkg/front_end/tool/bench_maker.dart:476— pkg/front_end/tool/bench_maker.dart:476-486 | pkg/front_end/tool/bench_maker.dart:505-515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/kernel/lib/src/bounds_checks.dart:125— pkg/kernel/lib/src/bounds_checks.dart:125-135 | pkg/kernel/lib/type_algebra.dart:724-734 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) pkg/kernel/lib/type_algebra.dart:977— pkg/kernel/lib/type_algebra.dart:977-987 | pkg/kernel/lib/type_algebra.dart:1328-1338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/kernel/lib/type_algebra.dart:1031— pkg/kernel/lib/type_algebra.dart:1031-1041 | pkg/kernel/lib/type_algebra.dart:1382-1392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:135— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:135-145 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:135-145 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:290— sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:290-300 | sdk/lib/_internal/js_runtime/lib/js_helper.dart:619-629 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_helper.dart` and `sdk/lib/_internal/js_runtime/lib/js_helper.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:469— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:469-479 | sdk/lib/_internal/js_runtime/lib/js_number.dart:556-566 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:135— sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:135-145 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:178-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:687— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:687-697 | sdk/lib/_internal/wasm/common/compact_hash.dart:644-654 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) sdk/lib/_internal/wasm/common/int_patch.dart:18— sdk/lib/_internal/wasm/common/int_patch.dart:18-28 | sdk/lib/_internal/wasm/common/int_patch.dart:37-47 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:1042— sdk/lib/_internal/wasm/common/typed_data.dart:1042-1052 | sdk/lib/_internal/wasm/common/typed_data.dart:1112-1122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2109— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2109-2120 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1373-1384 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2416— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2416-2427 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1631-1642 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:206— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:206-217 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:32-43 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:79— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:79-90 | pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:290-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:255— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:255-266 | pkg/front_end/tool/fuzz/analyzer_helper.dart:468-479 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart` and `pkg/front_end/tool/fuzz/analyzer_helper.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) pkg/dart2bytecode/lib/assembler.dart:222— pkg/dart2bytecode/lib/assembler.dart:222-233 | pkg/dart2bytecode/lib/assembler.dart:243-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pkg/dart2bytecode/lib/bytecode_serialization.dart:242— pkg/dart2bytecode/lib/bytecode_serialization.dart:242-253 | pkg/native_compiler/lib/snapshot/snapshot.dart:2300-2311 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) pkg/dart2wasm/lib/code_generator.dart:352— pkg/dart2wasm/lib/code_generator.dart:352-363 | pkg/dart2wasm/lib/code_generator.dart:5104-5115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pkg/dart2wasm/lib/constants.dart:2175— pkg/dart2wasm/lib/constants.dart:2175-2186 | pkg/dart2wasm/lib/constants.dart:2206-2217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pkg/dart2wasm/lib/transformers.dart:673— pkg/dart2wasm/lib/transformers.dart:673-684 | pkg/dart2wasm/lib/transformers.dart:840-851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:79— pkg/front_end/testcases/general/pure_index_expressions.dart:79-90 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:91-102 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:183— pkg/front_end/testcases/general/pure_index_expressions.dart:183-194 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:201-212 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:490— sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:490-501 | sdk/lib/_internal/js_runtime/lib/async_patch.dart:219-230 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart` and `sdk/lib/_internal/js_runtime/lib/async_patch.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:407— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:407-418 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:410-421 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart:96— sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart:96-107 | sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart:129-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_string.dart:321— sdk/lib/_internal/js_dev_runtime/private/js_string.dart:321-332 | sdk/lib/_internal/js_runtime/lib/js_string.dart:302-313 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_string.dart` and `sdk/lib/_internal/js_runtime/lib/js_string.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:103— sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:103-114 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:154-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1247— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1247-1258 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1537-1548 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:2032— sdk/lib/_internal/vm/lib/convert_patch.dart:2032-2043 | sdk/lib/_internal/wasm/common/convert_patch.dart:2600-2611 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm/lib/growable_array.dart:160— sdk/lib/_internal/vm/lib/growable_array.dart:160-171 | sdk/lib/_internal/vm/lib/growable_array.dart:174-185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm/lib/string_patch.dart:1162— sdk/lib/_internal/vm/lib/string_patch.dart:1162-1173 | sdk/lib/_internal/vm/lib/string_patch.dart:1195-1206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm/lib/string_patch.dart:1460— sdk/lib/_internal/vm/lib/string_patch.dart:1460-1471 | sdk/lib/_internal/wasm/common/string_helper.dart:64-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:273— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:273-284 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:492-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:405— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:405-416 | sdk/lib/_internal/wasm/common/compact_hash.dart:336-347 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1068— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1068-1079 | sdk/lib/_internal/wasm/common/compact_hash.dart:988-999 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1519— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1519-1531 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1484-1496 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2570— pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2570-2582 | pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2646-2658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/dart2bytecode/lib/declarations.dart:947— pkg/dart2bytecode/lib/declarations.dart:947-959 | pkg/dart2bytecode/lib/declarations.dart:1292-1304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/dart2bytecode/lib/declarations.dart:992— pkg/dart2bytecode/lib/declarations.dart:992-1004 | pkg/dart2bytecode/lib/declarations.dart:1312-1324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/dart2bytecode/lib/object_table.dart:1949— pkg/dart2bytecode/lib/object_table.dart:1949-1961 | pkg/dart2bytecode/lib/object_table.dart:1965-1977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/dart2wasm/lib/code_generator.dart:1458— pkg/dart2wasm/lib/code_generator.dart:1458-1470 | pkg/dart2wasm/lib/state_machine.dart:985-997 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 2) pkg/dart2wasm/lib/constants.dart:1188— pkg/dart2wasm/lib/constants.dart:1188-1200 | pkg/dart2wasm/lib/constants.dart:1226-1238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/dart2wasm/lib/transformers.dart:1292— pkg/dart2wasm/lib/transformers.dart:1292-1304 | pkg/dart2wasm/lib/transformers.dart:1445-1457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:16— pkg/front_end/testcases/general/pure_index_expressions.dart:16-28 | pkg/front_end/testcases/general/pure_index_expressions.dart:47-59 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:94— pkg/front_end/testcases/general/pure_index_expressions.dart:94-106 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:107-119 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:127— pkg/front_end/testcases/general/pure_index_expressions.dart:127-139 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:142-154 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:167— pkg/front_end/testcases/general/pure_index_expressions.dart:167-179 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:184-196 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) pkg/front_end/testcases/general/pure_index_expressions.dart:198— pkg/front_end/testcases/general/pure_index_expressions.dart:198-210 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:217-229 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_index_full.dart:34— pkg/front_end/testcases/inference/infer_assign_to_index_full.dart:34-46 | pkg/front_end/testcases/inference_new/infer_assign_to_index_full.dart:31-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) pkg/front_end/tool/bench_maker.dart:115— pkg/front_end/tool/bench_maker.dart:115-127 | pkg/front_end/tool/bench_maker.dart:134-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) pkg/kernel/lib/type_checker.dart:660— pkg/kernel/lib/type_checker.dart:660-672 | pkg/kernel/lib/type_checker.dart:688-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) tools/generate_uri_parser_tables.dart:445— tools/generate_uri_parser_tables.dart:445-457 | tools/generate_uri_parser_tables.dart:460-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:928— sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:928-940 | sdk/lib/_internal/js_runtime/lib/async_patch.dart:646-658 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart` and `sdk/lib/_internal/js_runtime/lib/async_patch.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:517— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:517-529 | sdk/lib/_internal/js_runtime/lib/js_number.dart:608-620 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_string.dart:337— sdk/lib/_internal/js_dev_runtime/private/js_string.dart:337-349 | sdk/lib/_internal/js_runtime/lib/js_string.dart:317-329 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_string.dart` and `sdk/lib/_internal/js_runtime/lib/js_string.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:716— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:716-728 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1180-1192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) sdk/lib/_internal/js_runtime/lib/core_patch.dart:672— sdk/lib/_internal/js_runtime/lib/core_patch.dart:672-684 | sdk/lib/_internal/wasm/common/errors_patch.dart:190-202 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) sdk/lib/_internal/wasm/common/typed_data.dart:2055— sdk/lib/_internal/wasm/common/typed_data.dart:2055-2067 | sdk/lib/_internal/wasm/common/typed_data.dart:2926-2938 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) sdk/lib/_internal/wasm/js/string_patch.dart:23— sdk/lib/_internal/wasm/js/string_patch.dart:23-35 | sdk/lib/_internal/wasm/standalone/string_patch.dart:21-33 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 2) sdk/lib/_internal/wasm/js/string_patch.dart:39— sdk/lib/_internal/wasm/js/string_patch.dart:39-51 | sdk/lib/_internal/wasm/standalone/string_patch.dart:34-46 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (6 lines × 2) pkg/front_end/testcases/general/constants/potentially_constant_type.dart:95— pkg/front_end/testcases/general/constants/potentially_constant_type.dart:95-100 | pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:62-67 — before extracting anything, compare `pkg/front_end/testcases/general/constants/potentially_constant_type.dart` and `pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1608— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1608-1613 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1896-1901 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1752— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1752-1757 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1763-1768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) sdk/lib/_internal/vm/lib/mirrors_impl.dart:757— sdk/lib/_internal/vm/lib/mirrors_impl.dart:757-762 | sdk/lib/_internal/vm/lib/mirrors_impl.dart:986-991 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:720— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:720-725 | sdk/lib/_internal/wasm/common/compact_hash.dart:678-683 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/wasm/js/string_patch.dart:192— sdk/lib/_internal/wasm/js/string_patch.dart:192-197 | sdk/lib/_internal/wasm/standalone/string_patch.dart:148-153 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (6 lines × 2) pkg/analyzer/lib/src/binary/string_table.dart:119— pkg/analyzer/lib/src/binary/string_table.dart:119-124 | pkg/kernel/lib/binary/ast_from_binary.dart:339-344 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) sdk/lib/internal/internal.dart:216— sdk/lib/internal/internal.dart:216-221 | sdk/lib/internal/internal.dart:226-231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pkg/_fe_analyzer_shared/lib/src/type_inference/shared_inference_log.dart:635— pkg/_fe_analyzer_shared/lib/src/type_inference/shared_inference_log.dart:635-640 | pkg/_fe_analyzer_shared/lib/src/type_inference/shared_inference_log.dart:816-821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:229— pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:229-234 | pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart:177-182 — before extracting anything, compare `pkg/analysis_server/lib/src/services/correction/dart/create_class.dart` and `pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:453— pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:453-458 | pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:464-469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pkg/analyzer/lib/src/utilities/string_search.dart:89— pkg/analyzer/lib/src/utilities/string_search.dart:89-94 | pkg/analyzer/lib/src/utilities/string_search.dart:127-132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pkg/compiler/lib/src/js_model/closure.dart:1235— pkg/compiler/lib/src/js_model/closure.dart:1235-1240 | pkg/compiler/lib/src/js_model/records.dart:382-387 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) pkg/kernel/lib/src/replacement_visitor.dart:196— pkg/kernel/lib/src/replacement_visitor.dart:196-201 | pkg/kernel/lib/src/unaliasing.dart:70-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) pkg/observatory/lib/src/elements/heap_snapshot.dart:1179— pkg/observatory/lib/src/elements/heap_snapshot.dart:1179-1184 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1198-1203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pkg/front_end/testcases/dartdevc/factory_patch/patch_lib.dart:14— pkg/front_end/testcases/dartdevc/factory_patch/patch_lib.dart:14-19 | pkg/front_end/testcases/general/factory_patch/patch_lib.dart:14-19 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) pkg/front_end/testcases/offsets/switch_encoding.dart:18— pkg/front_end/testcases/offsets/switch_encoding.dart:18-23 | pkg/front_end/testcases/patterns/switch_encoding.dart:18-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link.dart:108— pkg/_fe_analyzer_shared/lib/src/util/link.dart:108-113 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart:42-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:136— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:136-141 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:112-117 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) pkg/front_end/testcases/constructor_tearoffs/new_as_selector.dart:20— pkg/front_end/testcases/constructor_tearoffs/new_as_selector.dart:20-25 | pkg/front_end/testcases/general/new_as_selector.dart:22-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) sdk/lib/_http/http_impl.dart:354— sdk/lib/_http/http_impl.dart:354-359 | sdk/lib/internal/bytes_builder.dart:138-143 — before extracting anything, compare `sdk/lib/_http/http_impl.dart` and `sdk/lib/internal/bytes_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1869— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1869-1874 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1887-1892 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:199— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:199-204 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:199-204 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:548— sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:548-553 | sdk/lib/_internal/js_runtime/lib/js_helper.dart:934-939 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_helper.dart` and `sdk/lib/_internal/js_runtime/lib/js_helper.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:106— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:106-111 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:121-126 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2269— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2269-2282 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1318-1331 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2284— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2284-2297 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1333-1346 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1402— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1402-1415 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1498-1511 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2444— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2444-2457 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1655-1668 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1570— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1570-1583 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1709-1722 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1417— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1417-1430 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1749-1762 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:143— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:143-156 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:97-110 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) pkg/analyzer/tool/ast/generate.dart:214— pkg/analyzer/tool/ast/generate.dart:214-227 | pkg/analyzer/tool/ast/generate.dart:253-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) pkg/analyzer/tool/ast/generate.dart:1202— pkg/analyzer/tool/ast/generate.dart:1202-1215 | pkg/analyzer/tool/ast/generate.dart:1232-1245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) pkg/front_end/testcases/general/flutter_issue64155.dart:6— pkg/front_end/testcases/general/flutter_issue64155.dart:6-19 | pkg/front_end/testcases/nnbd/flutter_issue64155.dart:6-19 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) pkg/front_end/testcases/general/type_variable_uses.dart:8— pkg/front_end/testcases/general/type_variable_uses.dart:8-21 | pkg/front_end/testcases/general/type_variable_uses.dart:30-43 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) pkg/front_end/testcases/nnbd/pure_index_expressions.dart:23— pkg/front_end/testcases/nnbd/pure_index_expressions.dart:23-36 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:56-69 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) pkg/front_end/lib/src/base/incremental_compiler.dart:2158— pkg/front_end/lib/src/base/incremental_compiler.dart:2158-2171 | pkg/front_end/tool/dart_doctest_impl.dart:1128-1141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) pkg/kernel/lib/class_hierarchy.dart:1026— pkg/kernel/lib/class_hierarchy.dart:1026-1039 | pkg/kernel/lib/class_hierarchy.dart:1041-1054 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) pkg/kernel/lib/type_algebra.dart:993— pkg/kernel/lib/type_algebra.dart:993-1006 | pkg/kernel/lib/type_algebra.dart:1344-1357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:162— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:162-175 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:162-175 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:224— sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:224-237 | sdk/lib/_internal/js_runtime/lib/math_patch.dart:216-229 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart` and `sdk/lib/_internal/js_runtime/lib/math_patch.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:505— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:505-518 | sdk/lib/_internal/js_runtime/lib/js_array.dart:691-704 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:322— sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:322-335 | sdk/lib/_internal/js_runtime/lib/js_helper.dart:650-663 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_helper.dart` and `sdk/lib/_internal/js_runtime/lib/js_helper.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:196— sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:196-209 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:268-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:1807— sdk/lib/_internal/vm/lib/convert_patch.dart:1807-1820 | sdk/lib/_internal/vm/lib/convert_patch.dart:1871-1884 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) sdk/lib/_internal/vm/lib/internal_patch.dart:121— sdk/lib/_internal/vm/lib/internal_patch.dart:121-134 | sdk/lib/_internal/wasm/common/internal_patch.dart:19-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:614— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:614-627 | sdk/lib/_internal/wasm/common/compact_hash.dart:579-592 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) sdk/lib/_internal/wasm/js_common/js_string.dart:224— sdk/lib/_internal/wasm/js_common/js_string.dart:224-237 | sdk/lib/_internal/wasm/standalone/embedder_string.dart:166-179 — before extracting anything, compare `sdk/lib/_internal/wasm/js_common/js_string.dart` and `sdk/lib/_internal/wasm/standalone/embedder_string.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) sdk/lib/_internal/wasm/js_common/js_string.dart:259— sdk/lib/_internal/wasm/js_common/js_string.dart:259-272 | sdk/lib/_internal/wasm/standalone/embedder_string.dart:200-213 — before extracting anything, compare `sdk/lib/_internal/wasm/js_common/js_string.dart` and `sdk/lib/_internal/wasm/standalone/embedder_string.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) pkg/front_end/testcases/general/type_variable_uses.dart:23— pkg/front_end/testcases/general/type_variable_uses.dart:23-27 | pkg/front_end/testcases/general/type_variable_uses.dart:45-49 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:190— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:190-194 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:205-209 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:266— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:266-270 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:293-297 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:160— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:160-164 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:731-735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) sdk/lib/_internal/vm/lib/string_patch.dart:1261— sdk/lib/_internal/vm/lib/string_patch.dart:1261-1265 | sdk/lib/_internal/vm/lib/string_patch.dart:1292-1296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) sdk/lib/_internal/vm/lib/typed_data_patch.dart:4149— sdk/lib/_internal/vm/lib/typed_data_patch.dart:4149-4153 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:4170-4174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:61— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:61-65 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:86-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:399— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:399-403 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:411-415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:723— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:723-727 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:741-745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/literal_entry_info_impl.dart:93— pkg/_fe_analyzer_shared/lib/src/parser/literal_entry_info_impl.dart:93-98 | pkg/_fe_analyzer_shared/lib/src/parser/literal_entry_info_impl.dart:201-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/analyzer_plugin/lib/src/utilities/navigation/document_links.dart:61— pkg/analyzer_plugin/lib/src/utilities/navigation/document_links.dart:61-65 | pkg/analyzer_plugin/lib/src/utilities/navigation/document_links.dart:69-73 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/compiler/lib/src/constants/values.dart:1038— pkg/compiler/lib/src/constants/values.dart:1038-1042 | pkg/compiler/lib/src/constants/values.dart:1056-1060 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/compiler/lib/src/ir/impact_data.dart:635— pkg/compiler/lib/src/ir/impact_data.dart:635-639 | pkg/compiler/lib/src/ir/impact_data.dart:741-745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart:110— pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart:110-114 | pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart:116-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/dartdev/lib/src/utils.dart:443— pkg/dartdev/lib/src/utils.dart:443-447 | pkg/dartdev/lib/src/utils.dart:455-459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2362— pkg/dev_compiler/lib/src/kernel/compiler.dart:2362-2366 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2662-2666 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) pkg/kernel/lib/src/replacement_visitor.dart:352— pkg/kernel/lib/src/replacement_visitor.dart:352-356 | pkg/kernel/lib/src/replacement_visitor.dart:386-391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/observatory/lib/src/elements/debugger.dart:823— pkg/observatory/lib/src/elements/debugger.dart:823-828 | pkg/observatory/lib/src/elements/debugger.dart:916-920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) pkg/observatory/lib/src/elements/isolate_view.dart:110— pkg/observatory/lib/src/elements/isolate_view.dart:110-114 | pkg/observatory/lib/src/elements/objectstore_view.dart:78-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) pkg/observatory/lib/src/elements/library_view.dart:114— pkg/observatory/lib/src/elements/library_view.dart:114-118 | pkg/observatory/lib/src/elements/script_view.dart:97-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2037— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2037-2041 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:197-201 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1926— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1926-1930 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1798-1802 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2631— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2631-2635 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:2139-2143 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link.dart:70— pkg/_fe_analyzer_shared/lib/src/util/link.dart:70-74 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link.dart:153-157 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_index_super.dart:61— pkg/front_end/testcases/inference/infer_assign_to_index_super.dart:61-65 | pkg/front_end/testcases/inference_new/infer_assign_to_index_super.dart:61-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1610— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1610-1624 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1225-1239 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1533— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1533-1547 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1686-1700 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1812— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1812-1826 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1899-1913 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:190— pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart:190-204 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart:63-77 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/link_implementation.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/analysis_server/tool/code_completion/relevance_metrics.dart:1192— pkg/analysis_server/tool/code_completion/relevance_metrics.dart:1192-1207 | pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:1518-1532 — before extracting anything, compare `pkg/analysis_server/tool/code_completion/relevance_metrics.dart` and `pkg/analysis_server/tool/code_completion/relevance_table_generator.dart` as WHOLE FILES: this scan already matched 29 separate duplicated blocks between them, totalling at least 312 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2552— pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2552-2566 | pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2628-2642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/dart2wasm/lib/translator.dart:3707— pkg/dart2wasm/lib/translator.dart:3707-3721 | pkg/dart2wasm/lib/translator.dart:3753-3767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_property_super_upwards.dart:61— pkg/front_end/testcases/inference/infer_assign_to_property_super_upwards.dart:61-75 | pkg/front_end/testcases/inference_new/infer_assign_to_property_super_upwards.dart:61-75 — `pkg/front_end/testcases/inference/infer_assign_to_property_super_upwards.dart` and `pkg/front_end/testcases/inference_new/infer_assign_to_property_super_upwards.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 49 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 2) pkg/kernel/lib/type_algebra.dart:961— pkg/kernel/lib/type_algebra.dart:961-975 | pkg/kernel/lib/type_algebra.dart:1312-1326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:314— sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:314-328 | sdk/lib/_internal/js_runtime/lib/math_patch.dart:301-315 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart` and `sdk/lib/_internal/js_runtime/lib/math_patch.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1310— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1310-1324 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:246-260 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:571— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:571-585 | sdk/lib/_internal/wasm/common/compact_hash.dart:536-550 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1269— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1269-1283 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1297-1311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/kernel/lib/binary/ast_from_binary.dart:1672— pkg/kernel/lib/binary/ast_from_binary.dart:1672-1686 | pkg/kernel/lib/binary/ast_from_binary.dart:1746-1760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/dart2js_info/lib/src/binary/sink.dart:335— pkg/dart2js_info/lib/src/binary/sink.dart:335-349 | pkg/kernel/lib/binary/ast_to_binary.dart:3829-3843 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) sdk/lib/collection/list.dart:154— sdk/lib/collection/list.dart:154-168 | sdk/lib/internal/iterable.dart:139-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) sdk/lib/io/directory_impl.dart:144— sdk/lib/io/directory_impl.dart:144-158 | sdk/lib/io/directory_impl.dart:173-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:156— pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:156-170 | pkg/analyzer_plugin/lib/protocol/protocol.dart:186-200 — before extracting anything, compare `pkg/analysis_server_client/lib/src/protocol/protocol_base.dart` and `pkg/analyzer_plugin/lib/protocol/protocol.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart:83— pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart:83-97 | pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:102-116 — before extracting anything, compare `pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart` and `pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart:110— pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart:110-124 | pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:133-147 — before extracting anything, compare `pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart` and `pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) pkg/analyzer/lib/src/analysis_options/analysis_options.dart:343— pkg/analyzer/lib/src/analysis_options/analysis_options.dart:343-357 | pkg/analyzer/lib/src/analysis_options/analysis_options.dart:374-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/analyzer/lib/src/dart/analysis/index.dart:830— pkg/analyzer/lib/src/dart/analysis/index.dart:830-844 | pkg/analyzer/lib/src/dart/analysis/index.dart:1156-1170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:5437— pkg/analyzer/lib/src/dart/ast/ast.dart:5437-5451 | pkg/analyzer/lib/src/dart/ast/ast.dart:47174-47188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:8377— pkg/analyzer/lib/src/dart/ast/ast.dart:8377-8391 | pkg/analyzer/lib/src/dart/ast/ast.dart:8396-8410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:16706— pkg/analyzer/lib/src/dart/ast/ast.dart:16706-16720 | pkg/analyzer/lib/src/dart/ast/ast.dart:16725-16739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/kernel/lib/type_algebra.dart:894— pkg/kernel/lib/type_algebra.dart:894-910 | pkg/kernel/lib/type_algebra.dart:1452-1468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) sdk/lib/_http/http_impl.dart:304— sdk/lib/_http/http_impl.dart:304-320 | sdk/lib/internal/bytes_builder.dart:88-104 — before extracting anything, compare `sdk/lib/_http/http_impl.dart` and `sdk/lib/internal/bytes_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:608— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:608-624 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:598-614 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/vm_shared/lib/collection_patch.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) sdk/lib/_internal/vm/lib/integers.dart:290— sdk/lib/_internal/vm/lib/integers.dart:290-306 | sdk/lib/_internal/wasm/common/boxed_int.dart:265-281 — before extracting anything, compare `sdk/lib/_internal/vm/lib/integers.dart` and `sdk/lib/_internal/wasm/common/boxed_int.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:596— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:596-612 | sdk/lib/_internal/wasm/common/compact_hash.dart:561-577 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) sdk/lib/_internal/wasm/js/string_patch.dart:104— sdk/lib/_internal/wasm/js/string_patch.dart:104-120 | sdk/lib/_internal/wasm/standalone/string_patch.dart:66-82 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (17 lines × 2) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:652— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:652-668 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2143-2159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1027— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1027-1043 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1185-1201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5938— pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5938-5954 | pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5969-5985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8047— pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8047-8063 | pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8070-8086 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart:217— pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart:217-233 | pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart:54-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:18939— pkg/analyzer/lib/src/dart/ast/ast.dart:18939-18955 | pkg/analyzer/lib/src/dart/ast/ast.dart:18961-18977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:22661— pkg/analyzer/lib/src/dart/ast/ast.dart:22661-22677 | pkg/analyzer/lib/src/dart/ast/ast.dart:23156-23172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:22746— pkg/analyzer/lib/src/dart/ast/ast.dart:22746-22762 | pkg/analyzer/lib/src/dart/ast/ast.dart:23241-23257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:22764— pkg/analyzer/lib/src/dart/ast/ast.dart:22764-22780 | pkg/analyzer/lib/src/dart/ast/ast.dart:23259-23275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:37227— pkg/analyzer/lib/src/dart/ast/ast.dart:37227-37243 | pkg/analyzer/lib/src/dart/ast/ast.dart:37254-37270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:41281— pkg/analyzer/lib/src/dart/ast/ast.dart:41281-41297 | pkg/analyzer/lib/src/dart/ast/ast.dart:50960-50976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:41299— pkg/analyzer/lib/src/dart/ast/ast.dart:41299-41315 | pkg/analyzer/lib/src/dart/ast/ast.dart:50978-50994 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:41375— pkg/analyzer/lib/src/dart/ast/ast.dart:41375-41391 | pkg/analyzer/lib/src/dart/ast/ast.dart:51054-51070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:361— pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:361-377 | pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:434-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/element/subtype.dart:433— pkg/analyzer/lib/src/dart/element/subtype.dart:433-449 | pkg/analyzer/lib/src/dart/element/subtype.dart:461-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:258— pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:258-275 | pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:285-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1025— pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1025-1041 | pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1046-1062 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/fasta/ast_builder.dart:5555— pkg/analyzer/lib/src/fasta/ast_builder.dart:5555-5571 | pkg/analyzer/lib/src/fasta/ast_builder.dart:5635-5651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) pkg/analyzer/lib/src/generated/error_verifier.dart:2131— pkg/analyzer/lib/src/generated/error_verifier.dart:2131-2147 | pkg/analyzer/lib/src/generated/error_verifier.dart:2166-2182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:541— pkg/analyzer/tool/generators/ast_generator.dart:541-556 | pkg/analyzer/tool/generators/ast_generator.dart:585-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_property_full.dart:26— pkg/front_end/testcases/inference/infer_assign_to_property_full.dart:26-41 | pkg/front_end/testcases/inference_new/infer_assign_to_property_full.dart:24-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:403— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:403-418 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:420-435 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:205— sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:205-220 | sdk/lib/_internal/js_runtime/lib/math_patch.dart:198-213 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart` and `sdk/lib/_internal/js_runtime/lib/math_patch.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:213— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:213-228 | sdk/lib/_internal/js_runtime/lib/js_number.dart:251-266 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:26— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:26-41 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:13-28 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/vm_shared/lib/collection_patch.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) pkg/analysis_server_plugin/lib/edit/dart/correction_producer.dart:276— pkg/analysis_server_plugin/lib/edit/dart/correction_producer.dart:276-291 | pkg/analysis_server_plugin/lib/edit/dart/correction_producer.dart:306-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:137— pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:137-152 | pkg/analyzer_plugin/lib/protocol/protocol.dart:167-182 — before extracting anything, compare `pkg/analysis_server_client/lib/src/protocol/protocol_base.dart` and `pkg/analyzer_plugin/lib/protocol/protocol.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:208— pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:208-223 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/map.dart:52-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) pkg/analysis_server/lib/src/analysis_server.dart:1275— pkg/analysis_server/lib/src/analysis_server.dart:1275-1290 | pkg/analysis_server/lib/src/analysis_server.dart:1306-1321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart:52— pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart:52-67 | pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart:65-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/convert_to_constant_pattern.dart:22— pkg/analysis_server/lib/src/services/correction/dart/convert_to_constant_pattern.dart:22-37 | pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_pattern.dart:22-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:5531— pkg/analyzer/lib/src/dart/ast/ast.dart:5531-5546 | pkg/analyzer/lib/src/dart/ast/ast.dart:47268-47283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:14982— pkg/analyzer/lib/src/dart/ast/ast.dart:14982-14997 | pkg/analyzer/lib/src/dart/ast/ast.dart:31608-31623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:25552— pkg/analyzer/lib/src/dart/ast/ast.dart:25552-25567 | pkg/analyzer/lib/src/dart/ast/ast.dart:26206-26221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/dart/constant/value.dart:2646— pkg/analyzer/lib/src/dart/constant/value.dart:2646-2661 | pkg/analyzer/lib/src/dart/constant/value.dart:3048-3063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart:154— pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart:154-169 | pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart:173-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:1060— pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:1060-1075 | pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:1083-1098 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/error/inheritance_override.dart:62— pkg/analyzer/lib/src/error/inheritance_override.dart:62-77 | pkg/analyzer/lib/src/error/inheritance_override.dart:106-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:547— pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:547-562 | pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:1887-1902 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:564— pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:564-579 | pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:1905-1920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pkg/analyzer_cli/lib/src/error_formatter.dart:501— pkg/analyzer_cli/lib/src/error_formatter.dart:501-516 | pkg/dartdev/lib/src/commands/analyze.dart:631-646 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) pkg/compiler/lib/src/js/size_estimator.dart:264— pkg/compiler/lib/src/js/size_estimator.dart:264-279 | pkg/js_ast/lib/src/printer.dart:523-538 — before extracting anything, compare `pkg/compiler/lib/src/js/size_estimator.dart` and `pkg/js_ast/lib/src/printer.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) pkg/dev_compiler/lib/src/js_ast/builder.dart:704— pkg/dev_compiler/lib/src/js_ast/builder.dart:704-719 | pkg/js_ast/lib/src/builder.dart:622-637 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/builder.dart` and `pkg/js_ast/lib/src/builder.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 189 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5889— pkg/dev_compiler/lib/src/kernel/compiler.dart:5889-5904 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6542-6557 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
+ 26 more in this group — see findings.md.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×44
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2352— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2352-2400 | pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2402-2470 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1575-1619 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1621-1679 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:157— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:157-167 | pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:169-179 | pkg/front_end/tool/fuzz/analyzer_helper.dart:397-407 | pkg/front_end/tool/fuzz/analyzer_helper.dart:409-419 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/front_end/testcases/general/lookup.dart:68— pkg/front_end/testcases/general/lookup.dart:68-111 | pkg/front_end/testcases/general/lookup.dart:113-158 | pkg/front_end/testcases/general/lookup.dart:160-204 | pkg/front_end/testcases/general/lookup.dart:206-250 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/front_end/testcases/general/lookup.dart:358— pkg/front_end/testcases/general/lookup.dart:358-401 | pkg/front_end/testcases/general/lookup.dart:405-450 | pkg/front_end/testcases/general/lookup.dart:452-496 | pkg/front_end/testcases/general/lookup.dart:498-542 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/front_end/testcases/general/pure_index_expressions.dart:30— pkg/front_end/testcases/general/pure_index_expressions.dart:30-44 | pkg/front_end/testcases/general/pure_index_expressions.dart:61-75 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:38-53 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:71-86 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:28— pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:28-40 | pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:47-55 | pkg/front_end/testcases/inference_new/infer_assign_to_property_upwards.dart:28-40 | pkg/front_end/testcases/inference_new/infer_assign_to_property_upwards.dart:47-55 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:39— pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:39-55 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:117-133 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:195-211 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:231-243 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:583— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:583-598 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:579-594 | sdk/lib/_internal/wasm/js_common/string_buffer_patch.dart:57-76 | sdk/lib/_internal/wasm/js_compatibility/string_buffer_patch.dart:43-62 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/patch/isolate_patch.dart:45— sdk/lib/_internal/js_dev_runtime/patch/isolate_patch.dart:45-60 | sdk/lib/_internal/js_runtime/lib/isolate_patch.dart:57-74 | sdk/lib/_internal/vm/lib/isolate_patch.dart:432-524 | sdk/lib/_internal/wasm/common/isolate_patch.dart:54-71 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:618— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:618-627 | sdk/lib/_internal/js_runtime/lib/js_number.dart:709-719 | sdk/lib/_internal/vm/lib/integers.dart:527-534 | sdk/lib/_internal/wasm/common/boxed_int.dart:421-428 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1707— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1707-1715 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1717-1725 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1995-2003 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:2005-2013 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart:290— sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart:290-317 | sdk/lib/_internal/js_runtime/lib/regexp_helper.dart:306-333 | sdk/lib/_internal/wasm/js_common/regexp_helper.dart:271-303 | sdk/lib/_internal/wasm/standalone/regexp.dart:191-219 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:595— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:595-603 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:282-290 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:500-508 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:521-533 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/growable_array.dart:611— sdk/lib/_internal/vm/lib/growable_array.dart:611-622 | sdk/lib/_internal/vm/lib/growable_array.dart:624-636 | sdk/lib/_internal/vm/lib/growable_array.dart:638-651 | sdk/lib/_internal/vm/lib/growable_array.dart:653-676 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:2575— sdk/lib/_internal/vm/lib/typed_data_patch.dart:2575-2586 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:2645-2656 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:4581-4592 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:4648-4659 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/wasm/common/typed_data.dart:662— sdk/lib/_internal/wasm/common/typed_data.dart:662-674 | sdk/lib/_internal/wasm/common/typed_data.dart:757-781 | sdk/lib/_internal/wasm/common/typed_data.dart:865-877 | sdk/lib/_internal/wasm/common/typed_data.dart:937-961 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) sdk/lib/_internal/wasm/common/typed_data.dart:2596— sdk/lib/_internal/wasm/common/typed_data.dart:2596-2613 | sdk/lib/_internal/wasm/common/typed_data.dart:2660-2677 | sdk/lib/_internal/wasm/common/typed_data.dart:2724-2741 | sdk/lib/_internal/wasm/common/typed_data.dart:2788-2805 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/native_compiler/lib/snapshot/snapshot.dart:1958— pkg/native_compiler/lib/snapshot/snapshot.dart:1958-1967 | pkg/native_compiler/lib/snapshot/snapshot.dart:2010-2019 | pkg/native_compiler/lib/snapshot/snapshot.dart:2068-2077 | pkg/native_compiler/lib/snapshot/snapshot.dart:2142-2151 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:71— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:71-115 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:297-337 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1308-1355 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1583-1629 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:239— pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:239-261 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:278-296 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:313-329 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:465-481 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analysis_server/lib/src/status/pages/assists_page.dart:27— pkg/analysis_server/lib/src/status/pages/assists_page.dart:27-66 | pkg/analysis_server/lib/src/status/pages/code_completion_page.dart:28-66 | pkg/analysis_server/lib/src/status/pages/fixes_page.dart:27-66 | pkg/analysis_server/lib/src/status/pages/refactorings_page.dart:28-67 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analyzer/lib/src/dart/ast/ast.dart:6175— pkg/analyzer/lib/src/dart/ast/ast.dart:6175-6187 | pkg/analyzer/lib/src/dart/ast/ast.dart:14684-14696 | pkg/analyzer/lib/src/dart/ast/ast.dart:15420-15432 | pkg/analyzer/lib/src/dart/ast/ast.dart:57207-57219 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analyzer/lib/src/dart/ast/ast.dart:6242— pkg/analyzer/lib/src/dart/ast/ast.dart:6242-6254 | pkg/analyzer/lib/src/dart/ast/ast.dart:14758-14770 | pkg/analyzer/lib/src/dart/ast/ast.dart:15487-15499 | pkg/analyzer/lib/src/dart/ast/ast.dart:57278-57290 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analyzer/lib/src/dart/ast/ast.dart:7861— pkg/analyzer/lib/src/dart/ast/ast.dart:7861-7877 | pkg/analyzer/lib/src/dart/ast/ast.dart:7879-7895 | pkg/analyzer/lib/src/dart/ast/ast.dart:8374-8391 | pkg/analyzer/lib/src/dart/ast/ast.dart:8393-8410 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pkg/analyzer/lib/src/dart/ast/ast.dart:13014— pkg/analyzer/lib/src/dart/ast/ast.dart:13014-13028 | pkg/analyzer/lib/src/dart/ast/ast.dart:19468-19485 | pkg/analyzer/lib/src/dart/ast/ast.dart:19625-19642 | pkg/analyzer/lib/src/dart/ast/ast.dart:39138-39152 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
FixmeComment pkg/analysis_server/test/lsp/diagnostic_test.dart:896— // FIXME: This — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/analysis_server/test/lsp/diagnostic_test.dart:914— // FIXME: This — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/analysis_server/test/lsp/diagnostic_test.dart:957— // FIXME: This — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/analyzer/test/src/diagnostics/todo_test.dart:31— // FIXME: Implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/analyzer/test/src/diagnostics/todo_test.dart:33— // [diag.fixme] FIXME: Implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/dartdev/test/commands/analyze_test.dart:57— // FIXME: Fix this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/dartdev/test/commands/analyze_test.dart:447— // FIXME: x — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment sdk/lib/_internal/wasm/js_common/timer_patch.dart:77— // FIXME: Chrome/V8 bug makes errors from `rethrow`s not being reported to — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment sdk/lib/io/file_system_entity.dart:472— // FIXME(bkonyi): find a way to do this using the raw path. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment sdk/lib/io/directory_impl.dart:152— // FIXME(bkonyi): here we're using `path` directly, which might cause — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment sdk/lib/io/directory_impl.dart:181— // FIXME(bkonyi): here we're using `path` directly, which might cause — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment sdk/lib/io/directory_impl.dart:244— // FIXME(bkonyi): here we're using `path` directly, which might cause issues — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment sdk/lib/io/directory_impl.dart:262— // FIXME(bkonyi): here we're using `path` directly, which might cause issues — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/lib/html/instance_of_test.dart:65— // FIXME(b/5286633): Interface injection type check workaround. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/lib/html/instance_of_test.dart:87— // FIXME: Ensure this is an SpanElement when we next update — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/lib/html/htmloptionscollection_test.dart:11— // FIXME: we need some massaging to dart:html to enable HTMLOptionsCollection.add — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/lib/html/document_test.dart:24— // FIXME: nifty way crashes, do it boring way. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/lib/html/document_test.dart:46— // FIXME: nifty way crashes, do it boring way. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_link_test.dart:51— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_link_test.dart:66— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_link_test.dart:112— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_link_test.dart:126— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_file_test.dart:31— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_file_test.dart:73— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment tests/standalone/io/non_utf8_directory_test.dart:32— // FIXME(bkonyi): reenable when rawPath is exposed. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (18 lines × 2) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:35— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:35-52 | pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:59-76 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/front_end/parser_testcases/patterns/const_patterns.dart:18— pkg/front_end/parser_testcases/patterns/const_patterns.dart:18-35 | pkg/front_end/testcases/patterns/const_patterns.dart:18-35 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (18 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_string.dart:140— sdk/lib/_internal/js_dev_runtime/private/js_string.dart:140-157 | sdk/lib/_internal/js_runtime/lib/js_string.dart:125-142 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_string.dart` and `sdk/lib/_internal/js_runtime/lib/js_string.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:1284— sdk/lib/_internal/vm/lib/convert_patch.dart:1284-1301 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1162-1179 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 193 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:2797— sdk/lib/_internal/wasm/common/convert_patch.dart:2797-2814 | sdk/lib/convert/utf.dart:648-665 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (18 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:914— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:914-931 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1148-1165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart:33— pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart:33-50 | pkg/analysis_server/lib/src/services/snippets/dart/switch_statement.dart:36-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (18 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:17438— pkg/analyzer/lib/src/dart/ast/ast.dart:17438-17455 | pkg/analyzer/lib/src/dart/ast/ast.dart:29473-29490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:454— pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:454-471 | pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:653-670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:534— pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:534-551 | pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:645-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/analyzer/lib/src/summary2/element_builder.dart:819— pkg/analyzer/lib/src/summary2/element_builder.dart:819-836 | pkg/analyzer/lib/src/summary2/element_builder.dart:876-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/analyzer/lib/src/summary2/library_builder.dart:496— pkg/analyzer/lib/src/summary2/library_builder.dart:496-513 | pkg/analyzer/lib/src/summary2/library_builder.dart:576-593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/compiler/lib/src/dump_info.dart:1831— pkg/compiler/lib/src/dump_info.dart:1831-1848 | pkg/compiler/lib/src/dump_info.dart:1916-1933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/compiler/lib/src/universe/codegen_world_builder.dart:543— pkg/compiler/lib/src/universe/codegen_world_builder.dart:543-560 | pkg/compiler/lib/src/universe/resolution_world_builder.dart:856-873 — before extracting anything, compare `pkg/compiler/lib/src/universe/codegen_world_builder.dart` and `pkg/compiler/lib/src/universe/resolution_world_builder.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) pkg/dartdev/lib/src/commands/development_service.dart:40— pkg/dartdev/lib/src/commands/development_service.dart:40-57 | pkg/dartdev/lib/src/commands/tooling_daemon.dart:34-51 — before extracting anything, compare `pkg/dartdev/lib/src/commands/development_service.dart` and `pkg/dartdev/lib/src/commands/tooling_daemon.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) pkg/dartdev/lib/src/processes.dart:37— pkg/dartdev/lib/src/processes.dart:37-54 | pkg/dartdev/lib/src/processes.dart:76-93 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:3607— pkg/dev_compiler/lib/src/kernel/compiler.dart:3607-3624 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4208-4225 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4036— pkg/dev_compiler/lib/src/kernel/compiler.dart:4036-4053 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4632-4649 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4480— pkg/dev_compiler/lib/src/kernel/compiler.dart:4480-4497 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5082-5099 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8019— pkg/dev_compiler/lib/src/kernel/compiler.dart:8019-8036 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8885-8902 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) pkg/front_end/lib/src/dill/dill_target.dart:47— pkg/front_end/lib/src/dill/dill_target.dart:47-64 | pkg/front_end/lib/src/kernel/kernel_target.dart:202-219 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (18 lines × 2) pkg/front_end/lib/src/fragment/constructor/declaration.dart:1015— pkg/front_end/lib/src/fragment/constructor/declaration.dart:1015-1032 | pkg/front_end/lib/src/fragment/constructor/declaration.dart:1420-1437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/front_end/lib/src/fragment/constructor/declaration.dart:1071— pkg/front_end/lib/src/fragment/constructor/declaration.dart:1071-1088 | pkg/front_end/lib/src/fragment/constructor/declaration.dart:1478-1495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/front_end/lib/src/fragment/constructor/encoding.dart:239— pkg/front_end/lib/src/fragment/constructor/encoding.dart:239-256 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:985-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) pkg/front_end/lib/src/fragment/field/encoding.dart:806— pkg/front_end/lib/src/fragment/field/encoding.dart:806-823 | pkg/front_end/lib/src/fragment/field/encoding.dart:1316-1333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2177— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2177-2196 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1915-1934 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:51— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:51-70 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart:40-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) pkg/kernel/lib/type_algebra.dart:1008— pkg/kernel/lib/type_algebra.dart:1008-1027 | pkg/kernel/lib/type_algebra.dart:1359-1378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:583— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:583-602 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:586-605 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1088— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1088-1107 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1091-1110 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:110— sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:110-129 | sdk/lib/_internal/js_runtime/lib/js_helper.dart:375-394 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_helper.dart` and `sdk/lib/_internal/js_runtime/lib/js_helper.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:658— pkg/analyzer/lib/src/dart/ast/ast.dart:658-677 | pkg/analyzer/lib/src/dart/ast/ast.dart:682-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:7381— pkg/analyzer/lib/src/dart/ast/ast.dart:7381-7400 | pkg/analyzer/lib/src/dart/ast/ast.dart:7405-7424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:8538— pkg/analyzer/lib/src/dart/ast/ast.dart:8538-8557 | pkg/analyzer/lib/src/dart/ast/ast.dart:8563-8582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:17238— pkg/analyzer/lib/src/dart/ast/ast.dart:17238-17257 | pkg/analyzer/lib/src/dart/ast/ast.dart:17263-17282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/dart/ast/element_locator.dart:110— pkg/analyzer/lib/src/dart/ast/element_locator.dart:110-129 | pkg/analyzer/lib/src/dart/ast/element_locator.dart:597-616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/summary2/bundle_reader.dart:832— pkg/analyzer/lib/src/summary2/bundle_reader.dart:832-851 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1174-1193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/summary2/bundle_reader.dart:859— pkg/analyzer/lib/src/summary2/bundle_reader.dart:859-878 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1201-1220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer/lib/src/summary2/types_builder.dart:230— pkg/analyzer/lib/src/summary2/types_builder.dart:230-249 | pkg/analyzer/lib/src/summary2/types_builder.dart:413-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:135— pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:135-154 | pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:158-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/compiler/lib/src/inferrer/builder.dart:1727— pkg/compiler/lib/src/inferrer/builder.dart:1727-1746 | pkg/compiler/lib/src/inferrer/builder.dart:1748-1767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/compiler/lib/src/js_model/element_map_impl.dart:2655— pkg/compiler/lib/src/js_model/element_map_impl.dart:2655-2674 | pkg/compiler/lib/src/kernel/element_map_impl.dart:2106-2125 — `pkg/compiler/lib/src/js_model/element_map_impl.dart` and `pkg/compiler/lib/src/kernel/element_map_impl.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 23 separate duplicated blocks between them, totalling at least 317 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (20 lines × 2) pkg/compiler/lib/src/serialization/member_data.dart:150— pkg/compiler/lib/src/serialization/member_data.dart:150-169 | pkg/compiler/lib/src/serialization/member_data.dart:199-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/compiler/lib/src/ssa/builder.dart:6691— pkg/compiler/lib/src/ssa/builder.dart:6691-6710 | pkg/compiler/lib/src/ssa/builder.dart:6727-6746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/dartdev/lib/src/commands/compile.dart:241— pkg/dartdev/lib/src/commands/compile.dart:241-260 | pkg/dartdev/lib/src/commands/compile.dart:373-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) pkg/dev_compiler/lib/src/js_ast/builder.dart:438— pkg/dev_compiler/lib/src/js_ast/builder.dart:438-457 | pkg/js_ast/lib/src/builder.dart:370-389 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/builder.dart` and `pkg/js_ast/lib/src/builder.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 189 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) pkg/dev_compiler/lib/src/js_ast/builder.dart:1457— pkg/dev_compiler/lib/src/js_ast/builder.dart:1457-1476 | pkg/js_ast/lib/src/builder.dart:1264-1283 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/builder.dart` and `pkg/js_ast/lib/src/builder.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 189 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) pkg/dev_compiler/lib/src/js_ast/builder.dart:1483— pkg/dev_compiler/lib/src/js_ast/builder.dart:1483-1502 | pkg/js_ast/lib/src/builder.dart:1290-1309 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/builder.dart` and `pkg/js_ast/lib/src/builder.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 189 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2603— pkg/dev_compiler/lib/src/kernel/compiler.dart:2603-2622 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2914-2933 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5235— pkg/dev_compiler/lib/src/kernel/compiler.dart:5235-5254 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5845-5864 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2089— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2089-2107 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1353-1371 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:1003— sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:1003-1021 | sdk/lib/_internal/js_runtime/lib/async_patch.dart:725-743 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart` and `sdk/lib/_internal/js_runtime/lib/async_patch.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:643— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:643-661 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:646-664 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:292— sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:292-310 | sdk/lib/_internal/js_runtime/lib/math_patch.dart:280-298 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart` and `sdk/lib/_internal/js_runtime/lib/math_patch.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:437— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:437-455 | sdk/lib/_internal/js_runtime/lib/js_array.dart:538-556 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) sdk/lib/_internal/vm/lib/async_patch.dart:572— sdk/lib/_internal/vm/lib/async_patch.dart:572-590 | sdk/lib/_internal/wasm/common/sync_star_patch.dart:113-131 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (19 lines × 2) sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart:144— sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart:144-162 | sdk/lib/_internal/wasm/standalone/boxed_double_patch.dart:96-114 — `sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart` and `sdk/lib/_internal/wasm/standalone/boxed_double_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 76 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (19 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:893— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:893-911 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1127-1145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11456— pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11456-11474 | pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11479-11497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart:124— pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart:124-142 | pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart:172-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:208— pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:208-226 | pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart:158-176 — before extracting anything, compare `pkg/analysis_server/lib/src/services/correction/dart/create_class.dart` and `pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/analysis_server/lib/src/services/refactoring/add_constructor_name.dart:83— pkg/analysis_server/lib/src/services/refactoring/add_constructor_name.dart:83-101 | pkg/analysis_server/lib/src/services/refactoring/add_import_prefix.dart:89-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19 lines × 2) pkg/analyzer/lib/src/fine/library_manifest.dart:1894— pkg/analyzer/lib/src/fine/library_manifest.dart:1894-1912 | pkg/analyzer/lib/src/fine/library_manifest.dart:2159-2177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/analyzer/lib/src/workspace/blaze.dart:664— pkg/analyzer/lib/src/workspace/blaze.dart:664-682 | pkg/analyzer/lib/src/workspace/blaze.dart:686-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/compiler/lib/src/js_model/element_map_impl.dart:2538— pkg/compiler/lib/src/js_model/element_map_impl.dart:2538-2556 | pkg/compiler/lib/src/kernel/element_map_impl.dart:2010-2028 — `pkg/compiler/lib/src/js_model/element_map_impl.dart` and `pkg/compiler/lib/src/kernel/element_map_impl.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 23 separate duplicated blocks between them, totalling at least 317 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (19 lines × 2) pkg/compiler/lib/src/ssa/builder.dart:4192— pkg/compiler/lib/src/ssa/builder.dart:4192-4210 | pkg/compiler/lib/src/ssa/builder.dart:4279-4297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/dartdev/lib/src/commands/compile.dart:157— pkg/dartdev/lib/src/commands/compile.dart:157-175 | pkg/dartdev/lib/src/commands/compile.dart:212-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:1069— pkg/dev_compiler/lib/src/kernel/compiler.dart:1069-1087 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1377-1395 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4422— pkg/dev_compiler/lib/src/kernel/compiler.dart:4422-4440 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5018-5036 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5256— pkg/dev_compiler/lib/src/kernel/compiler.dart:5256-5274 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5866-5884 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5429— pkg/dev_compiler/lib/src/kernel/compiler.dart:5429-5447 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6039-6057 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7650— pkg/dev_compiler/lib/src/kernel/compiler.dart:7650-7668 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8517-8535 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7891— pkg/dev_compiler/lib/src/kernel/compiler.dart:7891-7909 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8759-8777 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) pkg/front_end/lib/src/builder/type_parameter_builder.dart:261— pkg/front_end/lib/src/builder/type_parameter_builder.dart:261-279 | pkg/front_end/lib/src/builder/type_parameter_builder.dart:585-603 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:3547— pkg/front_end/lib/src/kernel/body_builder.dart:3547-3569 | pkg/front_end/lib/src/kernel/body_builder.dart:3695-3713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
HackComment pkg/analysis_server/lib/src/utilities/profiling.dart:122— // Hacky parsing of csv line. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/analysis_server/test/lsp/diagnostic_test.dart:956— // HACK: This — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/analyzer/test/src/diagnostics/todo_test.dart:41— // HACK: This is a hack — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/analyzer/test/src/diagnostics/todo_test.dart:43— // [diag.hack] HACK: This is a hack — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/lib/src/js_model/elements.dart:635— // Hack stabilize sort order. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/codesize/swarm/Views.dart:875— // Hack so that _lengths[length - 1] is available. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/codesize/swarm/swarm_ui_lib/base/AnimationScheduler.dart:123— // Hack to work around an iOS bug where sometimes animations do not — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/codesize/swarm/swarm_ui_lib/util/DateUtils.dart:72— // hack applies the timezone from the string to the final time — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/codesize/swarm/swarm_ui_lib/view/PagedViews.dart:205— // Hacky: make sure a change event always fires. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/codesize/swarm/swarm_ui_lib/view/PagedViews.dart:265— // Hacky: we need to duplicate the way the columns are being computed, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/deferred_loading/data/static_separate/lib1.dart:32— // Hack to avoid inlining. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/deferred_loading/data/static_separate/lib1.dart:42— // Hack to avoid inlining. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/compiler/test/deferred_loading/data/static_separate/lib1.dart:126— // Hack to avoid inlining. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment tests/language/deferred/static_separate_lib1.dart:16— // Hack to avoid inlining. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment tests/language/deferred/static_separate_lib1.dart:21— // Hack to avoid inlining. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment tests/language/deferred/static_separate_lib1.dart:51— // Hack to avoid inlining. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/dev_compiler/test/sourcemap/ddc_common.dart:108— // Hack for DDC naming scheme. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/front_end/lib/src/util/outline_extractor.dart:195— // Hack: Put type variable declarations into scope so any overlap in — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/front_end/test/outline_extractor_tester.dart:38— // Hack. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/front_end/test/binary_md_dill_reader.dart:130— // Hack start: Read ComponentIndex first. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/front_end/test/binary_md_dill_reader.dart:164— // Hack end. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/front_end/test/binary_md_dill_reader.dart:635— // Hack: Use the ComponentIndex to go to the end and read the length. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/front_end/tool/fuzz/gReader.dart:779— // Hack: Join them. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/test_runner/lib/src/static_error.dart:801— // Hack: If the error is CFE-only and the length is one, treat it as no — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pkg/testing/lib/src/chain.dart:176— /// Hack: If not running with asserts running the (invalid) configuration — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
Duplicated block (21 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:519— pkg/analyzer/tool/generators/ast_generator.dart:519-539 | pkg/analyzer/tool/generators/ast_generator.dart:563-583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/dart2wasm/lib/transformers.dart:1396— pkg/dart2wasm/lib/transformers.dart:1396-1416 | pkg/dart2wasm/lib/transformers.dart:1469-1489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:687— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:687-707 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:690-710 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:25— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:25-45 | sdk/lib/_internal/js_runtime/lib/js_number.dart:35-55 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/analyzer/lib/src/dart/analysis/results.dart:327— pkg/analyzer/lib/src/dart/analysis/results.dart:327-347 | pkg/analyzer/lib/src/dart/analysis/results.dart:485-505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/analyzer/lib/src/dart/ast/utilities.dart:144— pkg/analyzer/lib/src/dart/ast/utilities.dart:144-164 | pkg/analyzer/lib/src/dart/ast/utilities.dart:295-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:85— pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:85-105 | pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:447-467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:346— pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:346-366 | pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:370-390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/analyzer/lib/src/generated/resolver.dart:2315— pkg/analyzer/lib/src/generated/resolver.dart:2315-2335 | pkg/analyzer/lib/src/generated/resolver.dart:2343-2363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:449— pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:449-469 | pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:758-778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/compiler/lib/src/inferrer/builder.dart:372— pkg/compiler/lib/src/inferrer/builder.dart:372-392 | pkg/compiler/lib/src/inferrer/builder.dart:396-416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/compiler/lib/src/js/placeholder_safety.dart:230— pkg/compiler/lib/src/js/placeholder_safety.dart:230-250 | pkg/compiler/lib/src/native/js.dart:256-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (21 lines × 2) pkg/compiler/lib/src/js/size_estimator.dart:902— pkg/compiler/lib/src/js/size_estimator.dart:902-922 | pkg/js_ast/lib/src/printer.dart:1289-1309 — before extracting anything, compare `pkg/compiler/lib/src/js/size_estimator.dart` and `pkg/js_ast/lib/src/printer.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4579— pkg/dev_compiler/lib/src/kernel/compiler.dart:4579-4599 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5181-5201 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4828— pkg/dev_compiler/lib/src/kernel/compiler.dart:4828-4848 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5438-5458 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5498— pkg/dev_compiler/lib/src/kernel/compiler.dart:5498-5518 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6108-6128 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8048— pkg/dev_compiler/lib/src/kernel/compiler.dart:8048-8068 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8917-8937 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8493— pkg/dev_compiler/lib/src/kernel/compiler.dart:8493-8513 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:9444-9464 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) pkg/front_end/lib/src/fragment/field/encoding.dart:311— pkg/front_end/lib/src/fragment/field/encoding.dart:311-331 | pkg/front_end/lib/src/fragment/field/encoding.dart:382-402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:10187— pkg/front_end/lib/src/kernel/body_builder.dart:10187-10207 | pkg/front_end/lib/src/kernel/body_builder.dart:10284-10304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4960— pkg/front_end/lib/src/type_inference/inference_visitor.dart:4960-4980 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5081-5101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) pkg/front_end/testcases/general/with_dependencies/mixin_from_dill/mixin_from_dill_lib1.dart:8— pkg/front_end/testcases/general/with_dependencies/mixin_from_dill/mixin_from_dill_lib1.dart:8-28 | pkg/front_end/testcases/general/with_dependencies/mixin_from_dill/mixin_from_dill_lib2.dart:8-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (22 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1327— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1327-1348 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1764-1785 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) pkg/analyzer/tool/ast/generate.dart:1042— pkg/analyzer/tool/ast/generate.dart:1042-1063 | pkg/analyzer/tool/ast/generate.dart:1095-1116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:559— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:559-580 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:562-583 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2104— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2104-2125 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:2122-2143 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) pkg/analysis_server/lib/src/cider/document_symbols.dart:43— pkg/analysis_server/lib/src/cider/document_symbols.dart:43-64 | pkg/analysis_server/lib/src/lsp/handlers/handler_document_symbols.dart:53-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (22 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart:22— pkg/analysis_server/lib/src/lsp/handlers/commands/organize_imports.dart:22-43 | pkg/analysis_server/lib/src/lsp/handlers/commands/sort_members.dart:23-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (22 lines × 2) pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart:112— pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart:112-133 | pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart:238-259 — before extracting anything, compare `pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart` and `pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:38321— pkg/analyzer/lib/src/dart/ast/ast.dart:38321-38342 | pkg/analyzer/lib/src/dart/ast/ast.dart:38348-38369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/analyzer/lib/src/fasta/ast_builder.dart:3350— pkg/analyzer/lib/src/fasta/ast_builder.dart:3350-3371 | pkg/analyzer/lib/src/fasta/ast_builder.dart:6281-6302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/analyzer/lib/src/generated/error_verifier.dart:1212— pkg/analyzer/lib/src/generated/error_verifier.dart:1212-1233 | pkg/analyzer/lib/src/generated/error_verifier.dart:2494-2515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/compiler/lib/src/ssa/builder.dart:1663— pkg/compiler/lib/src/ssa/builder.dart:1663-1684 | pkg/compiler/lib/src/ssa/builder.dart:4391-4412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7956— pkg/dev_compiler/lib/src/kernel/compiler.dart:7956-7977 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8822-8843 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) pkg/front_end/lib/src/dill/dill_target.dart:66— pkg/front_end/lib/src/dill/dill_target.dart:66-87 | pkg/front_end/lib/src/kernel/kernel_target.dart:221-242 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (22 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:4973— pkg/front_end/lib/src/kernel/body_builder.dart:4973-4994 | pkg/front_end/lib/src/source/outline_builder.dart:3209-3230 — before extracting anything, compare `pkg/front_end/lib/src/kernel/body_builder.dart` and `pkg/front_end/lib/src/source/outline_builder.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3452— pkg/front_end/lib/src/kernel/constant_evaluator.dart:3452-3473 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:3491-3512 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/front_end/lib/src/kernel/hierarchy/mixin_inferrer.dart:393— pkg/front_end/lib/src/kernel/hierarchy/mixin_inferrer.dart:393-414 | pkg/front_end/lib/src/kernel/hierarchy/mixin_inferrer.dart:501-522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:603— pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:603-624 | pkg/front_end/lib/src/source/source_type_alias_builder.dart:218-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (22 lines × 2) pkg/front_end/lib/src/type_inference/collection_encoding.dart:1142— pkg/front_end/lib/src/type_inference/collection_encoding.dart:1142-1163 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1694-1715 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:99— pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:99-120 | pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:127-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) pkg/observatory/lib/src/elements/heap_snapshot.dart:427— pkg/observatory/lib/src/elements/heap_snapshot.dart:427-448 | pkg/observatory/lib/src/elements/process_snapshot.dart:154-175 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/typed_data_patch.dart:100— sdk/lib/_internal/js_dev_runtime/patch/typed_data_patch.dart:100-121 | sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart:101-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 3) pkg/front_end/tool/coverage_merger.dart:1166— pkg/front_end/tool/coverage_merger.dart:1166-1174 | pkg/front_end/tool/coverage_merger.dart:1236-1244 | pkg/front_end/tool/coverage_merger.dart:1265-1273 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) pkg/native_compiler/lib/back_end/arm64/assembler.dart:685— pkg/native_compiler/lib/back_end/arm64/assembler.dart:685-693 | pkg/native_compiler/lib/back_end/arm64/assembler.dart:714-722 | pkg/native_compiler/lib/back_end/arm64/assembler.dart:763-771 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) pkg/analysis_server/lib/src/protocol/protocol_internal.dart:242— pkg/analysis_server/lib/src/protocol/protocol_internal.dart:242-250 | pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart:497-505 | pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart:581-589 — before extracting anything, compare `pkg/analysis_server/lib/src/protocol/protocol_internal.dart` and `pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:65— pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:65-73 | pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:91-99 | pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:107-115 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:537— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:537-545 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:622-630 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:881-889 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) pkg/kernel/lib/src/dart_type_equivalence.dart:182— pkg/kernel/lib/src/dart_type_equivalence.dart:182-190 | pkg/kernel/lib/src/dart_type_equivalence.dart:210-218 | pkg/kernel/lib/src/dart_type_equivalence.dart:344-352 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) pkg/observatory/lib/src/elements/isolate_reconnect.dart:75— pkg/observatory/lib/src/elements/isolate_reconnect.dart:75-83 | pkg/observatory/lib/src/elements/json_view.dart:57-65 | pkg/observatory/lib/src/elements/vm_connect.dart:62-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/front_end/testcases/dart2js/extension_types/issue51285.dart:6— pkg/front_end/testcases/dart2js/extension_types/issue51285.dart:6-14 | pkg/front_end/testcases/dartdevc/extension_types/issue51285.dart:6-14 | pkg/front_end/testcases/extension_types/issue51285.dart:6-14 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (9 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:515— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:515-523 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:511-519 | sdk/lib/_internal/wasm/common/io_patch.dart:511-519 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:539— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:539-547 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:535-543 | sdk/lib/_internal/wasm/common/io_patch.dart:535-543 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:729— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:729-737 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:725-733 | sdk/lib/_internal/wasm/common/io_patch.dart:725-733 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) pkg/analyzer/lib/file_system/memory_file_system.dart:454— pkg/analyzer/lib/file_system/memory_file_system.dart:454-462 | pkg/analyzer/lib/file_system/overlay_file_system.dart:263-271 | pkg/analyzer/lib/file_system/physical_file_system.dart:232-240 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_sized_box.dart:25— pkg/analysis_server/lib/src/services/correction/dart/replace_container_with_sized_box.dart:25-33 | pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_void.dart:25-33 | pkg/analysis_server/lib/src/services/correction/dart/replace_var_with_dynamic.dart:23-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/analysis_server/lib/src/status/pages/ast_page.dart:52— pkg/analysis_server/lib/src/status/pages/ast_page.dart:52-60 | pkg/analysis_server/lib/src/status/pages/contents_page.dart:61-69 | pkg/analysis_server/lib/src/status/pages/element_model_page.dart:65-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/analyzer/lib/src/error/best_practices_verifier.dart:2223— pkg/analyzer/lib/src/error/best_practices_verifier.dart:2223-2231 | pkg/analyzer/lib/src/error/element_usage_detector.dart:418-426 | pkg/analyzer/lib/src/error/element_usage_detector.dart:1002-1010 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 3) pkg/compiler/lib/src/inferrer/map_tracer.dart:69— pkg/compiler/lib/src/inferrer/map_tracer.dart:69-77 | pkg/compiler/lib/src/inferrer/record_tracer.dart:30-38 | pkg/compiler/lib/src/inferrer/set_tracer.dart:92-100 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/front_end/lib/src/fragment/enum_element.dart:644— pkg/front_end/lib/src/fragment/enum_element.dart:644-653 | pkg/front_end/lib/src/fragment/field/class_member.dart:46-54 | pkg/front_end/lib/src/source/source_enum_builder.dart:936-945 — before extracting anything, compare `pkg/front_end/lib/src/fragment/enum_element.dart` and `pkg/front_end/lib/src/source/source_enum_builder.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:459— pkg/front_end/lib/src/fragment/getter/encoding.dart:459-467 | pkg/front_end/lib/src/fragment/method/encoding.dart:460-468 | pkg/front_end/lib/src/fragment/setter/encoding.dart:476-484 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (9 lines × 3) pkg/linter/lib/src/rules/avoid_return_types_on_setters.dart:27— pkg/linter/lib/src/rules/avoid_return_types_on_setters.dart:27-35 | pkg/linter/lib/src/rules/avoid_void_async.dart:26-34 | pkg/linter/lib/src/rules/recursive_getters.dart:24-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/linter/lib/src/rules/avoid_unused_constructor_parameters.dart:32— pkg/linter/lib/src/rules/avoid_unused_constructor_parameters.dart:32-40 | pkg/linter/lib/src/rules/matching_super_parameters.dart:24-32 | pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart:30-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 3) pkg/linter/lib/src/rules/omit_obvious_property_types.dart:37— pkg/linter/lib/src/rules/omit_obvious_property_types.dart:37-45 | pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart:36-44 | pkg/linter/lib/src/rules/unnecessary_late.dart:23-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×20
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:51— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:51-155 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart:46-106 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart:41-95 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_typing_temporary_missing_end_brace.dart:45-128 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_completion_after_change.dart:37-138 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_typing_temporarily_missing_end_brace_in_string_interpolation.dart:50-111 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:42— pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:42-61 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:75-94 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:108-127 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method_tearoff.dart:42-61 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method_tearoff.dart:75-94 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method_tearoff.dart:108-127 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:262— sdk/lib/_internal/vm/lib/typed_data_patch.dart:262-270 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:598-606 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:944-952 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1287-1295 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1630-1638 | sdk/lib/_internal/wasm/common/typed_data.dart:2139-2147 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:282— sdk/lib/_internal/vm/lib/typed_data_patch.dart:282-292 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:618-628 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:964-974 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1307-1317 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1650-1660 | sdk/lib/_internal/wasm/common/typed_data.dart:2159-2169 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:332— sdk/lib/_internal/vm/lib/typed_data_patch.dart:332-340 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:669-677 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1060-1068 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1403-1411 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1746-1754 | sdk/lib/_internal/wasm/common/typed_data.dart:2209-2217 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:371— sdk/lib/_internal/vm/lib/typed_data_patch.dart:371-379 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:708-716 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1100-1108 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1443-1451 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1786-1794 | sdk/lib/_internal/wasm/common/typed_data.dart:2248-2256 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:381— sdk/lib/_internal/vm/lib/typed_data_patch.dart:381-391 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:718-728 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1110-1120 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1453-1463 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1796-1806 | sdk/lib/_internal/wasm/common/typed_data.dart:2258-2268 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:393— sdk/lib/_internal/vm/lib/typed_data_patch.dart:393-410 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:730-747 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1122-1139 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1465-1482 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1808-1825 | sdk/lib/_internal/wasm/common/typed_data.dart:2270-2287 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:436— sdk/lib/_internal/vm/lib/typed_data_patch.dart:436-446 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:773-783 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1168-1178 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1511-1521 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1854-1864 | sdk/lib/_internal/wasm/common/typed_data.dart:2317-2327 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:448— sdk/lib/_internal/vm/lib/typed_data_patch.dart:448-456 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:785-793 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1180-1188 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1523-1531 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1866-1874 | sdk/lib/_internal/wasm/common/typed_data.dart:2329-2337 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/analysis_server/lib/src/protocol/protocol_internal.dart:240— pkg/analysis_server/lib/src/protocol/protocol_internal.dart:240-253 | pkg/analysis_server/lib/src/protocol/protocol_internal.dart:284-297 | pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart:495-508 | pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart:536-549 | pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart:579-592 | pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart:619-632 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/analyzer/lib/src/summary2/element_builder.dart:1339— pkg/analyzer/lib/src/summary2/element_builder.dart:1339-1369 | pkg/analyzer/lib/src/summary2/element_builder.dart:1623-1647 | pkg/analyzer/lib/src/summary2/element_builder.dart:1654-1679 | pkg/analyzer/lib/src/summary2/element_builder.dart:1828-1855 | pkg/analyzer/lib/src/summary2/element_builder.dart:1878-1901 | pkg/analyzer/lib/src/summary2/element_builder.dart:1970-1994 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/front_end/lib/src/fragment/getter/encoding.dart:239— pkg/front_end/lib/src/fragment/getter/encoding.dart:239-271 | pkg/front_end/lib/src/fragment/getter/encoding.dart:506-552 | pkg/front_end/lib/src/fragment/method/encoding.dart:182-214 | pkg/front_end/lib/src/fragment/method/encoding.dart:511-557 | pkg/front_end/lib/src/fragment/setter/encoding.dart:237-270 | pkg/front_end/lib/src/fragment/setter/encoding.dart:523-569 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/front_end/lib/src/fragment/getter/encoding.dart:273— pkg/front_end/lib/src/fragment/getter/encoding.dart:273-326 | pkg/front_end/lib/src/fragment/getter/encoding.dart:554-627 | pkg/front_end/lib/src/fragment/method/encoding.dart:216-283 | pkg/front_end/lib/src/fragment/method/encoding.dart:559-654 | pkg/front_end/lib/src/fragment/setter/encoding.dart:272-351 | pkg/front_end/lib/src/fragment/setter/encoding.dart:571-676 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/front_end/lib/src/fragment/getter/encoding.dart:372— pkg/front_end/lib/src/fragment/getter/encoding.dart:372-391 | pkg/front_end/lib/src/fragment/getter/encoding.dart:673-693 | pkg/front_end/lib/src/fragment/method/encoding.dart:303-322 | pkg/front_end/lib/src/fragment/method/encoding.dart:674-694 | pkg/front_end/lib/src/fragment/setter/encoding.dart:374-393 | pkg/front_end/lib/src/fragment/setter/encoding.dart:699-719 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/front_end/lib/src/fragment/getter/encoding.dart:393— pkg/front_end/lib/src/fragment/getter/encoding.dart:393-411 | pkg/front_end/lib/src/fragment/getter/encoding.dart:695-732 | pkg/front_end/lib/src/fragment/method/encoding.dart:324-342 | pkg/front_end/lib/src/fragment/method/encoding.dart:696-732 | pkg/front_end/lib/src/fragment/setter/encoding.dart:395-413 | pkg/front_end/lib/src/fragment/setter/encoding.dart:721-758 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/front_end/lib/src/fragment/getter/encoding.dart:435— pkg/front_end/lib/src/fragment/getter/encoding.dart:435-450 | pkg/front_end/lib/src/fragment/getter/encoding.dart:765-780 | pkg/front_end/lib/src/fragment/method/encoding.dart:392-407 | pkg/front_end/lib/src/fragment/method/encoding.dart:794-809 | pkg/front_end/lib/src/fragment/setter/encoding.dart:452-467 | pkg/front_end/lib/src/fragment/setter/encoding.dart:807-822 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/front_end/lib/src/kernel/expression_generator.dart:1754— pkg/front_end/lib/src/kernel/expression_generator.dart:1754-1771 | pkg/front_end/lib/src/kernel/expression_generator.dart:1964-1981 | pkg/front_end/lib/src/kernel/expression_generator.dart:2185-2202 | pkg/front_end/lib/src/kernel/expression_generator.dart:3732-3749 | pkg/front_end/lib/src/kernel/expression_generator.dart:4189-4207 | pkg/front_end/lib/src/kernel/expression_generator.dart:5422-5439 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) sdk/lib/vmservice/devfs.dart:181— sdk/lib/vmservice/devfs.dart:181-201 | sdk/lib/vmservice/devfs.dart:203-221 | sdk/lib/vmservice/devfs.dart:223-278 | sdk/lib/vmservice/devfs.dart:280-335 | sdk/lib/vmservice/devfs.dart:337-395 | sdk/lib/vmservice/devfs.dart:397-420 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) pkg/compiler/tool/modular_test_suite_helper.dart:256— pkg/compiler/tool/modular_test_suite_helper.dart:256-289 | pkg/compiler/tool/modular_test_suite_helper.dart:320-350 | pkg/compiler/tool/modular_test_suite_helper.dart:377-406 | pkg/compiler/tool/modular_test_suite_helper.dart:443-474 | pkg/compiler/tool/modular_test_suite_helper.dart:506-538 | pkg/compiler/tool/modular_test_suite_helper.dart:571-603 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Duplicated block (23 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_implicit_this_upwards.dart:36— pkg/front_end/testcases/inference/infer_assign_to_implicit_this_upwards.dart:36-58 | pkg/front_end/testcases/inference_new/infer_assign_to_implicit_this_upwards.dart:32-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_property_super_upwards.dart:35— pkg/front_end/testcases/inference/infer_assign_to_property_super_upwards.dart:35-57 | pkg/front_end/testcases/inference_new/infer_assign_to_property_super_upwards.dart:35-57 — `pkg/front_end/testcases/inference/infer_assign_to_property_super_upwards.dart` and `pkg/front_end/testcases/inference_new/infer_assign_to_property_super_upwards.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 49 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (23 lines × 2) sdk/lib/_internal/vm/lib/async_patch.dart:595— sdk/lib/_internal/vm/lib/async_patch.dart:595-617 | sdk/lib/_internal/wasm/common/sync_star_patch.dart:137-159 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) sdk/lib/_internal/vm/lib/double.dart:341— sdk/lib/_internal/vm/lib/double.dart:341-363 | sdk/lib/_internal/wasm/common/boxed_double.dart:325-347 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) sdk/lib/_internal/wasm/js/string_patch.dart:126— sdk/lib/_internal/wasm/js/string_patch.dart:126-148 | sdk/lib/_internal/wasm/standalone/string_patch.dart:86-108 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (23 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:55— pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:55-77 | pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:152-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) pkg/analyzer/lib/src/error/element_usage_frontier_detector.dart:77— pkg/analyzer/lib/src/error/element_usage_frontier_detector.dart:77-99 | pkg/analyzer/lib/src/error/element_usage_frontier_detector.dart:188-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) pkg/analyzer/lib/src/fine/requirements.dart:2678— pkg/analyzer/lib/src/fine/requirements.dart:2678-2700 | pkg/analyzer/lib/src/fine/requirements.dart:2726-2748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) pkg/compiler/lib/src/js_model/env.dart:712— pkg/compiler/lib/src/js_model/env.dart:712-734 | pkg/compiler/lib/src/kernel/env.dart:555-577 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:11080— pkg/front_end/lib/src/kernel/body_builder.dart:11080-11102 | pkg/front_end/lib/src/kernel/body_builder.dart:11107-11129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) pkg/front_end/lib/src/kernel/collections.dart:136— pkg/front_end/lib/src/kernel/collections.dart:136-158 | pkg/front_end/lib/src/kernel/internal_ast.dart:7891-7913 — before extracting anything, compare `pkg/front_end/lib/src/kernel/collections.dart` and `pkg/front_end/lib/src/kernel/internal_ast.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:641— pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:641-663 | pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:1050-1072 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) pkg/front_end/lib/src/kernel/hierarchy/delayed.dart:125— pkg/front_end/lib/src/kernel/hierarchy/delayed.dart:125-147 | pkg/front_end/lib/src/kernel/hierarchy/delayed.dart:154-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) pkg/front_end/testcases/dart2js/tear_off_patch/patch_lib.dart:10— pkg/front_end/testcases/dart2js/tear_off_patch/patch_lib.dart:10-32 | pkg/front_end/testcases/general/tear_off_patch/patch_lib.dart:10-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) pkg/front_end/testcases/general/hierarchy/abstract_extends_getter.dart:6— pkg/front_end/testcases/general/hierarchy/abstract_extends_getter.dart:6-28 | pkg/front_end/testcases/general/hierarchy/concrete_extends_getter.dart:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23 lines × 2) pkg/front_end/testcases/general/hierarchy/abstract_extends_method.dart:6— pkg/front_end/testcases/general/hierarchy/abstract_extends_method.dart:6-28 | pkg/front_end/testcases/general/hierarchy/concrete_extends_method.dart:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23 lines × 2) pkg/front_end/testcases/general/hierarchy/abstract_extends_setter.dart:6— pkg/front_end/testcases/general/hierarchy/abstract_extends_setter.dart:6-28 | pkg/front_end/testcases/general/hierarchy/concrete_extends_setter.dart:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23 lines × 2) pkg/front_end/testcases/general/hierarchy/abstract_implements_getter.dart:6— pkg/front_end/testcases/general/hierarchy/abstract_implements_getter.dart:6-28 | pkg/front_end/testcases/general/hierarchy/concrete_implements_getter.dart:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23 lines × 2) pkg/front_end/testcases/general/hierarchy/abstract_implements_method.dart:6— pkg/front_end/testcases/general/hierarchy/abstract_implements_method.dart:6-28 | pkg/front_end/testcases/general/hierarchy/concrete_implements_method.dart:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23 lines × 2) pkg/front_end/testcases/general/hierarchy/abstract_implements_setter.dart:6— pkg/front_end/testcases/general/hierarchy/abstract_implements_setter.dart:6-28 | pkg/front_end/testcases/general/hierarchy/concrete_implements_setter.dart:6-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:411— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:411-420 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:414-423 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:483-492 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:656— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:656-665 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:659-668 | sdk/lib/_internal/wasm/common/errors_patch.dart:177-186 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1402— sdk/lib/_internal/vm/lib/convert_patch.dart:1402-1411 | sdk/lib/_internal/wasm/common/convert_patch.dart:1588-1597 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1280-1289 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/wasm/common/typed_data.dart:1085— sdk/lib/_internal/wasm/common/typed_data.dart:1085-1094 | sdk/lib/_internal/wasm/common/typed_data.dart:1147-1156 | sdk/lib/_internal/wasm/common/typed_data.dart:1193-1202 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart:224— pkg/analysis_server/lib/src/lsp/handlers/handler_call_hierarchy.dart:224-233 | pkg/analysis_server/lib/src/lsp/handlers/handler_hover.dart:43-52 | pkg/analysis_server/lib/src/lsp/handlers/handler_type_hierarchy.dart:61-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (10 lines × 3) pkg/analyzer/lib/src/dart/element/subtype.dart:437— pkg/analyzer/lib/src/dart/element/subtype.dart:437-446 | pkg/analyzer/lib/src/dart/element/subtype.dart:465-474 | pkg/analyzer/lib/src/dart/element/subtype.dart:490-500 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) pkg/analyzer/lib/src/generated/error_verifier.dart:2130— pkg/analyzer/lib/src/generated/error_verifier.dart:2130-2139 | pkg/analyzer/lib/src/generated/error_verifier.dart:2165-2174 | pkg/analyzer/lib/src/generated/error_verifier.dart:2191-2200 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) pkg/observatory/lib/src/elements/class_allocation_profile.dart:127— pkg/observatory/lib/src/elements/class_allocation_profile.dart:127-136 | pkg/observatory/lib/src/elements/cpu_profile.dart:161-170 | pkg/observatory/lib/src/elements/cpu_profile_table.dart:481-490 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (10 lines × 3) pkg/observatory/lib/src/elements/field_view.dart:190— pkg/observatory/lib/src/elements/field_view.dart:190-199 | pkg/observatory/lib/src/elements/function_view.dart:173-182 | pkg/observatory/lib/src/elements/instance_view.dart:188-197 — before extracting anything, compare `pkg/observatory/lib/src/elements/field_view.dart` and `pkg/observatory/lib/src/elements/function_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) pkg/front_end/testcases/general/covariant_field.dart:19— pkg/front_end/testcases/general/covariant_field.dart:19-28 | pkg/front_end/testcases/late_lowering/covariant_late_field.dart:19-28 | pkg/front_end/testcases/nnbd/covariant_late_field.dart:19-28 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart:394— sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart:394-403 | sdk/lib/_internal/js_runtime/lib/developer_patch.dart:363-372 | sdk/lib/_internal/wasm/standalone/developer_patch.dart:59-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:57— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:57-66 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:53-62 | sdk/lib/_internal/wasm/common/io_patch.dart:53-62 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:476— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:476-485 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:472-481 | sdk/lib/_internal/wasm/common/io_patch.dart:472-481 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:490— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:490-499 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:486-495 | sdk/lib/_internal/wasm/common/io_patch.dart:486-495 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:504— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:504-513 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:500-509 | sdk/lib/_internal/wasm/common/io_patch.dart:500-509 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:528— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:528-537 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:524-533 | sdk/lib/_internal/wasm/common/io_patch.dart:524-533 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:655— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:655-664 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:651-660 | sdk/lib/_internal/wasm/common/io_patch.dart:651-660 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) pkg/linter/lib/src/rules/avoid_setters_without_getters.dart:25— pkg/linter/lib/src/rules/avoid_setters_without_getters.dart:25-35 | pkg/linter/lib/src/rules/sort_constructors_first.dart:23-32 | pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart:27-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (10 lines × 3) pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:78— pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:78-88 | pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart:96-105 | pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart:100-109 — before extracting anything, compare `pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart` and `pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) pkg/test_runner/lib/src/browser_controller.dart:1077— pkg/test_runner/lib/src/browser_controller.dart:1077-1086 | pkg/test_runner/lib/src/browser_controller.dart:1191-1200 | pkg/test_runner/lib/src/browser_controller.dart:1216-1228 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (25 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1669— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1669-1693 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1022-1046 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_index_super.dart:28— pkg/front_end/testcases/inference/infer_assign_to_index_super.dart:28-52 | pkg/front_end/testcases/inference_new/infer_assign_to_index_super.dart:28-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (25 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_index_this.dart:26— pkg/front_end/testcases/inference/infer_assign_to_index_this.dart:26-50 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this.dart:26-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (25 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:711— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:711-735 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:714-738 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart:28— sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart:28-52 | sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart:62-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:727— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:727-751 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:942-966 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) sdk/lib/_internal/vm/lib/integers.dart:219— sdk/lib/_internal/vm/lib/integers.dart:219-243 | sdk/lib/_internal/wasm/common/boxed_int.dart:186-210 — before extracting anything, compare `sdk/lib/_internal/vm/lib/integers.dart` and `sdk/lib/_internal/wasm/common/boxed_int.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:21920— pkg/analyzer/lib/src/dart/ast/ast.dart:21920-21944 | pkg/analyzer/lib/src/dart/ast/ast.dart:49444-49468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) pkg/compiler/lib/src/js_model/element_map_impl.dart:619— pkg/compiler/lib/src/js_model/element_map_impl.dart:619-643 | pkg/compiler/lib/src/kernel/element_map_impl.dart:293-317 — `pkg/compiler/lib/src/js_model/element_map_impl.dart` and `pkg/compiler/lib/src/kernel/element_map_impl.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 23 separate duplicated blocks between them, totalling at least 317 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (25 lines × 2) pkg/compiler/lib/src/js_model/element_map_impl.dart:772— pkg/compiler/lib/src/js_model/element_map_impl.dart:772-796 | pkg/compiler/lib/src/kernel/element_map_impl.dart:442-466 — `pkg/compiler/lib/src/js_model/element_map_impl.dart` and `pkg/compiler/lib/src/kernel/element_map_impl.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 23 separate duplicated blocks between them, totalling at least 317 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (25 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7401— pkg/dev_compiler/lib/src/kernel/compiler.dart:7401-7425 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8268-8292 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7719— pkg/dev_compiler/lib/src/kernel/compiler.dart:7719-7743 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8586-8610 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7923— pkg/dev_compiler/lib/src/kernel/compiler.dart:7923-7947 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8789-8813 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) pkg/front_end/lib/src/fragment/constructor/encoding.dart:1294— pkg/front_end/lib/src/fragment/constructor/encoding.dart:1294-1318 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:1335-1359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) pkg/front_end/lib/src/fragment/getter/encoding.dart:284— pkg/front_end/lib/src/fragment/getter/encoding.dart:284-308 | pkg/front_end/lib/src/fragment/getter/encoding.dart:585-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) pkg/front_end/lib/src/fragment/getter/encoding.dart:328— pkg/front_end/lib/src/fragment/getter/encoding.dart:328-352 | pkg/front_end/lib/src/fragment/getter/encoding.dart:629-653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) pkg/dart2wasm/lib/map_factory_specializer.dart:18— pkg/dart2wasm/lib/map_factory_specializer.dart:18-42 | pkg/vm/lib/modular/specializer/map_factory_specializer.dart:18-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (25 lines × 2) pkg/dart2wasm/lib/set_factory_specializer.dart:19— pkg/dart2wasm/lib/set_factory_specializer.dart:19-43 | pkg/vm/lib/modular/specializer/set_factory_specializer.dart:19-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1362— sdk/lib/_internal/vm/lib/convert_patch.dart:1362-1372 | sdk/lib/_internal/wasm/common/convert_patch.dart:1548-1558 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1240-1250 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1382— sdk/lib/_internal/vm/lib/convert_patch.dart:1382-1392 | sdk/lib/_internal/wasm/common/convert_patch.dart:1568-1578 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1260-1270 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 3) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:880— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:880-890 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:997-1007 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1116-1126 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analysis_server/lib/protocol/protocol.dart:166— pkg/analysis_server/lib/protocol/protocol.dart:166-176 | pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:144-154 | pkg/analyzer_plugin/lib/protocol/protocol.dart:174-184 — before extracting anything, compare `pkg/analysis_server/lib/protocol/protocol.dart` and `pkg/analysis_server_client/lib/src/protocol/protocol_base.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 3) pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:1521— pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:1521-1531 | pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:1534-1544 | pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:1547-1557 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart:31— pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart:31-41 | pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart:35-45 | pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart:31-41 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/dart/analysis/search.dart:289— pkg/analyzer/lib/src/dart/analysis/search.dart:289-299 | pkg/analyzer/lib/src/dart/analysis/search.dart:386-396 | pkg/analyzer/lib/src/dart/analysis/search.dart:433-443 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:24002— pkg/analyzer/lib/src/dart/ast/ast.dart:24002-24012 | pkg/analyzer/lib/src/dart/ast/ast.dart:25642-25652 | pkg/analyzer/lib/src/dart/ast/ast.dart:37223-37233 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/dart/element/well_bounded.dart:93— pkg/analyzer/lib/src/dart/element/well_bounded.dart:93-103 | pkg/analyzer/lib/src/error/type_arguments_verifier.dart:104-114 | pkg/analyzer/lib/src/error/type_arguments_verifier.dart:178-188 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:168— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:168-178 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:182-192 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:196-206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:519— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:519-529 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:532-542 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:546-556 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/summary2/bundle_writer.dart:193— pkg/analyzer/lib/src/summary2/bundle_writer.dart:193-203 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:535-545 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:756-766 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analyzer/lib/src/summary2/informative_data.dart:191— pkg/analyzer/lib/src/summary2/informative_data.dart:191-201 | pkg/analyzer/lib/src/summary2/informative_data.dart:285-295 | pkg/analyzer/lib/src/summary2/informative_data.dart:479-489 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/dartdev/lib/src/commands/compile.dart:312— pkg/dartdev/lib/src/commands/compile.dart:312-322 | pkg/dartdev/lib/src/commands/compile.dart:442-452 | pkg/dartdev/lib/src/commands/compile.dart:971-981 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/front_end/lib/src/fragment/method/encoding.dart:741— pkg/front_end/lib/src/fragment/method/encoding.dart:741-751 | pkg/front_end/lib/src/fragment/setter/encoding.dart:418-428 | pkg/front_end/lib/src/fragment/setter/encoding.dart:767-777 — `pkg/front_end/lib/src/fragment/method/encoding.dart` and `pkg/front_end/lib/src/fragment/setter/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 306 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (11 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2198— pkg/front_end/lib/src/type_inference/inference_visitor.dart:2198-2208 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5947-5957 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6046-6056 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart:252— pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart:252-262 | pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:161-171 | pkg/analysis_server/lib/src/services/refactoring/legacy/inline_local.dart:167-177 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (11 lines × 3) pkg/test_runner/lib/src/runtime_configuration.dart:438— pkg/test_runner/lib/src/runtime_configuration.dart:438-448 | pkg/test_runner/lib/src/runtime_configuration.dart:480-490 | pkg/test_runner/lib/src/runtime_configuration.dart:583-593 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×17
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/dartpad_worker/lib/src/resource_provider/resource_provider_file.dart:779— pkg/dartpad_worker/lib/src/resource_provider/resource_provider_file.dart:779-794 | sdk/lib/_http/http_impl.dart:1118-1132 | sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart:99-114 | sdk/lib/_internal/wasm/standalone/string_buffer_patch.dart:42-58 | sdk/lib/io/io_sink.dart:296-310 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:495— sdk/lib/_internal/vm/lib/typed_data_patch.dart:495-504 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:832-842 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1235-1244 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1578-1587 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1921-1930 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types.dart:77— pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types.dart:77-116 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types.dart:188-217 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:159-238 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/map.dart:39-82 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/record.dart:62-118 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart:26— pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart:26-54 | pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmented.dart:26-54 | pkg/analysis_server/lib/src/lsp/handlers/custom/handler_super.dart:29-79 | pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:39-102 | pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart:30-109 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:534— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:534-569 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:619-656 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:658-677 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:679-709 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:878-902 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analyzer/lib/src/fine/library_manifest.dart:1995— pkg/analyzer/lib/src/fine/library_manifest.dart:1995-2019 | pkg/analyzer/lib/src/fine/library_manifest.dart:2021-2045 | pkg/analyzer/lib/src/fine/library_manifest.dart:2047-2071 | pkg/analyzer/lib/src/fine/library_manifest.dart:2073-2097 | pkg/analyzer/lib/src/fine/library_manifest.dart:2099-2123 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analyzer/lib/src/fine/manifest_item.dart:79— pkg/analyzer/lib/src/fine/manifest_item.dart:79-100 | pkg/analyzer/lib/src/fine/manifest_item.dart:269-288 | pkg/analyzer/lib/src/fine/manifest_item.dart:376-391 | pkg/analyzer/lib/src/fine/manifest_item.dart:460-481 | pkg/analyzer/lib/src/fine/manifest_item.dart:1363-1384 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analyzer/lib/src/summary2/bundle_reader.dart:255— pkg/analyzer/lib/src/summary2/bundle_reader.dart:255-298 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:456-492 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:543-576 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:610-648 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1064-1101 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analyzer/lib/src/summary2/bundle_reader.dart:300— pkg/analyzer/lib/src/summary2/bundle_reader.dart:300-334 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:494-526 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:578-608 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:650-681 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1103-1135 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/analyzer/lib/src/summary2/bundle_writer.dart:172— pkg/analyzer/lib/src/summary2/bundle_writer.dart:172-190 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:295-311 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:352-366 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:401-416 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:689-706 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/dartdev/lib/src/commands/compile.dart:126— pkg/dartdev/lib/src/commands/compile.dart:126-175 | pkg/dartdev/lib/src/commands/compile.dart:198-230 | pkg/dartdev/lib/src/commands/dart_mcp_server.dart:47-94 | pkg/dartdev/lib/src/commands/development_service.dart:30-62 | pkg/dartdev/lib/src/commands/tooling_daemon.dart:29-56 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:249— pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:249-258 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:281-290 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:313-322 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:541-550 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:572-581 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/observatory/lib/src/elements/error_view.dart:56— pkg/observatory/lib/src/elements/error_view.dart:56-75 | pkg/observatory/lib/src/elements/general_error.dart:58-74 | pkg/observatory/lib/src/elements/isolate_reconnect.dart:75-119 | pkg/observatory/lib/src/elements/json_view.dart:57-71 | pkg/observatory/lib/src/elements/vm_connect.dart:62-121 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/observatory/lib/src/elements/icdata_view.dart:90— pkg/observatory/lib/src/elements/icdata_view.dart:90-195 | pkg/observatory/lib/src/elements/library_view.dart:111-198 | pkg/observatory/lib/src/elements/singletargetcache_view.dart:95-180 | pkg/observatory/lib/src/elements/subtypetestcache_view.dart:92-149 | pkg/observatory/lib/src/elements/unlinkedcall_view.dart:91-160 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/observatory/lib/src/elements/library_view.dart:210— pkg/observatory/lib/src/elements/library_view.dart:210-242 | pkg/observatory/lib/src/elements/library_view.dart:244-267 | pkg/observatory/lib/src/elements/library_view.dart:269-288 | pkg/observatory/lib/src/elements/library_view.dart:290-335 | pkg/observatory/lib/src/elements/library_view.dart:337-360 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/observatory/lib/src/elements/nav/notify_event.dart:90— pkg/observatory/lib/src/elements/nav/notify_event.dart:90-105 | pkg/observatory/lib/src/elements/nav/notify_event.dart:107-122 | pkg/observatory/lib/src/elements/nav/notify_event.dart:147-164 | pkg/observatory/lib/src/elements/nav/notify_event.dart:166-183 | pkg/observatory/lib/src/elements/nav/notify_event.dart:185-200 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) pkg/test_runner/lib/src/runtime_configuration.dart:437— pkg/test_runner/lib/src/runtime_configuration.dart:437-472 | pkg/test_runner/lib/src/runtime_configuration.dart:479-508 | pkg/test_runner/lib/src/runtime_configuration.dart:512-539 | pkg/test_runner/lib/src/runtime_configuration.dart:547-574 | pkg/test_runner/lib/src/runtime_configuration.dart:582-626 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (14 lines × 3) pkg/analyzer/lib/src/binary/binary_reader.dart:246— pkg/analyzer/lib/src/binary/binary_reader.dart:246-259 | pkg/dart2bytecode/lib/bytecode_serialization.dart:313-326 | pkg/kernel/lib/binary/ast_from_binary.dart:219-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (14 lines × 3) pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:39— pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:39-52 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:117-130 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:195-208 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart:352— sdk/lib/_internal/js_dev_runtime/patch/developer_patch.dart:352-365 | sdk/lib/_internal/js_runtime/lib/developer_patch.dart:321-334 | sdk/lib/_internal/wasm/standalone/developer_patch.dart:140-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (14 lines × 3) pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart:71— pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart:71-84 | pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart:56-69 | pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart:51-64 — before extracting anything, compare `pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart` and `pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 3) pkg/analyzer/lib/src/dart/analysis/index.dart:831— pkg/analyzer/lib/src/dart/analysis/index.dart:831-844 | pkg/analyzer/lib/src/dart/analysis/index.dart:1157-1170 | pkg/analyzer/lib/src/dart/analysis/index.dart:1235-1248 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/analyzer/lib/src/fine/manifest_item.dart:251— pkg/analyzer/lib/src/fine/manifest_item.dart:251-264 | pkg/analyzer/lib/src/fine/manifest_item.dart:440-453 | pkg/analyzer/lib/src/fine/manifest_item.dart:1341-1354 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/compiler/lib/src/js_model/env.dart:802— pkg/compiler/lib/src/js_model/env.dart:802-815 | pkg/compiler/lib/src/js_model/env.dart:1037-1050 | pkg/compiler/lib/src/js_model/env.dart:1083-1096 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/dartdev/lib/src/commands/dart_mcp_server.dart:56— pkg/dartdev/lib/src/commands/dart_mcp_server.dart:56-69 | pkg/dartdev/lib/src/commands/development_service.dart:49-62 | pkg/dartdev/lib/src/commands/tooling_daemon.dart:43-56 — before extracting anything, compare `pkg/dartdev/lib/src/commands/development_service.dart` and `pkg/dartdev/lib/src/commands/tooling_daemon.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 3) pkg/front_end/lib/src/kernel/body_builder.dart:10108— pkg/front_end/lib/src/kernel/body_builder.dart:10108-10122 | pkg/front_end/lib/src/kernel/body_builder.dart:10376-10389 | pkg/front_end/lib/src/kernel/body_builder.dart:10454-10468 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/front_end/lib/src/source/outline_builder.dart:1479— pkg/front_end/lib/src/source/outline_builder.dart:1479-1492 | pkg/front_end/lib/src/source/outline_builder.dart:1575-1588 | pkg/front_end/lib/src/source/outline_builder.dart:2848-2861 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6898— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6898-6911 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7106-7119 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7362-7375 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:13826— pkg/front_end/lib/src/type_inference/inference_visitor.dart:13826-13839 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:14112-14125 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:14259-14272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/observatory/lib/src/elements/heap_snapshot.dart:672— pkg/observatory/lib/src/elements/heap_snapshot.dart:672-685 | pkg/observatory/lib/src/elements/isolate/shared_summary.dart:63-76 | pkg/observatory/lib/src/elements/process_snapshot.dart:360-373 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 3) pkg/observatory/lib/src/elements/instance_ref.dart:200— pkg/observatory/lib/src/elements/instance_ref.dart:200-213 | pkg/observatory/lib/src/elements/instance_ref.dart:258-271 | pkg/observatory/lib/src/elements/instance_ref.dart:383-396 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) pkg/front_end/lib/src/fragment/class.dart:40— pkg/front_end/lib/src/fragment/class.dart:40-59 | pkg/front_end/lib/src/fragment/mixin.dart:40-62 | pkg/front_end/lib/src/fragment/named_mixin_application.dart:56-69 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (14 lines × 3) pkg/front_end/parser_testcases/inline_class/extension_type.dart:7— pkg/front_end/parser_testcases/inline_class/extension_type.dart:7-20 | pkg/front_end/parser_testcases/inline_class/extension_type_const.dart:7-20 | pkg/front_end/testcases/extension_types/extension_type_declarations.dart:14-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (14 lines × 3) pkg/front_end/parser_testcases/primary_constructors/constructor_head.dart:4— pkg/front_end/parser_testcases/primary_constructors/constructor_head.dart:4-17 | pkg/front_end/parser_testcases/primary_constructors/constructor_head_pre_feature.dart:6-19 | pkg/front_end/testcases/primary_constructors/constructor_head.dart:15-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (12 lines × 3) pkg/front_end/testcases/inference/infer_assign_to_property_null_aware_upwards.dart:64— pkg/front_end/testcases/inference/infer_assign_to_property_null_aware_upwards.dart:64-75 | pkg/front_end/testcases/inference_new/infer_assign_to_property_null_aware_upwards.dart:43-54 | pkg/front_end/testcases/inference_new/infer_assign_to_property_null_aware_upwards.dart:64-75 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (12 lines × 3) pkg/kernel/lib/type_algebra.dart:1018— pkg/kernel/lib/type_algebra.dart:1018-1029 | pkg/kernel/lib/type_algebra.dart:1369-1380 | pkg/kernel/lib/type_algebra.dart:1674-1685 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) sdk/lib/_internal/js_dev_runtime/private/string_helper.dart:97— sdk/lib/_internal/js_dev_runtime/private/string_helper.dart:97-108 | sdk/lib/_internal/js_runtime/lib/string_helper.dart:110-121 | sdk/lib/_internal/wasm/common/string_helper.dart:70-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (12 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1326— sdk/lib/_internal/vm/lib/convert_patch.dart:1326-1337 | sdk/lib/_internal/wasm/common/convert_patch.dart:1512-1523 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1204-1215 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 3) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7338— pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7338-7349 | pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8047-8058 | pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8070-8081 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) pkg/analysis_server/lib/src/protocol/protocol_internal.dart:286— pkg/analysis_server/lib/src/protocol/protocol_internal.dart:286-297 | pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart:538-549 | pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart:621-632 — before extracting anything, compare `pkg/analysis_server/lib/src/protocol/protocol_internal.dart` and `pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 3) pkg/analyzer/lib/src/analysis_options/analysis_options.dart:265— pkg/analyzer/lib/src/analysis_options/analysis_options.dart:265-276 | pkg/compiler/lib/src/kernel/kernel_world.dart:114-125 | pkg/kernel/lib/src/ast/patterns.dart:513-524 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (12 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:25569— pkg/analyzer/lib/src/dart/ast/ast.dart:25569-25580 | pkg/analyzer/lib/src/dart/ast/ast.dart:26223-26234 | pkg/analyzer/lib/src/dart/ast/ast.dart:37136-37147 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) pkg/analyzer/lib/src/dart/constant/value.dart:2055— pkg/analyzer/lib/src/dart/constant/value.dart:2055-2066 | pkg/analyzer/lib/src/dart/constant/value.dart:2332-2343 | pkg/analyzer/lib/src/dart/constant/value.dart:2432-2443 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) pkg/analyzer/lib/src/summary2/bundle_writer.dart:272— pkg/analyzer/lib/src/summary2/bundle_writer.dart:272-283 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:379-390 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:667-678 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) pkg/analyzer/lib/src/summary2/bundle_writer.dart:300— pkg/analyzer/lib/src/summary2/bundle_writer.dart:300-311 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:405-416 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:695-706 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) pkg/dartdev/lib/src/templates/cli.dart:11— pkg/dartdev/lib/src/templates/cli.dart:11-22 | pkg/dartdev/lib/src/templates/console.dart:11-22 | pkg/dartdev/lib/src/templates/web.dart:13-24 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (12 lines × 3) pkg/front_end/lib/src/codes/type_labeler.dart:137— pkg/front_end/lib/src/codes/type_labeler.dart:137-148 | pkg/front_end/lib/src/codes/type_labeler.dart:294-305 | pkg/front_end/lib/src/codes/type_labeler.dart:329-340 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:613— pkg/front_end/lib/src/fragment/getter/encoding.dart:613-624 | pkg/front_end/lib/src/fragment/method/encoding.dart:632-643 | pkg/front_end/lib/src/fragment/setter/encoding.dart:662-673 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:353— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:353-364 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:349-360 | sdk/lib/_internal/wasm/common/io_patch.dart:349-360 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:716— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:716-727 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:712-723 | sdk/lib/_internal/wasm/common/io_patch.dart:712-723 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) sdk/lib/_http/http_impl.dart:1040— sdk/lib/_http/http_impl.dart:1040-1063 | sdk/lib/io/io_sink.dart:233-256 — before extracting anything, compare `sdk/lib/_http/http_impl.dart` and `sdk/lib/io/io_sink.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:226— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:226-249 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:226-249 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) sdk/lib/internal/sort.dart:263— sdk/lib/internal/sort.dart:263-286 | sdk/lib/internal/sort.dart:357-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:512— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:512-535 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1187-1210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:7798— pkg/analyzer/lib/src/dart/ast/ast.dart:7798-7821 | pkg/analyzer/lib/src/dart/ast/ast.dart:8311-8334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/analyzer/lib/src/fine/library_manifest.dart:1864— pkg/analyzer/lib/src/fine/library_manifest.dart:1864-1887 | pkg/analyzer/lib/src/fine/library_manifest.dart:1920-1943 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/compiler/lib/src/serialization/strategies.dart:145— pkg/compiler/lib/src/serialization/strategies.dart:145-168 | pkg/compiler/lib/src/serialization/strategies.dart:238-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/dev_compiler/lib/src/js_ast/template.dart:74— pkg/dev_compiler/lib/src/js_ast/template.dart:74-97 | pkg/js_ast/lib/src/template.dart:72-95 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/template.dart` and `pkg/js_ast/lib/src/template.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2668— pkg/dev_compiler/lib/src/kernel/compiler.dart:2668-2691 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2978-3001 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6156— pkg/dev_compiler/lib/src/kernel/compiler.dart:6156-6179 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6845-6868 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8193— pkg/dev_compiler/lib/src/kernel/compiler.dart:8193-8216 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:9062-9085 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (24 lines × 2) pkg/front_end/lib/src/fragment/constructor/encoding.dart:972— pkg/front_end/lib/src/fragment/constructor/encoding.dart:972-995 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:1070-1093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/front_end/lib/src/type_inference/object_access_target.dart:1258— pkg/front_end/lib/src/type_inference/object_access_target.dart:1258-1281 | pkg/front_end/lib/src/type_inference/object_access_target.dart:1285-1308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) pkg/front_end/testcases/dart2js/issue54115.dart:9— pkg/front_end/testcases/dart2js/issue54115.dart:9-32 | pkg/front_end/testcases/patterns/issue54115.dart:9-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13–14 lines × 2) pkg/dart2wasm/lib/async.dart:392— pkg/dart2wasm/lib/async.dart:392-405 | pkg/dart2wasm/lib/sync_star.dart:295-307 — before extracting anything, compare `pkg/dart2wasm/lib/async.dart` and `pkg/dart2wasm/lib/sync_star.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13–14 lines × 2) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:717— pkg/native_compiler/lib/back_end/arm64/code_generator.dart:717-730 | pkg/native_compiler/lib/back_end/arm64/code_generator.dart:747-759 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/analyzer/lib/src/dart/analysis/library_context.dart:579— pkg/analyzer/lib/src/dart/analysis/library_context.dart:579-591 | pkg/analyzer/lib/src/dart/analysis/library_diagnostics.dart:55-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13–14 lines × 2) pkg/analyzer/lib/src/generated/error_verifier.dart:1005— pkg/analyzer/lib/src/generated/error_verifier.dart:1005-1017 | pkg/analyzer/lib/src/generated/error_verifier.dart:1136-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/analyzer/lib/src/summary2/element_builder.dart:1352— pkg/analyzer/lib/src/summary2/element_builder.dart:1352-1364 | pkg/analyzer/lib/src/summary2/element_builder.dart:1663-1676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/compiler/lib/src/inferrer/builder.dart:1195— pkg/compiler/lib/src/inferrer/builder.dart:1195-1207 | pkg/compiler/lib/src/inferrer/builder.dart:1212-1225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/compiler/lib/src/js_backend/string_reference.dart:386— pkg/compiler/lib/src/js_backend/string_reference.dart:386-398 | pkg/compiler/lib/src/js_backend/type_reference.dart:451-464 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13–14 lines × 2) pkg/front_end/lib/src/builder/named_type_builder.dart:1180— pkg/front_end/lib/src/builder/named_type_builder.dart:1180-1192 | pkg/front_end/lib/src/builder/named_type_builder.dart:1208-1221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/front_end/lib/src/codes/type_labeler.dart:518— pkg/front_end/lib/src/codes/type_labeler.dart:518-530 | pkg/front_end/lib/src/codes/type_labeler.dart:536-549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:603— pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:603-615 | pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:1024-1037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/observatory/lib/src/elements/field_ref.dart:59— pkg/observatory/lib/src/elements/field_ref.dart:59-71 | pkg/observatory/lib/src/elements/field_view.dart:108-121 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13–14 lines × 2) pkg/observatory/lib/src/elements/script_inset.dart:413— pkg/observatory/lib/src/elements/script_inset.dart:413-425 | pkg/observatory/lib/src/elements/script_inset.dart:428-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/observatory/lib/src/sample_profile/sample_profile.dart:155— pkg/observatory/lib/src/sample_profile/sample_profile.dart:155-167 | pkg/observatory/lib/src/sample_profile/sample_profile.dart:474-487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) pkg/wasm_builder/lib/src/ir/element.dart:51— pkg/wasm_builder/lib/src/ir/element.dart:51-64 | pkg/wasm_builder/lib/src/ir/element.dart:113-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 3) sdk/lib/_internal/wasm/common/simd.dart:96— sdk/lib/_internal/wasm/common/simd.dart:96-103 | sdk/lib/_internal/wasm/common/simd.dart:199-209 | sdk/lib/_internal/wasm/common/simd.dart:299-309 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:842— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:842-852 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1218-1225 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1263-1270 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart:156— pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart:156-163 | pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart:197-204 | pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart:439-446 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:371— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:371-378 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:375-382 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1415-1422 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:464— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:464-471 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:460-467 | sdk/lib/_internal/wasm/common/io_patch.dart:460-467 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 3) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:227— sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:227-234 | sdk/lib/_internal/js_dev_runtime/private/custom_hash_set.dart:146-153 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:253-260 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:218— sdk/lib/_internal/vm/lib/convert_patch.dart:218-225 | sdk/lib/_internal/wasm/common/convert_patch.dart:271-278 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:184-191 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 3) pkg/front_end/lib/src/builder/dynamic_type_declaration_builder.dart:15— pkg/front_end/lib/src/builder/dynamic_type_declaration_builder.dart:15-22 | pkg/front_end/lib/src/builder/invalid_builder.dart:92-101 | pkg/front_end/lib/src/builder/null_type_declaration_builder.dart:47-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart:30— pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart:30-37 | pkg/linter/lib/src/rules/avoid_catching_errors.dart:27-34 | pkg/linter/lib/src/rules/empty_catches.dart:24-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) pkg/linter/lib/src/rules/exhaustive_cases.dart:26— pkg/linter/lib/src/rules/exhaustive_cases.dart:26-33 | pkg/linter/lib/src/rules/no_default_cases.dart:32-39 | pkg/linter/lib/src/rules/no_duplicate_case_values.dart:24-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) pkg/linter/lib/src/rules/library_names.dart:24— pkg/linter/lib/src/rules/library_names.dart:24-31 | pkg/linter/lib/src/rules/package_prefixed_library_names.dart:30-37 | pkg/linter/lib/src/rules/unnecessary_library_directive.dart:26-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) pkg/linter/lib/src/rules/only_throw_errors.dart:39— pkg/linter/lib/src/rules/only_throw_errors.dart:39-46 | pkg/linter/lib/src/rules/throw_in_finally.dart:24-31 | pkg/linter/lib/src/rules/use_rethrow_when_possible.dart:24-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) pkg/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart:28— pkg/linter/lib/src/rules/prefer_if_elements_to_conditional_expressions.dart:28-35 | pkg/linter/lib/src/rules/prefer_if_null_operators.dart:24-31 | pkg/linter/lib/src/rules/prefer_null_aware_operators.dart:25-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) pkg/linter/lib/src/rules/sized_box_for_whitespace.dart:36— pkg/linter/lib/src/rules/sized_box_for_whitespace.dart:36-43 | pkg/linter/lib/src/rules/use_colored_box.dart:37-44 | pkg/linter/lib/src/rules/use_decorated_box.dart:36-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 4) sdk/lib/_internal/vm/lib/growable_array.dart:614— sdk/lib/_internal/vm/lib/growable_array.dart:614-622 | sdk/lib/_internal/vm/lib/growable_array.dart:628-636 | sdk/lib/_internal/vm/lib/growable_array.dart:643-651 | sdk/lib/_internal/vm/lib/growable_array.dart:668-676 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:643— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:643-651 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:681-689 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1098-1106 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1126-1134 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) sdk/lib/_internal/wasm/common/compact_hash.dart:608— sdk/lib/_internal/wasm/common/compact_hash.dart:608-616 | sdk/lib/_internal/wasm/common/compact_hash.dart:638-646 | sdk/lib/_internal/wasm/common/compact_hash.dart:1018-1026 | sdk/lib/_internal/wasm/common/compact_hash.dart:1047-1055 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) pkg/analyzer/lib/src/dart/constant/value.dart:2167— pkg/analyzer/lib/src/dart/constant/value.dart:2167-2175 | pkg/analyzer/lib/src/dart/constant/value.dart:2189-2197 | pkg/analyzer/lib/src/dart/constant/value.dart:2265-2273 | pkg/analyzer/lib/src/dart/constant/value.dart:2287-2295 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) pkg/compiler/lib/src/js_model/elements.dart:600— pkg/compiler/lib/src/js_model/elements.dart:600-608 | pkg/compiler/lib/src/js_model/elements.dart:733-741 | pkg/compiler/lib/src/js_model/elements.dart:811-819 | pkg/compiler/lib/src/js_model/elements.dart:887-895 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:71— pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:71-79 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:124-132 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:171-179 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:218-226 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) pkg/compiler/lib/src/ssa/codegen_helpers.dart:568— pkg/compiler/lib/src/ssa/codegen_helpers.dart:568-576 | pkg/compiler/lib/src/ssa/codegen_helpers.dart:600-608 | pkg/compiler/lib/src/ssa/codegen_helpers.dart:1606-1614 | pkg/compiler/lib/src/ssa/late_field_optimizer.dart:48-56 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 4) pkg/front_end/lib/src/builder/fixed_type_builder.dart:127— pkg/front_end/lib/src/builder/fixed_type_builder.dart:127-136 | pkg/front_end/lib/src/builder/invalid_type_builder.dart:101-109 | pkg/front_end/lib/src/builder/omitted_type_builder.dart:84-92 | pkg/front_end/lib/src/builder/void_type_builder.dart:118-126 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (9 lines × 4) pkg/front_end/lib/src/fragment/enum_element.dart:168— pkg/front_end/lib/src/fragment/enum_element.dart:168-176 | pkg/front_end/lib/src/fragment/field/declaration.dart:689-697 | pkg/front_end/lib/src/fragment/primary_constructor_field.dart:171-179 | pkg/front_end/lib/src/source/source_enum_builder.dart:828-836 — before extracting anything, compare `pkg/front_end/lib/src/fragment/enum_element.dart` and `pkg/front_end/lib/src/fragment/field/declaration.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 4) pkg/dart2wasm/lib/async.dart:152— pkg/dart2wasm/lib/async.dart:152-160 | pkg/dart2wasm/lib/async.dart:171-179 | pkg/dart2wasm/lib/async.dart:190-198 | pkg/dart2wasm/lib/sync_star.dart:139-147 — before extracting anything, compare `pkg/dart2wasm/lib/async.dart` and `pkg/dart2wasm/lib/sync_star.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 4) pkg/analyzer/lib/src/dart/element/type_schema.dart:42— pkg/analyzer/lib/src/dart/element/type_schema.dart:42-50 | pkg/analyzer/lib/src/summary2/function_type_builder.dart:60-68 | pkg/analyzer/lib/src/summary2/named_type_builder.dart:93-101 | pkg/analyzer/lib/src/summary2/record_type_builder.dart:56-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (9 lines × 4) pkg/linter/lib/src/rules/empty_container_bodies.dart:30— pkg/linter/lib/src/rules/empty_container_bodies.dart:30-38 | pkg/linter/lib/src/rules/initialize_in_field_declaration.dart:30-38 | pkg/linter/lib/src/rules/unnecessary_breaks.dart:24-33 | pkg/linter/lib/src/rules/use_declaring_parameters.dart:30-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (9 lines × 4) pkg/linter/lib/src/rules/omit_local_variable_types.dart:32— pkg/linter/lib/src/rules/omit_local_variable_types.dart:32-40 | pkg/linter/lib/src/rules/prefer_collection_literals.dart:27-35 | pkg/linter/lib/src/rules/unnecessary_await_in_return.dart:30-38 | pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart:32-40 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (26 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart:57— sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart:57-82 | sdk/lib/_internal/js_runtime/lib/js_patch.dart:153-178 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart` and `sdk/lib/_internal/js_runtime/lib/js_patch.dart` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart:106— sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart:106-131 | sdk/lib/_internal/wasm/standalone/boxed_double_patch.dart:59-84 — `sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart` and `sdk/lib/_internal/wasm/standalone/boxed_double_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 76 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (26 lines × 2) pkg/analyzer/lib/src/dart/ast/utilities.dart:117— pkg/analyzer/lib/src/dart/ast/utilities.dart:117-142 | pkg/analyzer/lib/src/dart/ast/utilities.dart:268-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) pkg/compiler/lib/src/js_backend/enqueuer.dart:207— pkg/compiler/lib/src/js_backend/enqueuer.dart:207-232 | pkg/compiler/lib/src/resolution/enqueuer.dart:230-255 — `pkg/compiler/lib/src/js_backend/enqueuer.dart` and `pkg/compiler/lib/src/resolution/enqueuer.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 60 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (26 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2277— pkg/dev_compiler/lib/src/kernel/compiler.dart:2277-2302 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2577-2602 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4216— pkg/dev_compiler/lib/src/kernel/compiler.dart:4216-4241 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4812-4837 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7670— pkg/dev_compiler/lib/src/kernel/compiler.dart:7670-7695 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8537-8562 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8315— pkg/dev_compiler/lib/src/kernel/compiler.dart:8315-8340 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:9184-9209 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4630— pkg/front_end/lib/src/kernel/constant_evaluator.dart:4630-4655 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:4660-4685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) pkg/front_end/lib/src/type_inference/element_inference.dart:172— pkg/front_end/lib/src/type_inference/element_inference.dart:172-197 | pkg/front_end/lib/src/type_inference/element_inference.dart:461-486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) pkg/front_end/testcases/nnbd/required.dart:10— pkg/front_end/testcases/nnbd/required.dart:10-35 | pkg/front_end/testcases/nnbd/required_2_legacy.dart:11-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (26 lines × 2) pkg/vm/lib/modular/target/flutter_runner.dart:16— pkg/vm/lib/modular/target/flutter_runner.dart:16-43 | pkg/vm/lib/modular/target/vm.dart:87-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2107— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2107-2119 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:2125-2137 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:3030-3042 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:366— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:366-378 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:362-374 | sdk/lib/_internal/wasm/common/io_patch.dart:362-374 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:380— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:380-392 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:376-388 | sdk/lib/_internal/wasm/common/io_patch.dart:376-388 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 3) sdk/lib/_internal/wasm/js/string_patch.dart:55— sdk/lib/_internal/wasm/js/string_patch.dart:55-67 | sdk/lib/_internal/wasm/js/string_patch.dart:106-118 | sdk/lib/_internal/wasm/standalone/string_patch.dart:68-80 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 3) pkg/analysis_server/lib/protocol/protocol.dart:179— pkg/analysis_server/lib/protocol/protocol.dart:179-191 | pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:163-175 | pkg/analyzer_plugin/lib/protocol/protocol.dart:193-205 — before extracting anything, compare `pkg/analysis_server/lib/protocol/protocol.dart` and `pkg/analysis_server_client/lib/src/protocol/protocol_base.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:9779— pkg/analyzer/lib/src/dart/ast/ast.dart:9779-9791 | pkg/analyzer/lib/src/dart/ast/ast.dart:14090-14102 | pkg/analyzer/lib/src/dart/ast/ast.dart:27850-27862 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:28047— pkg/analyzer/lib/src/dart/ast/ast.dart:28047-28059 | pkg/analyzer/lib/src/dart/ast/ast.dart:34809-34821 | pkg/analyzer/lib/src/dart/ast/ast.dart:35422-35434 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) pkg/analyzer/lib/src/summary2/bundle_reader.dart:466— pkg/analyzer/lib/src/summary2/bundle_reader.dart:466-478 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:622-634 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1075-1087 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) pkg/front_end/lib/src/kernel/expression_generator.dart:2866— pkg/front_end/lib/src/kernel/expression_generator.dart:2866-2878 | pkg/front_end/lib/src/kernel/expression_generator.dart:3337-3349 | pkg/front_end/lib/src/kernel/expression_generator.dart:3695-3707 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) pkg/front_end/lib/src/type_inference/collection_encoding.dart:1038— pkg/front_end/lib/src/type_inference/collection_encoding.dart:1038-1050 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1589-1601 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1900-1912 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6428— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6428-6440 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6532-6544 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6774-6786 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8520— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8520-8532 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8721-8733 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8979-8991 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (29 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:990— pkg/analyzer/tool/generators/ast_generator.dart:990-1018 | pkg/analyzer/tool/generators/ast_generator.dart:1054-1082 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_implicit_this.dart:26— pkg/front_end/testcases/inference/infer_assign_to_implicit_this.dart:26-54 | pkg/front_end/testcases/inference_new/infer_assign_to_implicit_this.dart:24-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (29 lines × 2) pkg/front_end/testcases/inference/infer_assign_to_property_super.dart:30— pkg/front_end/testcases/inference/infer_assign_to_property_super.dart:30-58 | pkg/front_end/testcases/inference_new/infer_assign_to_property_super.dart:26-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (29 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:370— pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:370-398 | pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart:50-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (29 lines × 2) pkg/analyzer/lib/src/generated/resolver.dart:2559— pkg/analyzer/lib/src/generated/resolver.dart:2559-2587 | pkg/analyzer/lib/src/generated/resolver.dart:4520-4548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) pkg/compiler/lib/src/kernel/kernel_impact.dart:188— pkg/compiler/lib/src/kernel/kernel_impact.dart:188-216 | pkg/compiler/lib/src/kernel/kernel_impact.dart:256-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5560— pkg/dev_compiler/lib/src/kernel/compiler.dart:5560-5588 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6175-6203 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (29 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6487— pkg/dev_compiler/lib/src/kernel/compiler.dart:6487-6515 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7176-7204 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (29 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7431— pkg/dev_compiler/lib/src/kernel/compiler.dart:7431-7459 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8298-8326 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (29 lines × 2) pkg/front_end/lib/src/fragment/method/encoding.dart:232— pkg/front_end/lib/src/fragment/method/encoding.dart:232-260 | pkg/front_end/lib/src/fragment/method/encoding.dart:595-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:3356— pkg/front_end/lib/src/type_inference/inference_visitor.dart:3356-3384 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5131-5159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/dart2wasm/lib/functions.dart:615— pkg/dart2wasm/lib/functions.dart:615-631 | pkg/dart2wasm/lib/functions.dart:672-689 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/kernel/lib/binary/ast_to_binary.dart:2916— pkg/kernel/lib/binary/ast_to_binary.dart:2916-2932 | pkg/kernel/lib/binary/ast_to_binary.dart:2964-2981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart:108— pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart:108-125 | pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter_named.dart:170-186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:56— pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:56-72 | pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart:77-94 — before extracting anything, compare `pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart` and `pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:482— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:482-499 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:631-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart:28— pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart:28-44 | pkg/dds/lib/src/devtools/memory_profile.dart:30-47 — before extracting anything, compare `pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart` and `pkg/dds/lib/src/devtools/memory_profile.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) pkg/front_end/lib/src/base/name_space.dart:80— pkg/front_end/lib/src/base/name_space.dart:80-97 | pkg/front_end/lib/src/base/name_space.dart:124-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:7450— pkg/front_end/lib/src/kernel/body_builder.dart:7450-7467 | pkg/front_end/lib/src/kernel/body_builder.dart:7555-7571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:10372— pkg/front_end/lib/src/kernel/body_builder.dart:10372-10388 | pkg/front_end/lib/src/kernel/body_builder.dart:10450-10467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/front_end/lib/src/source/source_class_builder.dart:1659— pkg/front_end/lib/src/source/source_class_builder.dart:1659-1675 | pkg/front_end/lib/src/source/source_class_builder.dart:1747-1764 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) pkg/kernel/lib/src/tool/check_equivalence.dart:296— pkg/kernel/lib/src/tool/check_equivalence.dart:296-313 | pkg/kernel/lib/src/tool/check_equivalence.dart:365-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 3) pkg/kernel/lib/src/ast/types.dart:1314— pkg/kernel/lib/src/ast/types.dart:1314-1319 | pkg/kernel/lib/src/ast/types.dart:1676-1681 | pkg/kernel/lib/src/ast/types.dart:1938-1943 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) pkg/kernel/lib/src/merge_visitor.dart:242— pkg/kernel/lib/src/merge_visitor.dart:242-247 | pkg/kernel/lib/src/merge_visitor.dart:282-287 | pkg/kernel/lib/src/merge_visitor.dart:482-487 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) pkg/observatory/lib/src/elements/context_view.dart:93— pkg/observatory/lib/src/elements/context_view.dart:93-98 | pkg/observatory/lib/src/elements/cpu_profile.dart:82-87 | pkg/observatory/lib/src/elements/cpu_profile_table.dart:98-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2015— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2015-2020 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:2033-2038 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2644-2649 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:84— sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:84-89 | sdk/lib/_internal/js_dev_runtime/private/identity_hash_map.dart:40-45 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:124-129 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1562— sdk/lib/_internal/vm/lib/convert_patch.dart:1562-1567 | sdk/lib/_internal/vm/lib/convert_patch.dart:1694-1699 | sdk/lib/_internal/wasm/common/convert_patch.dart:2088-2093 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) pkg/front_end/lib/src/fragment/getter.dart:145— pkg/front_end/lib/src/fragment/getter.dart:145-150 | pkg/front_end/lib/src/fragment/method.dart:143-148 | pkg/front_end/lib/src/fragment/setter.dart:156-161 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) pkg/front_end/lib/src/kernel/internal_ast.dart:8163— pkg/front_end/lib/src/kernel/internal_ast.dart:8163-8169 | pkg/front_end/lib/src/kernel/internal_ast.dart:8638-8644 | pkg/kernel/lib/src/ast/initializers.dart:97-102 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) pkg/front_end/lib/src/kernel/internal_ast.dart:9007— pkg/front_end/lib/src/kernel/internal_ast.dart:9007-9013 | pkg/kernel/lib/src/ast/constants.dart:247-252 | pkg/kernel/lib/src/ast/expressions.dart:4163-4168 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) pkg/compiler/lib/src/inferrer/typemasks/forwarding_type_mask.dart:172— pkg/compiler/lib/src/inferrer/typemasks/forwarding_type_mask.dart:172-177 | pkg/compiler/lib/src/inferrer/typemasks/set_type_mask.dart:87-92 | pkg/compiler/lib/src/inferrer/typemasks/value_type_mask.dart:61-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) REDACTED:1964— REDACTED:1964-1969 | REDACTED:2109-2114 | REDACTED:2156-2161 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1413— sdk/lib/_internal/vm/lib/convert_patch.dart:1413-1427 | sdk/lib/_internal/wasm/common/convert_patch.dart:1599-1613 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1291-1305 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 3) pkg/analysis_server/lib/src/status/pages/ast_page.dart:24— pkg/analysis_server/lib/src/status/pages/ast_page.dart:24-38 | pkg/analysis_server/lib/src/status/pages/contents_page.dart:27-41 | pkg/analysis_server/lib/src/status/pages/element_model_page.dart:29-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (15 lines × 3) pkg/analyzer/lib/src/binary/string_table.dart:69— pkg/analyzer/lib/src/binary/string_table.dart:69-83 | pkg/compiler/lib/src/serialization/binary_source.dart:99-113 | pkg/dart2js_info/lib/src/binary/source.dart:256-270 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (15 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:17528— pkg/analyzer/lib/src/dart/ast/ast.dart:17528-17542 | pkg/analyzer/lib/src/dart/ast/ast.dart:17548-17562 | pkg/analyzer/lib/src/dart/ast/ast.dart:29589-29603 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:20320— pkg/analyzer/lib/src/dart/ast/ast.dart:20320-20334 | pkg/analyzer/lib/src/dart/ast/ast.dart:49470-49484 | pkg/analyzer/lib/src/dart/ast/ast.dart:52968-52982 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:312— pkg/front_end/lib/src/fragment/getter/encoding.dart:312-326 | pkg/front_end/lib/src/fragment/method/encoding.dart:269-283 | pkg/front_end/lib/src/fragment/setter/encoding.dart:337-351 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 3) pkg/front_end/lib/src/fragment/method/encoding.dart:1031— pkg/front_end/lib/src/fragment/method/encoding.dart:1031-1045 | pkg/front_end/lib/src/fragment/util.dart:181-195 | pkg/front_end/lib/src/fragment/util.dart:207-221 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (15 lines × 3) pkg/front_end/lib/src/fragment/method/encoding.dart:1157— pkg/front_end/lib/src/fragment/method/encoding.dart:1157-1171 | pkg/front_end/lib/src/fragment/util.dart:261-275 | pkg/front_end/lib/src/fragment/util.dart:287-301 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (15 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:12619— pkg/front_end/lib/src/type_inference/inference_visitor.dart:12619-12633 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:13034-13048 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:13189-13203 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) pkg/front_end/lib/src/type_inference/object_access_target.dart:1264— pkg/front_end/lib/src/type_inference/object_access_target.dart:1264-1278 | pkg/front_end/lib/src/type_inference/object_access_target.dart:1291-1305 | pkg/front_end/lib/src/type_inference/object_access_target.dart:1343-1357 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–13 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2616— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2616-2628 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:2126-2137 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12–13 lines × 2) pkg/analysis_server/lib/src/handler/legacy/edit_organize_directives.dart:40— pkg/analysis_server/lib/src/handler/legacy/edit_organize_directives.dart:40-51 | pkg/analysis_server/lib/src/handler/legacy/edit_sort_members.dart:40-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12–13 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:144— pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:144-155 | pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:182-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:787— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:787-799 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:865-876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) pkg/compiler/lib/src/js_backend/string_reference.dart:361— pkg/compiler/lib/src/js_backend/string_reference.dart:361-373 | pkg/compiler/lib/src/js_backend/type_reference.dart:430-441 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12–13 lines × 2) pkg/front_end/lib/src/kernel/internal_ast.dart:6694— pkg/front_end/lib/src/kernel/internal_ast.dart:6694-6705 | pkg/kernel/lib/src/ast/types.dart:1565-1577 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–13 lines × 2) pkg/front_end/lib/src/source/diet_listener.dart:750— pkg/front_end/lib/src/source/diet_listener.dart:750-762 | pkg/front_end/lib/src/source/diet_listener.dart:905-916 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) pkg/front_end/lib/src/type_inference/type_schema_environment.dart:105— pkg/front_end/lib/src/type_inference/type_schema_environment.dart:105-117 | pkg/front_end/lib/src/type_inference/type_schema_environment.dart:136-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart:26— pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart:26-37 | pkg/linter/lib/src/rules/remove_deprecations_in_breaking_version.dart:37-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–13 lines × 2) pkg/observatory/lib/src/sample_profile/sample_profile.dart:138— pkg/observatory/lib/src/sample_profile/sample_profile.dart:138-149 | pkg/observatory/lib/src/sample_profile/sample_profile.dart:454-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 4) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:158— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:158-167 | pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:170-179 | pkg/front_end/tool/fuzz/analyzer_helper.dart:398-407 | pkg/front_end/tool/fuzz/analyzer_helper.dart:410-419 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart` and `pkg/front_end/tool/fuzz/analyzer_helper.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 4) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:580— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:580-589 | sdk/lib/_internal/js_runtime/lib/js_number.dart:670-679 | sdk/lib/_internal/vm/lib/integers.dart:489-498 | sdk/lib/_internal/wasm/common/boxed_int.dart:382-391 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 4) pkg/native_compiler/lib/snapshot/snapshot.dart:1958— pkg/native_compiler/lib/snapshot/snapshot.dart:1958-1967 | pkg/native_compiler/lib/snapshot/snapshot.dart:2010-2019 | pkg/native_compiler/lib/snapshot/snapshot.dart:2068-2077 | pkg/native_compiler/lib/snapshot/snapshot.dart:2142-2151 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:13017— pkg/analyzer/lib/src/dart/ast/ast.dart:13017-13026 | pkg/analyzer/lib/src/dart/ast/ast.dart:19471-19480 | pkg/analyzer/lib/src/dart/ast/ast.dart:19628-19637 | pkg/analyzer/lib/src/dart/ast/ast.dart:39141-39150 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:167— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:167-176 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:181-190 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:195-204 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:211-220 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/analyzer/lib/src/fine/manifest_item.dart:59— pkg/analyzer/lib/src/fine/manifest_item.dart:59-68 | pkg/analyzer/lib/src/fine/manifest_item.dart:251-260 | pkg/analyzer/lib/src/fine/manifest_item.dart:440-449 | pkg/analyzer/lib/src/fine/manifest_item.dart:1341-1350 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:210— pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:210-219 | pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:826-835 | pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:1604-1613 | pkg/analyzer/lib/src/summary2/ast_binary_reader.dart:2029-2038 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/analyzer/lib/src/summary2/element_builder.dart:1630— pkg/analyzer/lib/src/summary2/element_builder.dart:1630-1639 | pkg/analyzer/lib/src/summary2/element_builder.dart:1837-1846 | pkg/analyzer/lib/src/summary2/element_builder.dart:1888-1897 | pkg/analyzer/lib/src/summary2/element_builder.dart:1978-1987 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/analyzer/lib/src/summary2/informative_data.dart:292— pkg/analyzer/lib/src/summary2/informative_data.dart:292-301 | pkg/analyzer/lib/src/summary2/informative_data.dart:327-336 | pkg/analyzer/lib/src/summary2/informative_data.dart:356-365 | pkg/analyzer/lib/src/summary2/informative_data.dart:486-495 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) pkg/kernel/lib/testing/type_parser.dart:104— pkg/kernel/lib/testing/type_parser.dart:104-113 | pkg/kernel/lib/testing/type_parser.dart:144-153 | pkg/kernel/lib/testing/type_parser.dart:173-182 | pkg/kernel/lib/testing/type_parser.dart:208-217 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:609— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:609-615 | sdk/lib/_internal/js_runtime/lib/js_number.dart:700-706 | sdk/lib/_internal/vm/lib/integers.dart:518-524 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:100— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:100-106 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:116-122 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:266-272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) sdk/lib/_internal/vm_shared/lib/collection_patch.dart:425— sdk/lib/_internal/vm_shared/lib/collection_patch.dart:425-431 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:441-447 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:485-491 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) pkg/cfg/lib/ir/flow_graph_checker.dart:239— pkg/cfg/lib/ir/flow_graph_checker.dart:239-245 | pkg/cfg/lib/ir/flow_graph_checker.dart:256-262 | pkg/cfg/lib/ir/flow_graph_checker.dart:266-272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) pkg/cfg/lib/passes/constant_propagation.dart:388— pkg/cfg/lib/passes/constant_propagation.dart:388-394 | pkg/cfg/lib/passes/constant_propagation.dart:568-574 | pkg/cfg/lib/passes/constant_propagation.dart:599-605 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:444— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:444-450 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:570-576 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:645-651 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:435— sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart:435-441 | sdk/lib/_internal/js_runtime/lib/io_patch.dart:431-437 | sdk/lib/_internal/wasm/common/io_patch.dart:431-437 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart` and `sdk/lib/_internal/js_runtime/lib/io_patch.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 152 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1461— sdk/lib/_internal/vm/lib/convert_patch.dart:1461-1467 | sdk/lib/_internal/wasm/common/convert_patch.dart:1647-1653 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1339-1345 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) pkg/observatory/lib/src/elements/isolate/counter_chart.dart:38— pkg/observatory/lib/src/elements/isolate/counter_chart.dart:38-44 | pkg/observatory/lib/src/elements/isolate_reconnect.dart:67-73 | pkg/observatory/lib/src/elements/script_inset.dart:110-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (7 lines × 3) pkg/analyzer/lib/file_system/memory_file_system.dart:612— pkg/analyzer/lib/file_system/memory_file_system.dart:612-618 | pkg/analyzer/lib/file_system/overlay_file_system.dart:375-381 | pkg/analyzer/lib/file_system/physical_file_system.dart:408-414 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (35 lines × 2) pkg/front_end/testcases/general/lookup.dart:161— pkg/front_end/testcases/general/lookup.dart:161-195 | pkg/front_end/testcases/general/lookup.dart:207-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) pkg/front_end/testcases/general/lookup.dart:453— pkg/front_end/testcases/general/lookup.dart:453-487 | pkg/front_end/testcases/general/lookup.dart:499-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:341— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:341-375 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:344-378 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (35 lines × 2) pkg/dev_compiler/lib/src/js_ast/printer.dart:1943— pkg/dev_compiler/lib/src/js_ast/printer.dart:1943-1977 | pkg/js_ast/lib/src/printer.dart:2125-2159 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/printer.dart` and `pkg/js_ast/lib/src/printer.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 157 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (35 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:1170— pkg/dev_compiler/lib/src/kernel/compiler.dart:1170-1204 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1463-1497 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (35 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2127— pkg/dev_compiler/lib/src/kernel/compiler.dart:2127-2161 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2427-2461 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (35 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:3356— pkg/dev_compiler/lib/src/kernel/compiler.dart:3356-3390 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:3871-3905 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (35 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1502— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1502-1536 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1956-1990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) pkg/kernel/lib/src/standard_bounds.dart:538— pkg/kernel/lib/src/standard_bounds.dart:538-572 | pkg/kernel/lib/src/standard_bounds.dart:942-976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) pkg/front_end/testcases/general/lookup.dart:69— pkg/front_end/testcases/general/lookup.dart:69-102 | pkg/front_end/testcases/general/lookup.dart:114-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) pkg/front_end/testcases/general/lookup.dart:359— pkg/front_end/testcases/general/lookup.dart:359-392 | pkg/front_end/testcases/general/lookup.dart:406-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:2745— sdk/lib/_internal/wasm/common/convert_patch.dart:2745-2778 | sdk/lib/convert/utf.dart:592-625 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (34 lines × 2) pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart:77— pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart:77-110 | pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart:203-236 — before extracting anything, compare `pkg/analysis_server/lib/src/plugin/server_isolate_channel.dart` and `pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (34 lines × 2) pkg/analyzer/lib/src/dart/sdk/sdk.dart:97— pkg/analyzer/lib/src/dart/sdk/sdk.dart:97-130 | pkg/analyzer/lib/src/dart/sdk/sdk.dart:253-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) pkg/compiler/lib/src/js_model/element_map_impl.dart:729— pkg/compiler/lib/src/js_model/element_map_impl.dart:729-762 | pkg/compiler/lib/src/kernel/element_map_impl.dart:400-433 — `pkg/compiler/lib/src/js_model/element_map_impl.dart` and `pkg/compiler/lib/src/kernel/element_map_impl.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 23 separate duplicated blocks between them, totalling at least 317 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (34 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5610— pkg/dev_compiler/lib/src/kernel/compiler.dart:5610-5643 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6240-6273 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (34 lines × 2) pkg/front_end/testcases/constructor_tearoffs/lowering/constructor_member_conflict.dart:7— pkg/front_end/testcases/constructor_tearoffs/lowering/constructor_member_conflict.dart:7-40 | pkg/front_end/testcases/general/constructor_member_conflict.dart:7-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (34 lines × 2) pkg/observatory/lib/src/app/settings.dart:11— pkg/observatory/lib/src/app/settings.dart:11-44 | pkg/observatory/lib/src/repositories/settings.dart:11-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (28 lines × 2) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart:79— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart:79-106 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_with_plugin_that_times_out.dart:80-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (28 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:274— sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart:274-301 | sdk/lib/_internal/js_runtime/lib/convert_patch.dart:274-301 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart` and `sdk/lib/_internal/js_runtime/lib/convert_patch.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:327— pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:327-354 | pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:409-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5031— pkg/dev_compiler/lib/src/kernel/compiler.dart:5031-5058 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5641-5668 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) pkg/front_end/lib/src/source/outline_builder.dart:1099— pkg/front_end/lib/src/source/outline_builder.dart:1099-1126 | pkg/front_end/lib/src/source/outline_builder.dart:1267-1294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8684— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8684-8711 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8938-8965 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 2) pkg/observatory/lib/src/elements/class_instances.dart:290— pkg/observatory/lib/src/elements/class_instances.dart:290-317 | pkg/observatory/lib/src/elements/object_common.dart:182-209 — before extracting anything, compare `pkg/observatory/lib/src/elements/class_instances.dart` and `pkg/observatory/lib/src/elements/object_common.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) pkg/observatory/lib/src/elements/class_instances.dart:326— pkg/observatory/lib/src/elements/class_instances.dart:326-353 | pkg/observatory/lib/src/elements/object_common.dart:217-244 — before extracting anything, compare `pkg/observatory/lib/src/elements/class_instances.dart` and `pkg/observatory/lib/src/elements/object_common.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) pkg/vm/testcases/transformations/type_flow/summary_collector/class_generics_basic.dart:6— pkg/vm/testcases/transformations/type_flow/summary_collector/class_generics_basic.dart:6-33 | pkg/vm/testcases/transformations/type_flow/transformer/class_generics_basic.dart:6-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15–16 lines × 2) sdk/lib/_internal/js_runtime/lib/js_number.dart:600— sdk/lib/_internal/js_runtime/lib/js_number.dart:600-615 | sdk/lib/_internal/vm/lib/integers.dart:420-434 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/js_number.dart` and `sdk/lib/_internal/vm/lib/integers.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15–16 lines × 2) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:577— pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:577-591 | pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:594-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/analyzer/lib/src/summary2/bundle_reader.dart:283— pkg/analyzer/lib/src/summary2/bundle_reader.dart:283-298 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:478-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/compiler/lib/src/ir/scope_visitor.dart:1167— pkg/compiler/lib/src/ir/scope_visitor.dart:1167-1182 | pkg/compiler/lib/src/ir/scope_visitor.dart:1186-1200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/dds/lib/src/devtools/machine_mode_command_handler.dart:103— pkg/dds/lib/src/devtools/machine_mode_command_handler.dart:103-117 | pkg/dds/lib/src/devtools/machine_mode_command_handler.dart:142-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/front_end/lib/src/kernel/hierarchy/hierarchy_node.dart:223— pkg/front_end/lib/src/kernel/hierarchy/hierarchy_node.dart:223-238 | pkg/front_end/lib/src/kernel/hierarchy/hierarchy_node.dart:457-471 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/front_end/lib/src/source/outline_builder.dart:2646— pkg/front_end/lib/src/source/outline_builder.dart:2646-2660 | pkg/front_end/lib/src/source/outline_builder.dart:4679-4694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:3976— pkg/front_end/lib/src/type_inference/inference_visitor.dart:3976-3990 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:4909-4924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) pkg/observatory/lib/src/elements/class_view.dart:489— pkg/observatory/lib/src/elements/class_view.dart:489-504 | pkg/observatory/lib/src/elements/library_view.dart:305-319 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–12 lines × 2) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:223— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:223-234 | pkg/front_end/tool/fuzz/analyzer_helper.dart:443-453 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart` and `pkg/front_end/tool/fuzz/analyzer_helper.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11–12 lines × 2) pkg/dart2wasm/lib/target.dart:503— pkg/dart2wasm/lib/target.dart:503-513 | pkg/dart2wasm/lib/target.dart:522-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) sdk/lib/_http/http_impl.dart:2384— sdk/lib/_http/http_impl.dart:2384-2395 | sdk/lib/_http/http_impl.dart:2398-2408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:114— sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:114-124 | sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:136-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) pkg/dart_runtime_service/lib/src/dart_runtime_service_options.dart:74— pkg/dart_runtime_service/lib/src/dart_runtime_service_options.dart:74-84 | pkg/dwds_test_common/lib/fixtures/utilities.dart:140-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11–12 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart:203— pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart:203-214 | pkg/analysis_server/lib/src/lsp/handlers/handler_states.dart:254-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:1159— pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:1159-1169 | pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:1275-1286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6483— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6483-6494 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8734-8744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–12 lines × 2) pkg/test_runner/lib/src/runtime_configuration.dart:462— pkg/test_runner/lib/src/runtime_configuration.dart:462-472 | pkg/test_runner/lib/src/runtime_configuration.dart:497-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) pkg/dart2bytecode/lib/declarations.dart:451— pkg/dart2bytecode/lib/declarations.dart:451-460 | pkg/dart2bytecode/lib/declarations.dart:650-660 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) pkg/kernel/lib/type_algebra.dart:1064— pkg/kernel/lib/type_algebra.dart:1064-1073 | pkg/kernel/lib/type_algebra.dart:1415-1425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) sdk/lib/_http/http_impl.dart:2215— sdk/lib/_http/http_impl.dart:2215-2225 | sdk/lib/_http/http_impl.dart:2243-2252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) sdk/lib/_internal/js_runtime/lib/js_string.dart:36— sdk/lib/_internal/js_runtime/lib/js_string.dart:36-46 | sdk/lib/_internal/vm/lib/string_patch.dart:914-923 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10–11 lines × 2) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:481— pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:481-490 | pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:514-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart:104— pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart:104-113 | pkg/analysis_server/lib/src/services/correction/dart/use_curly_braces.dart:216-226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:239— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:239-248 | pkg/analyzer/lib/src/dart/resolver/increment_or_decrement_resolver.dart:91-101 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 2) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:960— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:960-969 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:1014-1024 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) pkg/front_end/lib/src/kernel/expression_generator.dart:2673— pkg/front_end/lib/src/kernel/expression_generator.dart:2673-2683 | pkg/front_end/lib/src/kernel/expression_generator.dart:3149-3158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2352— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2352-2378 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1575-1601 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (27 lines × 2) sdk/lib/_internal/vm/lib/convert_patch.dart:1897— sdk/lib/_internal/vm/lib/convert_patch.dart:1897-1923 | sdk/lib/_internal/wasm/common/convert_patch.dart:2420-2446 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (27 lines × 2) pkg/front_end/lib/src/fragment/method/encoding.dart:753— pkg/front_end/lib/src/fragment/method/encoding.dart:753-779 | pkg/front_end/lib/src/fragment/setter/encoding.dart:779-805 — `pkg/front_end/lib/src/fragment/method/encoding.dart` and `pkg/front_end/lib/src/fragment/setter/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 306 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (27 lines × 2) pkg/front_end/lib/src/kernel/expression_generator.dart:5012— pkg/front_end/lib/src/kernel/expression_generator.dart:5012-5038 | pkg/front_end/lib/src/kernel/expression_generator.dart:5073-5099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) pkg/front_end/lib/src/kernel/internal_ast.dart:208— pkg/front_end/lib/src/kernel/internal_ast.dart:208-234 | pkg/front_end/lib/src/kernel/internal_ast.dart:7491-7517 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) pkg/kernel/lib/src/standard_bounds.dart:300— pkg/kernel/lib/src/standard_bounds.dart:300-326 | pkg/kernel/lib/src/standard_bounds.dart:619-645 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) pkg/observatory/lib/src/elements/class_instances.dart:151— pkg/observatory/lib/src/elements/class_instances.dart:151-177 | pkg/observatory/lib/src/elements/object_common.dart:130-156 — before extracting anything, compare `pkg/observatory/lib/src/elements/class_instances.dart` and `pkg/observatory/lib/src/elements/object_common.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (27 lines × 2) pkg/observatory/lib/src/elements/code_view.dart:66— pkg/observatory/lib/src/elements/code_view.dart:66-92 | pkg/observatory/lib/src/elements/object_view.dart:42-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19–20 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1371— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1371-1390 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:972-990 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19–20 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1350— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1350-1369 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:997-1015 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19–20 lines × 2) pkg/front_end/tool/coverage_merger.dart:1168— pkg/front_end/tool/coverage_merger.dart:1168-1187 | pkg/front_end/tool/coverage_merger.dart:1238-1256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_clause.dart:26— pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_clause.dart:26-44 | pkg/analysis_server/lib/src/services/correction/dart/remove_unused_catch_stack.dart:26-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19–20 lines × 2) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:380— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:380-398 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:658-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) pkg/compiler/lib/src/ssa/builder.dart:6157— pkg/compiler/lib/src/ssa/builder.dart:6157-6176 | pkg/compiler/lib/src/ssa/builder.dart:6205-6223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4353— pkg/front_end/lib/src/type_inference/inference_visitor.dart:4353-4371 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5293-5312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6286— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6286-6304 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8426-8445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/analyzer/tool/element/generate.dart:196— pkg/analyzer/tool/element/generate.dart:196-209 | pkg/analyzer/tool/element/generate.dart:228-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/front_end/tool/flame/instrumenter_suite.dart:79— pkg/front_end/tool/flame/instrumenter_suite.dart:79-93 | pkg/front_end/tool/flame/instrumenter_suite.dart:95-108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart:168— pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart:168-181 | pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart:227-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:13905— pkg/front_end/lib/src/type_inference/inference_visitor.dart:13905-13918 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:13970-13984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/observatory/lib/src/elements/allocation_profile.dart:325— pkg/observatory/lib/src/elements/allocation_profile.dart:325-338 | pkg/observatory/lib/src/elements/allocation_profile.dart:367-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/observatory/lib/src/elements/heap_snapshot.dart:643— pkg/observatory/lib/src/elements/heap_snapshot.dart:643-656 | pkg/observatory/lib/src/elements/process_snapshot.dart:329-343 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14–15 lines × 2) pkg/observatory/lib/src/elements/instance_view.dart:409— pkg/observatory/lib/src/elements/instance_view.dart:409-422 | pkg/observatory/lib/src/elements/instance_view.dart:473-487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–15 lines × 2) pkg/observatory/lib/src/service/object.dart:1990— pkg/observatory/lib/src/service/object.dart:1990-2003 | pkg/observatory/lib/src/service/object.dart:2029-2043 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 4) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:585— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:585-598 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:581-594 | sdk/lib/_internal/wasm/js_common/string_buffer_patch.dart:63-76 | sdk/lib/_internal/wasm/js_compatibility/string_buffer_patch.dart:49-62 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 4) sdk/lib/_internal/wasm/common/typed_data.dart:2600— sdk/lib/_internal/wasm/common/typed_data.dart:2600-2613 | sdk/lib/_internal/wasm/common/typed_data.dart:2664-2677 | sdk/lib/_internal/wasm/common/typed_data.dart:2728-2741 | sdk/lib/_internal/wasm/common/typed_data.dart:2792-2805 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:34354— pkg/analyzer/lib/src/dart/ast/ast.dart:34354-34367 | pkg/analyzer/lib/src/dart/ast/ast.dart:34609-34622 | pkg/analyzer/lib/src/dart/ast/ast.dart:36432-36445 | pkg/analyzer/lib/src/dart/ast/ast.dart:50733-50746 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 4) pkg/compiler/lib/src/js_model/elements.dart:564— pkg/compiler/lib/src/js_model/elements.dart:564-577 | pkg/compiler/lib/src/js_model/elements.dart:700-713 | pkg/compiler/lib/src/js_model/elements.dart:780-793 | pkg/compiler/lib/src/js_model/elements.dart:856-869 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 4) pkg/dartdev/lib/src/commands/compile.dart:159— pkg/dartdev/lib/src/commands/compile.dart:159-172 | pkg/dartdev/lib/src/commands/compile.dart:214-227 | pkg/dartdev/lib/src/commands/development_service.dart:46-59 | pkg/dartdev/lib/src/commands/tooling_daemon.dart:40-53 — before extracting anything, compare `pkg/dartdev/lib/src/commands/development_service.dart` and `pkg/dartdev/lib/src/commands/tooling_daemon.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 4) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1420— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1420-1433 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1501-1514 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1955-1968 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2045-2058 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 4) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1784— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1784-1797 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2368-2381 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7316-7329 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8923-8936 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 4) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7096— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7096-7109 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7352-7365 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8686-8699 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8940-8953 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:239— pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:239-246 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:278-285 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:313-320 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:465-472 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) pkg/analyzer/lib/src/summary2/ast_binary_writer.dart:146— pkg/analyzer/lib/src/summary2/ast_binary_writer.dart:146-153 | pkg/analyzer/lib/src/summary2/ast_binary_writer.dart:507-514 | pkg/analyzer/lib/src/summary2/ast_binary_writer.dart:852-859 | pkg/analyzer/lib/src/summary2/ast_binary_writer.dart:1125-1132 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) pkg/compiler/lib/src/js_model/closure.dart:632— pkg/compiler/lib/src/js_model/closure.dart:632-639 | pkg/compiler/lib/src/js_model/closure.dart:688-695 | pkg/compiler/lib/src/js_model/closure.dart:744-751 | pkg/compiler/lib/src/js_model/closure.dart:843-850 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) pkg/front_end/lib/src/builder/function_type_builder.dart:523— pkg/front_end/lib/src/builder/function_type_builder.dart:523-530 | pkg/front_end/lib/src/builder/named_type_builder.dart:1358-1365 | pkg/front_end/lib/src/builder/record_type_builder.dart:563-570 | pkg/front_end/lib/src/builder/synthesized_type_builder.dart:88-95 — before extracting anything, compare `pkg/front_end/lib/src/builder/function_type_builder.dart` and `pkg/front_end/lib/src/builder/record_type_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) pkg/front_end/lib/src/fragment/enum_element.dart:178— pkg/front_end/lib/src/fragment/enum_element.dart:178-185 | pkg/front_end/lib/src/fragment/field/declaration.dart:699-706 | pkg/front_end/lib/src/fragment/primary_constructor_field.dart:181-188 | pkg/front_end/lib/src/source/source_enum_builder.dart:838-845 — before extracting anything, compare `pkg/front_end/lib/src/fragment/enum_element.dart` and `pkg/front_end/lib/src/fragment/field/declaration.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart:26— pkg/linter/lib/src/rules/no_literal_bool_comparisons.dart:26-33 | pkg/linter/lib/src/rules/prefer_contains.dart:33-40 | pkg/linter/lib/src/rules/prefer_is_empty.dart:35-42 | pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart:32-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (8 lines × 4) pkg/wasm_builder/lib/src/ir/functions.dart:23— pkg/wasm_builder/lib/src/ir/functions.dart:23-30 | pkg/wasm_builder/lib/src/ir/globals.dart:22-29 | pkg/wasm_builder/lib/src/ir/tables.dart:22-29 | pkg/wasm_builder/lib/src/ir/tags.dart:124-131 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (8 lines × 4) REDACTED:1771— REDACTED:1771-1778 | REDACTED:1972-1979 | REDACTED:2117-2124 | REDACTED:2164-2171 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:34— pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:34-40 | pkg/front_end/testcases/inference/infer_assign_to_property_upwards.dart:49-55 | pkg/front_end/testcases/inference_new/infer_assign_to_property_upwards.dart:34-40 | pkg/front_end/testcases/inference_new/infer_assign_to_property_upwards.dart:49-55 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 4) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1709— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1709-1715 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1719-1725 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1997-2003 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:2007-2013 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) pkg/observatory/lib/src/elements/error_view.dart:58— pkg/observatory/lib/src/elements/error_view.dart:58-65 | pkg/observatory/lib/src/elements/general_error.dart:60-66 | pkg/observatory/lib/src/elements/isolate_reconnect.dart:77-84 | pkg/observatory/lib/src/elements/vm_connect.dart:64-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (7 lines × 4) pkg/front_end/parser_testcases/error_recovery/constructor_recovery_ok.dart:2— pkg/front_end/parser_testcases/error_recovery/constructor_recovery_ok.dart:2-13 | pkg/front_end/parser_testcases/error_recovery/constructor_recovery_return_type.dart:2-13 | pkg/front_end/testcases/general/error_recovery/constructor_recovery_ok.dart:6-17 | pkg/front_end/testcases/general/error_recovery/constructor_recovery_return_type.dart:7-13 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (7 lines × 4) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:297— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:297-303 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:311-317 | sdk/lib/_internal/wasm/js_common/stopwatch_patch.dart:32-38 | sdk/lib/_internal/wasm/standalone/stopwatch_patch.dart:24-30 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:305— sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart:305-311 | sdk/lib/_internal/js_runtime/lib/core_patch.dart:319-325 | sdk/lib/_internal/wasm/js_common/stopwatch_patch.dart:40-46 | sdk/lib/_internal/wasm/standalone/stopwatch_patch.dart:32-38 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart` and `sdk/lib/_internal/js_runtime/lib/core_patch.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 83 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:456— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:456-465 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1017-1023 | sdk/lib/_internal/wasm/common/compact_hash.dart:415-424 | sdk/lib/_internal/wasm/common/compact_hash.dart:937-943 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) pkg/front_end/lib/src/fragment/enum_element.dart:274— pkg/front_end/lib/src/fragment/enum_element.dart:274-281 | pkg/front_end/lib/src/fragment/field/declaration.dart:780-786 | pkg/front_end/lib/src/fragment/primary_constructor_field.dart:379-385 | pkg/front_end/lib/src/source/source_enum_builder.dart:875-882 — before extracting anything, compare `pkg/front_end/lib/src/fragment/enum_element.dart` and `pkg/front_end/lib/src/fragment/field/declaration.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1364— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1364-1368 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1399-1403 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1423-1427 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart:809— pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart:809-813 | pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart:1132-1136 | pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart:1599-1603 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart:157— sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart:157-161 | sdk/lib/_internal/js_runtime/lib/regexp_helper.dart:164-168 | sdk/lib/_internal/wasm/js_common/regexp_helper.dart:148-152 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart` and `sdk/lib/_internal/js_runtime/lib/regexp_helper.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) pkg/analyzer/lib/src/summary2/element_builder.dart:1764— pkg/analyzer/lib/src/summary2/element_builder.dart:1764-1768 | pkg/analyzer/lib/src/summary2/metadata_resolver.dart:169-173 | pkg/analyzer/lib/src/summary2/reference_resolver.dart:185-189 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) pkg/observatory/lib/src/elements/cpu_profile.dart:178— pkg/observatory/lib/src/elements/cpu_profile.dart:178-182 | pkg/observatory/lib/src/elements/cpu_profile_table.dart:498-502 | pkg/observatory/lib/src/elements/native_memory_profiler.dart:163-167 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:459— pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:459-463 | pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:477-481 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1432-1436 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:468— pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:468-472 | pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:486-490 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1440-1444 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:102— sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:102-106 | sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:166-170 | sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:202-206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (33 lines × 2) pkg/dart2wasm/lib/async.dart:229— pkg/dart2wasm/lib/async.dart:229-261 | pkg/dart2wasm/lib/sync_star.dart:198-230 — before extracting anything, compare `pkg/dart2wasm/lib/async.dart` and `pkg/dart2wasm/lib/sync_star.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (33 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:2268— sdk/lib/_internal/wasm/common/convert_patch.dart:2268-2300 | sdk/lib/_internal/wasm/common/convert_patch.dart:2339-2371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart:474— pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart:474-506 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart:187-219 — before extracting anything, compare `pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart` and `pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (33 lines × 2) pkg/compiler/lib/src/dump_info.dart:1879— pkg/compiler/lib/src/dump_info.dart:1879-1911 | pkg/compiler/lib/src/dump_info.dart:1967-1999 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2304— pkg/dev_compiler/lib/src/kernel/compiler.dart:2304-2336 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2604-2636 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (33 lines × 2) pkg/kernel/lib/text/ast_to_text.dart:1542— pkg/kernel/lib/text/ast_to_text.dart:1542-1574 | pkg/kernel/lib/text/ast_to_text.dart:1627-1659 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1823— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1823-1855 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1841-1873 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20–21 lines × 2) pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:181— pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart:181-201 | pkg/front_end/tool/fuzz/analyzer_helper.dart:421-440 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/lsp_messages.dart` and `pkg/front_end/tool/fuzz/analyzer_helper.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20–21 lines × 2) pkg/front_end/lib/src/builder/record_type_builder.dart:439— pkg/front_end/lib/src/builder/record_type_builder.dart:439-459 | pkg/front_end/lib/src/builder/record_type_builder.dart:460-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) pkg/front_end/lib/src/fragment/factory/encoding.dart:923— pkg/front_end/lib/src/fragment/factory/encoding.dart:923-943 | pkg/front_end/lib/src/fragment/factory/encoding.dart:959-978 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) pkg/front_end/lib/src/type_inference/body_inference_context.dart:891— pkg/front_end/lib/src/type_inference/body_inference_context.dart:891-910 | pkg/front_end/lib/src/type_inference/body_inference_context.dart:1059-1079 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:3546— pkg/front_end/lib/src/type_inference/inference_visitor.dart:3546-3565 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:3592-3612 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4996— pkg/front_end/lib/src/type_inference/inference_visitor.dart:4996-5015 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:10728-10748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) pkg/front_end/lib/src/type_inference/matching_expressions.dart:427— pkg/front_end/lib/src/type_inference/matching_expressions.dart:427-447 | pkg/front_end/lib/src/type_inference/matching_expressions.dart:637-656 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 3) pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart:46— pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart:46-62 | pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart:106-122 | pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart:166-182 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:60— pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:60-76 | pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart:78-94 | pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart:82-98 — before extracting anything, compare `pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart` and `pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 3) pkg/analyzer/lib/src/dart/ast/ast.dart:20405— pkg/analyzer/lib/src/dart/ast/ast.dart:20405-20421 | pkg/analyzer/lib/src/dart/ast/ast.dart:49574-49590 | pkg/analyzer/lib/src/dart/ast/ast.dart:53053-53069 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:395— pkg/front_end/lib/src/fragment/getter/encoding.dart:395-411 | pkg/front_end/lib/src/fragment/method/encoding.dart:326-342 | pkg/front_end/lib/src/fragment/setter/encoding.dart:397-413 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (17 lines × 3) pkg/front_end/lib/src/fragment/method/encoding.dart:229— pkg/front_end/lib/src/fragment/method/encoding.dart:229-245 | pkg/front_end/lib/src/fragment/method/encoding.dart:592-608 | pkg/front_end/lib/src/fragment/setter/encoding.dart:284-300 — `pkg/front_end/lib/src/fragment/method/encoding.dart` and `pkg/front_end/lib/src/fragment/setter/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 306 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (17 lines × 3) pkg/front_end/lib/src/kernel/expression_generator.dart:522— pkg/front_end/lib/src/kernel/expression_generator.dart:522-538 | pkg/front_end/lib/src/kernel/expression_generator.dart:1480-1496 | pkg/front_end/lib/src/kernel/expression_generator.dart:2450-2466 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 3) pkg/front_end/lib/src/kernel/forwarding_node.dart:358— pkg/front_end/lib/src/kernel/forwarding_node.dart:358-374 | pkg/front_end/lib/src/kernel/forwarding_node.dart:391-407 | pkg/front_end/lib/src/kernel/forwarding_node.dart:449-465 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–17 lines × 2) pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart:184— pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart:184-199 | pkg/front_end/tool/fuzz/analyzer_helper.dart:166-182 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16–17 lines × 2) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:190— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:190-205 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:310-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) pkg/_fe_analyzer_shared/lib/src/sdk/allowed_experiments.dart:84— pkg/_fe_analyzer_shared/lib/src/sdk/allowed_experiments.dart:84-100 | pkg/_fe_analyzer_shared/lib/src/sdk/allowed_experiments.dart:104-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart:63— pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart:63-78 | pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart:93-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:150— pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:150-166 | pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:244-259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) pkg/compiler/lib/src/ssa/builder.dart:6502— pkg/compiler/lib/src/ssa/builder.dart:6502-6518 | pkg/compiler/lib/src/ssa/builder.dart:6535-6550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:321— pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:321-337 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:344-359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 4) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:165— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:165-177 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:257-269 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:294-306 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:386-398 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 4) pkg/front_end/testcases/general/pure_index_expressions.dart:32— pkg/front_end/testcases/general/pure_index_expressions.dart:32-44 | pkg/front_end/testcases/general/pure_index_expressions.dart:63-75 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:41-53 | pkg/front_end/testcases/nnbd/pure_index_expressions.dart:74-86 — `pkg/front_end/testcases/general/pure_index_expressions.dart` and `pkg/front_end/testcases/nnbd/pure_index_expressions.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 89 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 4) pkg/dartpad_worker/lib/src/resource_provider/resource_provider_file.dart:782— pkg/dartpad_worker/lib/src/resource_provider/resource_provider_file.dart:782-794 | sdk/lib/_http/http_impl.dart:1120-1132 | sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart:102-114 | sdk/lib/io/io_sink.dart:298-310 — before extracting anything, compare `sdk/lib/_http/http_impl.dart` and `sdk/lib/io/io_sink.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:6175— pkg/analyzer/lib/src/dart/ast/ast.dart:6175-6187 | pkg/analyzer/lib/src/dart/ast/ast.dart:14684-14696 | pkg/analyzer/lib/src/dart/ast/ast.dart:15420-15432 | pkg/analyzer/lib/src/dart/ast/ast.dart:57207-57219 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:6242— pkg/analyzer/lib/src/dart/ast/ast.dart:6242-6254 | pkg/analyzer/lib/src/dart/ast/ast.dart:14758-14770 | pkg/analyzer/lib/src/dart/ast/ast.dart:15487-15499 | pkg/analyzer/lib/src/dart/ast/ast.dart:57278-57290 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 4) pkg/analyzer/lib/src/summary2/library_builder.dart:463— pkg/analyzer/lib/src/summary2/library_builder.dart:463-475 | pkg/analyzer/lib/src/summary2/library_builder.dart:482-494 | pkg/analyzer/lib/src/summary2/library_builder.dart:543-555 | pkg/analyzer/lib/src/summary2/library_builder.dart:562-574 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 4) sdk/lib/vmservice/devfs.dart:226— sdk/lib/vmservice/devfs.dart:226-238 | sdk/lib/vmservice/devfs.dart:283-295 | sdk/lib/vmservice/devfs.dart:340-352 | sdk/lib/vmservice/devfs.dart:400-412 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:263— sdk/lib/_internal/vm/lib/typed_data_patch.dart:263-270 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:599-606 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:945-952 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1288-1295 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1631-1638 | sdk/lib/_internal/wasm/common/typed_data.dart:2140-2147 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:333— sdk/lib/_internal/vm/lib/typed_data_patch.dart:333-340 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:670-677 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1061-1068 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1404-1411 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1747-1754 | sdk/lib/_internal/wasm/common/typed_data.dart:2210-2217 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:372— sdk/lib/_internal/vm/lib/typed_data_patch.dart:372-379 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:709-716 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1101-1108 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1444-1451 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1787-1794 | sdk/lib/_internal/wasm/common/typed_data.dart:2249-2256 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:449— sdk/lib/_internal/vm/lib/typed_data_patch.dart:449-456 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:786-793 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1181-1188 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1524-1531 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1867-1874 | sdk/lib/_internal/wasm/common/typed_data.dart:2330-2337 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 6) pkg/analysis_server/lib/src/protocol/protocol_internal.dart:242— pkg/analysis_server/lib/src/protocol/protocol_internal.dart:242-249 | pkg/analysis_server/lib/src/protocol/protocol_internal.dart:286-293 | pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart:497-504 | pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart:538-545 | pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart:581-588 | pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart:621-628 — before extracting anything, compare `pkg/analysis_server/lib/src/protocol/protocol_internal.dart` and `pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 6) pkg/linter/lib/src/rules/dangling_library_doc_comments.dart:26— pkg/linter/lib/src/rules/dangling_library_doc_comments.dart:26-33 | pkg/linter/lib/src/rules/directives_ordering.dart:77-84 | pkg/linter/lib/src/rules/file_names.dart:24-31 | pkg/linter/lib/src/rules/flutter_style_todos.dart:32-39 | pkg/linter/lib/src/rules/library_annotations.dart:27-34 | pkg/linter/lib/src/rules/library_private_types_in_public_api.dart:30-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once.
Duplicated block (8 lines × 6) pkg/linter/lib/src/rules/deprecated_member_use_from_same_package.dart:45— pkg/linter/lib/src/rules/deprecated_member_use_from_same_package.dart:45-52 | pkg/linter/lib/src/rules/document_ignores.dart:30-37 | pkg/linter/lib/src/rules/eol_at_end_of_file.dart:26-33 | pkg/linter/lib/src/rules/lines_longer_than_80_chars.dart:40-47 | pkg/linter/lib/src/rules/prefer_final_fields.dart:26-33 | pkg/linter/lib/src/rules/unreachable_from_main.dart:37-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once.
Duplicated block (6 lines × 4) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:622— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:622-627 | sdk/lib/_internal/js_runtime/lib/js_number.dart:714-719 | sdk/lib/_internal/vm/lib/integers.dart:529-534 | sdk/lib/_internal/wasm/common/boxed_int.dart:423-428 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) sdk/lib/_internal/vm/lib/typed_data_patch.dart:2575— sdk/lib/_internal/vm/lib/typed_data_patch.dart:2575-2580 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:2645-2650 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:4581-4586 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:4648-4653 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) pkg/analyzer/lib/src/dart/element/element.dart:4079— pkg/analyzer/lib/src/dart/element/element.dart:4079-4084 | pkg/analyzer/lib/src/dart/element/element.dart:9441-9446 | pkg/analyzer/lib/src/dart/element/element.dart:11559-11564 | pkg/analyzer/lib/src/dart/element/member.dart:345-350 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) pkg/front_end/lib/src/kernel/internal_ast.dart:6816— pkg/front_end/lib/src/kernel/internal_ast.dart:6816-6822 | pkg/front_end/lib/src/kernel/internal_ast.dart:6846-6852 | pkg/kernel/lib/src/ast/patterns.dart:156-161 | pkg/kernel/lib/src/ast/patterns.dart:213-218 — before extracting anything, compare `pkg/front_end/lib/src/kernel/internal_ast.dart` and `pkg/kernel/lib/src/ast/patterns.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) pkg/kernel/lib/src/ast/expressions.dart:1668— pkg/kernel/lib/src/ast/expressions.dart:1668-1673 | pkg/kernel/lib/src/ast/expressions.dart:4780-4785 | pkg/kernel/lib/src/ast/statements.dart:972-977 | pkg/kernel/lib/src/ast/statements.dart:1285-1290 — before extracting anything, compare `pkg/kernel/lib/src/ast/expressions.dart` and `pkg/kernel/lib/src/ast/statements.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:108— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:108-113 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:692-697 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1131-1136 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:67-72 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) pkg/kernel/lib/src/ast/expressions.dart:115— pkg/kernel/lib/src/ast/expressions.dart:115-120 | pkg/kernel/lib/src/ast/expressions.dart:1596-1601 | pkg/kernel/lib/src/ast/statements.dart:18-23 | pkg/kernel/lib/src/ast/types.dart:2028-2033 — before extracting anything, compare `pkg/kernel/lib/src/ast/expressions.dart` and `pkg/kernel/lib/src/ast/statements.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) pkg/analyzer/tool/ast/generate.dart:196— pkg/analyzer/tool/ast/generate.dart:196-217 | pkg/analyzer/tool/ast/generate.dart:822-900 | pkg/analyzer/tool/ast/generate.dart:1187-1205 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 3) pkg/compiler/lib/src/ssa/builder.dart:6662— pkg/compiler/lib/src/ssa/builder.dart:6662-6680 | pkg/compiler/lib/src/ssa/builder.dart:6698-6716 | pkg/compiler/lib/src/ssa/builder.dart:6734-6752 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 3) pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:104— pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:104-122 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:151-169 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:198-216 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 3) pkg/observatory/lib/src/elements/code_view.dart:205— pkg/observatory/lib/src/elements/code_view.dart:205-223 | pkg/observatory/lib/src/elements/megamorphiccache_view.dart:118-136 | pkg/observatory/lib/src/elements/script_view.dart:125-143 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (19 lines × 3) pkg/observatory/lib/src/elements/instance_view.dart:384— pkg/observatory/lib/src/elements/instance_view.dart:384-402 | pkg/observatory/lib/src/elements/instance_view.dart:423-441 | pkg/observatory/lib/src/elements/instance_view.dart:489-507 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 3) pkg/observatory/lib/src/elements/isolate_view.dart:198— pkg/observatory/lib/src/elements/isolate_view.dart:198-216 | pkg/observatory/lib/src/elements/metric/graph.dart:78-96 | pkg/observatory/lib/src/elements/vm_view.dart:250-268 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (16 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1511— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1511-1526 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1530-1545 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2119-2134 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 3) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:546— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:546-561 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:631-646 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:689-704 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) pkg/compiler/lib/src/kernel/kernel_impact.dart:159— pkg/compiler/lib/src/kernel/kernel_impact.dart:159-174 | pkg/compiler/lib/src/kernel/kernel_impact.dart:192-207 | pkg/compiler/lib/src/kernel/kernel_impact.dart:260-275 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) pkg/front_end/lib/src/kernel/internal_ast.dart:3646— pkg/front_end/lib/src/kernel/internal_ast.dart:3646-3661 | pkg/front_end/lib/src/kernel/internal_ast.dart:3736-3751 | pkg/front_end/lib/src/kernel/internal_ast.dart:4302-4317 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:5523— pkg/front_end/lib/src/type_inference/inference_visitor.dart:5523-5538 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5608-5623 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5683-5698 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8488— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8488-8503 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8694-8709 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8948-8963 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:8534— pkg/analyzer/lib/src/dart/ast/ast.dart:8534-8544 | pkg/analyzer/lib/src/dart/ast/ast.dart:18935-18945 | pkg/analyzer/lib/src/dart/ast/ast.dart:26553-26563 | pkg/analyzer/lib/src/dart/ast/ast.dart:38317-38327 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:8559— pkg/analyzer/lib/src/dart/ast/ast.dart:8559-8569 | pkg/analyzer/lib/src/dart/ast/ast.dart:18957-18967 | pkg/analyzer/lib/src/dart/ast/ast.dart:26570-26580 | pkg/analyzer/lib/src/dart/ast/ast.dart:38344-38354 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) pkg/analyzer/lib/src/fine/manifest_item.dart:86— pkg/analyzer/lib/src/fine/manifest_item.dart:86-96 | pkg/analyzer/lib/src/fine/manifest_item.dart:276-286 | pkg/analyzer/lib/src/fine/manifest_item.dart:467-477 | pkg/analyzer/lib/src/fine/manifest_item.dart:1370-1380 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) pkg/analyzer/lib/src/summary2/informative_data.dart:278— pkg/analyzer/lib/src/summary2/informative_data.dart:278-288 | pkg/analyzer/lib/src/summary2/informative_data.dart:314-324 | pkg/analyzer/lib/src/summary2/informative_data.dart:342-352 | pkg/analyzer/lib/src/summary2/informative_data.dart:472-482 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:218— pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:218-228 | pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:255-265 | pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:293-303 | pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:330-340 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) pkg/analyzer_plugin/lib/plugin/folding_mixin.dart:43— pkg/analyzer_plugin/lib/plugin/folding_mixin.dart:43-53 | pkg/analyzer_plugin/lib/plugin/highlights_mixin.dart:43-53 | pkg/analyzer_plugin/lib/plugin/occurrences_mixin.dart:43-53 | pkg/analyzer_plugin/lib/plugin/outline_mixin.dart:43-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (7 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:274— sdk/lib/_internal/vm/lib/typed_data_patch.dart:274-280 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:610-616 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:956-962 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1299-1305 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1642-1648 | sdk/lib/_internal/wasm/common/typed_data.dart:2151-2157 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 6) pkg/front_end/lib/src/dill/dill_class_builder.dart:275— pkg/front_end/lib/src/dill/dill_class_builder.dart:275-281 | pkg/front_end/lib/src/dill/dill_extension_builder.dart:228-235 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:401-407 | pkg/front_end/lib/src/source/source_class_builder.dart:179-185 | pkg/front_end/lib/src/source/source_extension_builder.dart:109-115 | pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:128-134 — before extracting anything, compare `pkg/front_end/lib/src/dill/dill_class_builder.dart` and `pkg/front_end/lib/src/dill/dill_extension_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 6) pkg/front_end/lib/src/dill/dill_class_builder.dart:288— pkg/front_end/lib/src/dill/dill_class_builder.dart:288-294 | pkg/front_end/lib/src/dill/dill_extension_builder.dart:242-249 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:414-420 | pkg/front_end/lib/src/source/source_class_builder.dart:191-197 | pkg/front_end/lib/src/source/source_extension_builder.dart:121-127 | pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:140-146 — before extracting anything, compare `pkg/front_end/lib/src/dill/dill_class_builder.dart` and `pkg/front_end/lib/src/dill/dill_extension_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:342— sdk/lib/_internal/vm/lib/typed_data_patch.dart:342-348 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:679-685 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1070-1076 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1413-1419 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1756-1762 | sdk/lib/_internal/wasm/common/typed_data.dart:2219-2225 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:355— sdk/lib/_internal/vm/lib/typed_data_patch.dart:355-361 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:692-698 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1084-1090 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1427-1433 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1770-1776 | sdk/lib/_internal/wasm/common/typed_data.dart:2232-2238 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:363— sdk/lib/_internal/vm/lib/typed_data_patch.dart:363-369 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:700-706 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1092-1098 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1435-1441 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1778-1784 | sdk/lib/_internal/wasm/common/typed_data.dart:2240-2246 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (37 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1481— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1481-1517 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1187-1223 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (37 lines × 2) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:235— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:235-271 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:792-828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (37 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4773— pkg/dev_compiler/lib/src/kernel/compiler.dart:4773-4809 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5383-5419 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (37 lines × 2) pkg/front_end/lib/src/fragment/getter/encoding.dart:560— pkg/front_end/lib/src/fragment/getter/encoding.dart:560-596 | pkg/front_end/lib/src/fragment/method/encoding.dart:567-603 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (37 lines × 2) pkg/observatory/lib/src/elements/cpu_profile.dart:108— pkg/observatory/lib/src/elements/cpu_profile.dart:108-144 | pkg/observatory/lib/src/elements/native_memory_profiler.dart:98-134 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (32 lines × 2) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_assist_other_file_could_add_late.dart:97— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_assist_other_file_could_add_late.dart:97-128 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_many_assist_calls.dart:100-131 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (32 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:111— pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:111-142 | pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart:71-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (32 lines × 2) pkg/analyzer/lib/src/dart/element/element.dart:2731— pkg/analyzer/lib/src/dart/element/element.dart:2731-2762 | pkg/analyzer/lib/src/dart/element/element.dart:5261-5292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4868— pkg/dev_compiler/lib/src/kernel/compiler.dart:4868-4899 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5478-5509 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (32 lines × 2) pkg/front_end/lib/src/type_inference/body_inference_context.dart:446— pkg/front_end/lib/src/type_inference/body_inference_context.dart:446-477 | pkg/front_end/lib/src/type_inference/body_inference_context.dart:782-813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:485— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:485-514 | sdk/lib/_internal/js_runtime/lib/js_number.dart:576-605 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) pkg/analyzer/lib/src/dart/ast/ast.dart:8059— pkg/analyzer/lib/src/dart/ast/ast.dart:8059-8088 | pkg/analyzer/lib/src/dart/ast/ast.dart:8094-8123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8133— pkg/dev_compiler/lib/src/kernel/compiler.dart:8133-8162 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:9002-9031 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) pkg/front_end/lib/src/source/source_type_alias_builder.dart:494— pkg/front_end/lib/src/source/source_type_alias_builder.dart:494-523 | pkg/front_end/lib/src/source/source_type_alias_builder.dart:553-582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 2) pkg/wasm_builder/lib/src/ir/type.dart:764— pkg/wasm_builder/lib/src/ir/type.dart:764-793 | pkg/wasm_builder/lib/src/ir/type.dart:811-840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:488— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:488-510 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1164-1185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:309— pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:309-331 | pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:350-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) pkg/front_end/lib/src/kernel/internal_ast.dart:7286— pkg/front_end/lib/src/kernel/internal_ast.dart:7286-7308 | pkg/kernel/lib/src/ast/patterns.dart:835-856 — before extracting anything, compare `pkg/front_end/lib/src/kernel/internal_ast.dart` and `pkg/kernel/lib/src/ast/patterns.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22–23 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6412— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6412-6433 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6757-6779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) pkg/observatory/lib/src/elements/instance_view.dart:381— pkg/observatory/lib/src/elements/instance_view.dart:381-402 | pkg/observatory/lib/src/elements/instance_view.dart:485-507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) pkg/dart2wasm/lib/dynamic_dispatchers.dart:100— pkg/dart2wasm/lib/dynamic_dispatchers.dart:100-120 | pkg/dart2wasm/lib/dynamic_dispatchers.dart:136-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) pkg/analyzer/lib/src/summary2/element_builder.dart:589— pkg/analyzer/lib/src/summary2/element_builder.dart:589-610 | pkg/analyzer/lib/src/summary2/element_builder.dart:696-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) pkg/front_end/lib/src/kernel/expression_generator.dart:2967— pkg/front_end/lib/src/kernel/expression_generator.dart:2967-2988 | pkg/front_end/lib/src/kernel/expression_generator.dart:3441-3461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) pkg/front_end/lib/src/type_inference/collection_encoding.dart:1790— pkg/front_end/lib/src/type_inference/collection_encoding.dart:1790-1811 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1815-1835 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6351— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6351-6371 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6824-6845 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 3) pkg/front_end/tool/bench_maker.dart:416— pkg/front_end/tool/bench_maker.dart:416-435 | pkg/front_end/tool/bench_maker.dart:547-566 | pkg/front_end/tool/bench_maker.dart:572-591 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (20 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2054— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:2054-2073 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:2072-2091 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2685-2704 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 3) pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:27— pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart:27-46 | pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart:30-49 | pkg/analysis_server/lib/src/services/refactoring/move_selected_formal_parameters_left.dart:28-47 — before extracting anything, compare `pkg/analysis_server/lib/src/services/refactoring/convert_all_formal_parameters_to_named.dart` and `pkg/analysis_server/lib/src/services/refactoring/convert_selected_formal_parameters_to_named.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 3) pkg/front_end/lib/src/builder/function_type_builder.dart:562— pkg/front_end/lib/src/builder/function_type_builder.dart:562-581 | pkg/front_end/lib/src/builder/named_type_builder.dart:1394-1413 | pkg/front_end/lib/src/builder/record_type_builder.dart:597-616 — before extracting anything, compare `pkg/front_end/lib/src/builder/function_type_builder.dart` and `pkg/front_end/lib/src/builder/record_type_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 3) pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:254— pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:254-273 | pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:286-305 | pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:318-337 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 4) sdk/lib/_internal/js_dev_runtime/patch/isolate_patch.dart:45— sdk/lib/_internal/js_dev_runtime/patch/isolate_patch.dart:45-59 | sdk/lib/_internal/js_runtime/lib/isolate_patch.dart:57-71 | sdk/lib/_internal/vm/lib/isolate_patch.dart:432-446 | sdk/lib/_internal/wasm/common/isolate_patch.dart:54-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (15 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:24519— pkg/analyzer/lib/src/dart/ast/ast.dart:24519-24533 | pkg/analyzer/lib/src/dart/ast/ast.dart:24541-24555 | pkg/analyzer/lib/src/dart/ast/ast.dart:37234-37248 | pkg/analyzer/lib/src/dart/ast/ast.dart:37261-37275 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:25648— pkg/analyzer/lib/src/dart/ast/ast.dart:25648-25662 | pkg/analyzer/lib/src/dart/ast/ast.dart:25670-25684 | pkg/analyzer/lib/src/dart/ast/ast.dart:26296-26310 | pkg/analyzer/lib/src/dart/ast/ast.dart:26315-26329 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 4) pkg/front_end/lib/src/fragment/getter/encoding.dart:334— pkg/front_end/lib/src/fragment/getter/encoding.dart:334-348 | pkg/front_end/lib/src/fragment/getter/encoding.dart:635-649 | pkg/front_end/lib/src/fragment/setter/encoding.dart:357-371 | pkg/front_end/lib/src/fragment/setter/encoding.dart:682-696 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/setter/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 15 separate duplicated blocks between them, totalling at least 276 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 4) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2454— pkg/front_end/lib/src/type_inference/inference_visitor.dart:2454-2468 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8639-8653 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8835-8849 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9102-9116 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–14 lines × 2) pkg/dart2wasm/lib/code_generator.dart:2289— pkg/dart2wasm/lib/code_generator.dart:2289-2300 | pkg/dart2wasm/lib/code_generator.dart:2407-2420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–14 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart:57— pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart:57-70 | pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart:137-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12–14 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/convert_to_in_body_constructor.dart:107— pkg/analysis_server/lib/src/services/correction/dart/convert_to_in_body_constructor.dart:107-120 | pkg/analysis_server/lib/src/services/correction/dart/convert_to_in_body_constructor.dart:240-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–14 lines × 2) pkg/analyzer/lib/src/generated/exhaustiveness.dart:167— pkg/analyzer/lib/src/generated/exhaustiveness.dart:167-178 | pkg/front_end/lib/src/kernel/exhaustiveness.dart:536-549 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–14 lines × 2) pkg/test_runner/lib/src/process_queue.dart:711— pkg/test_runner/lib/src/process_queue.dart:711-724 | pkg/test_runner/lib/src/process_queue.dart:840-851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:569— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:569-576 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:643-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) pkg/analyzer/lib/src/dart/micro/utils.dart:593— pkg/analyzer/lib/src/dart/micro/utils.dart:593-601 | pkg/analyzer/lib/src/dart/micro/utils.dart:780-787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:667— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:667-674 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:890-898 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) pkg/dev_compiler/lib/src/js_ast/template.dart:360— pkg/dev_compiler/lib/src/js_ast/template.dart:360-367 | pkg/js_ast/lib/src/template.dart:348-356 — before extracting anything, compare `pkg/dev_compiler/lib/src/js_ast/template.dart` and `pkg/js_ast/lib/src/template.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8–9 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4758— pkg/front_end/lib/src/kernel/constant_evaluator.dart:4758-4765 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:4879-4887 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 5) pkg/analyzer/lib/src/summary2/bundle_reader.dart:266— pkg/analyzer/lib/src/summary2/bundle_reader.dart:266-273 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:466-473 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:552-559 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:622-629 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1075-1082 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 5) pkg/analyzer/lib/src/summary2/bundle_writer.dart:175— pkg/analyzer/lib/src/summary2/bundle_writer.dart:175-182 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:298-305 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:354-361 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:403-410 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:693-700 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 5) pkg/kernel/lib/src/ast/declarations.dart:488— pkg/kernel/lib/src/ast/declarations.dart:488-495 | pkg/kernel/lib/src/ast/declarations.dart:645-652 | pkg/kernel/lib/src/ast/declarations.dart:886-893 | pkg/kernel/lib/src/ast/members.dart:152-159 | pkg/kernel/lib/src/ast/typedefs.dart:82-89 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 5) pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:36— pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:36-43 | pkg/linter/lib/src/rules/avoid_implementing_value_types.dart:26-33 | pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart:32-39 | pkg/linter/lib/src/rules/hash_and_equals.dart:26-33 | pkg/linter/lib/src/rules/one_member_abstracts.dart:30-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
Duplicated block (8 lines × 5) pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart:27— pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart:27-34 | REDACTED:29-36 | pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart:29-36 | pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart:26-33 | pkg/linter/lib/src/rules/use_truncating_division.dart:24-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
D4 · Code Duplication· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (9 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:152— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:152-161 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:228-237 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:304-311 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:167-176 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:255-264 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:342-349 | sdk/lib/_internal/wasm/common/simd.dart:24-33 | sdk/lib/_internal/wasm/common/simd.dart:128-137 | sdk/lib/_internal/wasm/common/simd.dart:234-241 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:878— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:878-890 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:995-1007 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1114-1126 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1225-1237 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1348-1360 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1473-1485 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1596-1608 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1792-1804 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1896-1908 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart:121— pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart:121-131 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart:105-115 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart:145-155 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart:58-68 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart:60-70 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart:233-243 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart:139-149 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart:73-83 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart:160-170 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) pkg/wasm_builder/lib/src/builder/instructions.dart:6015— pkg/wasm_builder/lib/src/builder/instructions.dart:6015-6028 | pkg/wasm_builder/lib/src/builder/instructions.dart:6030-6043 | pkg/wasm_builder/lib/src/builder/instructions.dart:6045-6058 | pkg/wasm_builder/lib/src/builder/instructions.dart:6060-6073 | pkg/wasm_builder/lib/src/builder/instructions.dart:6075-6088 | pkg/wasm_builder/lib/src/builder/instructions.dart:6090-6103 | pkg/wasm_builder/lib/src/builder/instructions.dart:6105-6118 | pkg/wasm_builder/lib/src/builder/instructions.dart:6120-6133 | pkg/wasm_builder/lib/src/builder/instructions.dart:6225-6238 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
Duplicated block (43 lines × 2) pkg/analyzer/tool/generators/ast_generator.dart:1433— pkg/analyzer/tool/generators/ast_generator.dart:1433-1475 | pkg/analyzer/tool/generators/string_search_util_generator.dart:193-235 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (43 lines × 2) pkg/compiler/lib/src/js_model/element_map_impl.dart:1300— pkg/compiler/lib/src/js_model/element_map_impl.dart:1300-1342 | pkg/compiler/lib/src/kernel/element_map_impl.dart:983-1025 — `pkg/compiler/lib/src/js_model/element_map_impl.dart` and `pkg/compiler/lib/src/kernel/element_map_impl.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 23 separate duplicated blocks between them, totalling at least 317 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (43 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:9180— pkg/front_end/lib/src/type_inference/inference_visitor.dart:9180-9222 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9403-9445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (43 lines × 2) pkg/observatory/lib/src/elements/heap_snapshot.dart:670— pkg/observatory/lib/src/elements/heap_snapshot.dart:670-712 | pkg/observatory/lib/src/elements/process_snapshot.dart:358-400 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (36 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:808— sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:808-843 | sdk/lib/_internal/js_runtime/lib/async_patch.dart:523-558 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart` and `sdk/lib/_internal/js_runtime/lib/async_patch.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (36 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4736— pkg/dev_compiler/lib/src/kernel/compiler.dart:4736-4771 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5346-5381 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (36 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7598— pkg/dev_compiler/lib/src/kernel/compiler.dart:7598-7633 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8465-8500 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (36 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8415— pkg/dev_compiler/lib/src/kernel/compiler.dart:8415-8450 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:9367-9402 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:381— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:381-402 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:384-405 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:453-474 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1339— sdk/lib/_internal/vm/lib/convert_patch.dart:1339-1360 | sdk/lib/_internal/wasm/common/convert_patch.dart:1525-1546 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1217-1238 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 3) pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:427— pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:427-448 | pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:503-524 | pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:704-725 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22 lines × 3) pkg/front_end/lib/src/fragment/enum_element.dart:113— pkg/front_end/lib/src/fragment/enum_element.dart:113-134 | pkg/front_end/lib/src/fragment/field/declaration.dart:339-360 | pkg/front_end/lib/src/fragment/primary_constructor_field.dart:126-147 — before extracting anything, compare `pkg/front_end/lib/src/fragment/enum_element.dart` and `pkg/front_end/lib/src/fragment/field/declaration.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20–22 lines × 2) pkg/dart2wasm/lib/list_factory_specializer.dart:195— pkg/dart2wasm/lib/list_factory_specializer.dart:195-216 | pkg/vm/lib/modular/specializer/list_factory_specializer.dart:176-195 — before extracting anything, compare `pkg/dart2wasm/lib/list_factory_specializer.dart` and `pkg/vm/lib/modular/specializer/list_factory_specializer.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20–22 lines × 2) pkg/front_end/lib/src/kernel/expression_generator.dart:258— pkg/front_end/lib/src/kernel/expression_generator.dart:258-277 | pkg/front_end/lib/src/kernel/expression_generator.dart:7437-7458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–22 lines × 2) pkg/front_end/lib/src/type_inference/collection_encoding.dart:1095— pkg/front_end/lib/src/type_inference/collection_encoding.dart:1095-1116 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1133-1152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–22 lines × 2) pkg/front_end/lib/src/type_inference/collection_encoding.dart:1647— pkg/front_end/lib/src/type_inference/collection_encoding.dart:1647-1668 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1685-1704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 3) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:108— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:108-128 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:178-198 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:200-220 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (21 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1424— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1424-1444 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1443-1463 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1917-1937 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1303— sdk/lib/_internal/vm/lib/convert_patch.dart:1303-1323 | sdk/lib/_internal/wasm/common/convert_patch.dart:1489-1509 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1181-1201 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 3) pkg/analysis_server/lib/protocol/protocol.dart:193— pkg/analysis_server/lib/protocol/protocol.dart:193-213 | pkg/analysis_server_client/lib/src/protocol/protocol_base.dart:177-197 | pkg/analyzer_plugin/lib/protocol/protocol.dart:207-227 — before extracting anything, compare `pkg/analysis_server/lib/protocol/protocol.dart` and `pkg/analysis_server_client/lib/src/protocol/protocol_base.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18–19 lines × 2) pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:351— pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:351-368 | pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:614-632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 2) pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:194— pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:194-211 | pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:214-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:10059— pkg/front_end/lib/src/kernel/body_builder.dart:10059-10077 | pkg/front_end/lib/src/kernel/body_builder.dart:10392-10409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 2) pkg/front_end/lib/src/source/outline_builder.dart:2398— pkg/front_end/lib/src/source/outline_builder.dart:2398-2416 | pkg/front_end/lib/src/source/outline_builder.dart:2617-2634 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–17 lines × 2) pkg/analyzer_utilities/tool/messages/use_literate_api_in_analyzer.dart:154— pkg/analyzer_utilities/tool/messages/use_literate_api_in_analyzer.dart:154-170 | pkg/analyzer_utilities/tool/messages/use_new_with_arguments.dart:152-166 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15–17 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart:31— pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart:31-47 | pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart:30-44 — before extracting anything, compare `pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart` and `pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15–17 lines × 2) pkg/analyzer/lib/src/summary2/informative_data.dart:406— pkg/analyzer/lib/src/summary2/informative_data.dart:406-422 | pkg/analyzer/lib/src/summary2/informative_data.dart:450-464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–17 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3165— pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3165-3179 | pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3320-3336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–16 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart:62— pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart:62-77 | pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart:82-95 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–16 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2997— pkg/front_end/lib/src/type_inference/inference_visitor.dart:2997-3012 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:3135-3148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–16 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8540— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8540-8555 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8742-8755 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–16 lines × 2) pkg/observatory/lib/src/elements/inbound_references.dart:102— pkg/observatory/lib/src/elements/inbound_references.dart:102-117 | pkg/observatory/lib/src/elements/retaining_path.dart:105-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–13 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:253— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:253-263 | sdk/lib/_internal/js_runtime/lib/js_array.dart:351-363 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11–13 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:288— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:288-298 | sdk/lib/_internal/js_runtime/lib/js_array.dart:392-404 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11–13 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart:100— pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart:100-112 | pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart:186-196 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–13 lines × 2) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:245— pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:245-255 | pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:330-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 4) pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:44— pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:44-55 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:122-133 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:200-211 | pkg/front_end/testcases/inference_new/infer_assign_to_index_this_upwards.dart:232-243 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 4) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:543— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:543-554 | sdk/lib/_internal/js_runtime/lib/js_number.dart:633-644 | sdk/lib/_internal/vm/lib/integers.dart:452-463 | sdk/lib/_internal/wasm/common/boxed_int.dart:345-356 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 4) pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:250— pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:250-261 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:285-296 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:318-329 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:470-481 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:18939— pkg/analyzer/lib/src/dart/ast/ast.dart:18939-18950 | pkg/analyzer/lib/src/dart/ast/ast.dart:18961-18972 | pkg/analyzer/lib/src/dart/ast/ast.dart:38321-38332 | pkg/analyzer/lib/src/dart/ast/ast.dart:38348-38359 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 5) sdk/lib/_internal/vm/lib/typed_data_patch.dart:534— sdk/lib/_internal/vm/lib/typed_data_patch.dart:534-544 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:877-887 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:995-1005 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1338-1348 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1681-1691 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 5) pkg/analyzer/lib/src/dart/ast/ast.dart:13527— pkg/analyzer/lib/src/dart/ast/ast.dart:13527-13537 | pkg/analyzer/lib/src/dart/ast/ast.dart:20481-20491 | pkg/analyzer/lib/src/dart/ast/ast.dart:49650-49660 | pkg/analyzer/lib/src/dart/ast/ast.dart:53129-53139 | pkg/analyzer/lib/src/dart/ast/ast.dart:58612-58622 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 5) pkg/analyzer/lib/src/dart/ast/ast.dart:13541— pkg/analyzer/lib/src/dart/ast/ast.dart:13541-13551 | pkg/analyzer/lib/src/dart/ast/ast.dart:20505-20515 | pkg/analyzer/lib/src/dart/ast/ast.dart:49674-49684 | pkg/analyzer/lib/src/dart/ast/ast.dart:53153-53163 | pkg/analyzer/lib/src/dart/ast/ast.dart:58630-58640 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 5) pkg/dartdev/lib/src/commands/compile.dart:162— pkg/dartdev/lib/src/commands/compile.dart:162-172 | pkg/dartdev/lib/src/commands/compile.dart:217-227 | pkg/dartdev/lib/src/commands/dart_mcp_server.dart:56-66 | pkg/dartdev/lib/src/commands/development_service.dart:49-59 | pkg/dartdev/lib/src/commands/tooling_daemon.dart:43-53 — before extracting anything, compare `pkg/dartdev/lib/src/commands/development_service.dart` and `pkg/dartdev/lib/src/commands/tooling_daemon.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7–8 lines × 2) pkg/dart2wasm/lib/constants.dart:1066— pkg/dart2wasm/lib/constants.dart:1066-1072 | pkg/dart2wasm/lib/constants.dart:1076-1083 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) sdk/lib/_internal/wasm/common/simd.dart:438— sdk/lib/_internal/wasm/common/simd.dart:438-445 | sdk/lib/_internal/wasm/common/simd.dart:453-459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) pkg/analyzer/lib/src/dart/micro/utils.dart:669— pkg/analyzer/lib/src/dart/micro/utils.dart:669-676 | pkg/analyzer/lib/src/dart/micro/utils.dart:718-724 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) pkg/analyzer/lib/src/utilities/string_search.dart:105— pkg/analyzer/lib/src/utilities/string_search.dart:105-111 | pkg/analyzer/lib/src/utilities/string_search.dart:143-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 6) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1580— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1580-1585 | sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1622-1627 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1598-1603 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1640-1645 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2182-2187 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2224-2229 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 6) pkg/smith/lib/configuration.dart:808— pkg/smith/lib/configuration.dart:808-813 | pkg/smith/lib/configuration.dart:964-969 | pkg/smith/lib/configuration.dart:1015-1020 | pkg/smith/lib/configuration.dart:1047-1052 | pkg/smith/lib/configuration.dart:1082-1087 | pkg/test_runner/lib/src/configuration.dart:596-601 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:325— sdk/lib/_internal/vm/lib/typed_data_patch.dart:325-330 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:662-667 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1053-1058 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1396-1401 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1739-1744 | sdk/lib/_internal/wasm/common/typed_data.dart:2202-2207 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 6) pkg/compiler/tool/modular_test_suite_helper.dart:268— pkg/compiler/tool/modular_test_suite_helper.dart:268-274 | pkg/compiler/tool/modular_test_suite_helper.dart:330-336 | pkg/compiler/tool/modular_test_suite_helper.dart:385-391 | pkg/compiler/tool/modular_test_suite_helper.dart:451-456 | pkg/compiler/tool/modular_test_suite_helper.dart:514-519 | pkg/compiler/tool/modular_test_suite_helper.dart:579-584 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:546— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:546-551 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:631-636 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:667-672 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:689-694 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:890-895 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) pkg/observatory/lib/src/elements/heap_map.dart:99— pkg/observatory/lib/src/elements/heap_map.dart:99-104 | pkg/observatory/lib/src/elements/icdata_view.dart:91-96 | pkg/observatory/lib/src/elements/ports.dart:81-86 | pkg/observatory/lib/src/elements/sentinel_view.dart:68-73 | pkg/observatory/lib/src/elements/singletargetcache_view.dart:96-101 — before extracting anything, compare `pkg/observatory/lib/src/elements/icdata_view.dart` and `pkg/observatory/lib/src/elements/singletargetcache_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 5) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart:138— pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart:138-143 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart:51-56 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart:53-58 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart:132-137 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart:66-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
Duplicated block (6 lines × 5) pkg/wasm_builder/lib/src/ir/function.dart:246— pkg/wasm_builder/lib/src/ir/function.dart:246-251 | pkg/wasm_builder/lib/src/ir/global.dart:147-152 | pkg/wasm_builder/lib/src/ir/memory.dart:144-149 | pkg/wasm_builder/lib/src/ir/table.dart:124-129 | pkg/wasm_builder/lib/src/ir/tags.dart:15-20 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
AC3 · Page structure· Page without a main landmark · ×3
Page without a main landmark pkg/front_end/tool/benchmark_visualiser.html:1— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark pkg/vm_snapshot_analysis/lib/src/assets/index.html:6— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark tools/dart2js/sourceMapViewer/web/display.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
_ChunkedJsonParser.parseNumber (cyclomatic 42) sdk/lib/_internal/vm/lib/convert_patch.dart:1303— _ChunkedJsonParser.parseNumber 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.
_ChunkedJsonParser.parseNumber (cyclomatic 42) sdk/lib/_internal/wasm/common/convert_patch.dart:1489— _ChunkedJsonParser.parseNumber 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.
_ChunkedJsonParser.parseNumber (cyclomatic 42) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1181— _ChunkedJsonParser.parseNumber 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.
_ChunkedJsonParser.parsePartialNumber (cyclomatic 25) sdk/lib/_internal/vm/lib/convert_patch.dart:640— _ChunkedJsonParser.parsePartialNumber 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.
_ChunkedJsonParser.parsePartialNumber (cyclomatic 25) sdk/lib/_internal/wasm/common/convert_patch.dart:720— _ChunkedJsonParser.parsePartialNumber 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.
_ChunkedJsonParser.parsePartialNumber (cyclomatic 25) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:593— _ChunkedJsonParser.parsePartialNumber 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.
_BigIntImpl.toDouble (cyclomatic 16) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1884— _BigIntImpl.toDouble 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.
_BigIntImpl.toDouble (cyclomatic 16) sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1902— _BigIntImpl.toDouble 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.
_BigIntImpl.toDouble (cyclomatic 16) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2496— _BigIntImpl.toDouble 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.
_ChunkedJsonParser.parseNumber (cognitive 96) sdk/lib/_internal/vm/lib/convert_patch.dart:1303— _ChunkedJsonParser.parseNumber has cognitive complexity 96 (threshold 15). Drivers by points: if/else 35 (74 pts), ternaries 4 (14 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ChunkedJsonParser.parseNumber (cognitive 96) sdk/lib/_internal/wasm/common/convert_patch.dart:1489— _ChunkedJsonParser.parseNumber has cognitive complexity 96 (threshold 15). Drivers by points: if/else 35 (74 pts), ternaries 4 (14 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ChunkedJsonParser.parseNumber (cognitive 96) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1181— _ChunkedJsonParser.parseNumber has cognitive complexity 96 (threshold 15). Drivers by points: if/else 35 (74 pts), ternaries 4 (14 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ChunkedJsonParser.parsePartialNumber (cognitive 47) sdk/lib/_internal/vm/lib/convert_patch.dart:640— _ChunkedJsonParser.parsePartialNumber has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (43 pts), loops 3, 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.
_ChunkedJsonParser.parsePartialNumber (cognitive 47) sdk/lib/_internal/wasm/common/convert_patch.dart:720— _ChunkedJsonParser.parsePartialNumber has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (43 pts), loops 3, 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.
_ChunkedJsonParser.parsePartialNumber (cognitive 47) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:593— _ChunkedJsonParser.parsePartialNumber has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (43 pts), loops 3, 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.
_BigIntImpl.toDouble (cognitive 33) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1884— _BigIntImpl.toDouble has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 4 (7 pts), ternaries 1 (2 pts) (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.
_BigIntImpl.toDouble (cognitive 33) sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1902— _BigIntImpl.toDouble has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 4 (7 pts), ternaries 1 (2 pts) (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.
_BigIntImpl.toDouble (cognitive 33) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2496— _BigIntImpl.toDouble has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 4 (7 pts), ternaries 1 (2 pts) (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.
(anonymous)::onRcpMessage (cognitive 27) REDACTED:58— (anonymous)::onRcpMessage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1, other 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.
(anonymous)::start (cognitive 26) REDACTED:652— (anonymous)::start has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (24 pts), 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.
(anonymous)::hotRestart (cognitive 22) REDACTED:481— (anonymous)::hotRestart has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 3 (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.
_Visitor.visitMethodDeclaration (cognitive 17) pkg/linter/lib/src/rules/avoid_returning_this.dart:69— _Visitor.visitMethodDeclaration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (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.
_Visitor.visitMethodDeclaration (cognitive 17) pkg/linter/lib/src/rules/no_logic_in_create_state.dart:35— _Visitor.visitMethodDeclaration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 pts) (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.
_Visitor.visitMethodDeclaration (cognitive 17) pkg/linter/lib/src/rules/use_setters_to_change_properties.dart:43— _Visitor.visitMethodDeclaration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6 (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.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (8 members, 50+ identical tokens) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:641— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:641-665 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:679-701 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1096-1115 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1124-1145 | sdk/lib/_internal/wasm/common/compact_hash.dart:606-633 | sdk/lib/_internal/wasm/common/compact_hash.dart:636-658 | sdk/lib/_internal/wasm/common/compact_hash.dart:1016-1035 | sdk/lib/_internal/wasm/common/compact_hash.dart:1045-1068 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) pkg/analyzer/lib/src/dart/constant/value.dart:1160— pkg/analyzer/lib/src/dart/constant/value.dart:1160-1180 | pkg/analyzer/lib/src/dart/constant/value.dart:1182-1202 | pkg/analyzer/lib/src/dart/constant/value.dart:1260-1280 | pkg/analyzer/lib/src/dart/constant/value.dart:1282-1302 | pkg/analyzer/lib/src/dart/constant/value.dart:2165-2185 | pkg/analyzer/lib/src/dart/constant/value.dart:2187-2207 | pkg/analyzer/lib/src/dart/constant/value.dart:2263-2283 | pkg/analyzer/lib/src/dart/constant/value.dart:2285-2305 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) pkg/front_end/lib/src/kernel/internal_ast.dart:2667— pkg/front_end/lib/src/kernel/internal_ast.dart:2667-2688 | pkg/front_end/lib/src/kernel/internal_ast.dart:2860-2883 | pkg/front_end/lib/src/kernel/internal_ast.dart:3187-3212 | pkg/front_end/lib/src/kernel/internal_ast.dart:4433-4452 | pkg/front_end/lib/src/kernel/internal_ast.dart:4589-4610 | pkg/front_end/lib/src/kernel/internal_ast.dart:4732-4753 | pkg/front_end/lib/src/kernel/internal_ast.dart:4876-4897 | pkg/front_end/lib/src/kernel/internal_ast.dart:5004-5023 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (7 members, 50+ identical tokens) sdk/lib/_internal/vm/lib/typed_data_patch.dart:515— sdk/lib/_internal/vm/lib/typed_data_patch.dart:515-558 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:858-901 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:976-1019 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1319-1362 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1662-1705 | sdk/lib/_internal/wasm/common/typed_data.dart:2053-2105 | sdk/lib/_internal/wasm/common/typed_data.dart:2405-2460 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) pkg/analyzer/lib/src/summary2/informative_data.dart:175— pkg/analyzer/lib/src/summary2/informative_data.dart:175-202 | pkg/analyzer/lib/src/summary2/informative_data.dart:204-221 | pkg/analyzer/lib/src/summary2/informative_data.dart:274-301 | pkg/analyzer/lib/src/summary2/informative_data.dart:310-336 | pkg/analyzer/lib/src/summary2/informative_data.dart:338-365 | pkg/analyzer/lib/src/summary2/informative_data.dart:468-495 | pkg/analyzer/lib/src/summary2/informative_data.dart:518-529 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) pkg/observatory/lib/src/elements/heap_snapshot.dart:1234— pkg/observatory/lib/src/elements/heap_snapshot.dart:1234-1266 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1268-1297 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1299-1328 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1330-1348 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1350-1381 | pkg/observatory/lib/src/elements/process_snapshot.dart:499-516 | pkg/observatory/lib/src/elements/process_snapshot.dart:518-547 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Duplicated block (68 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:127— sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart:127-194 | sdk/lib/_internal/js_runtime/lib/math_patch.dart:120-187 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart` and `sdk/lib/_internal/js_runtime/lib/math_patch.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (68 lines × 2) sdk/lib/_internal/vm/lib/integers.dart:444— sdk/lib/_internal/vm/lib/integers.dart:444-511 | sdk/lib/_internal/wasm/common/boxed_int.dart:337-404 — before extracting anything, compare `sdk/lib/_internal/vm/lib/integers.dart` and `sdk/lib/_internal/wasm/common/boxed_int.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (68 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7461— pkg/dev_compiler/lib/src/kernel/compiler.dart:7461-7528 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8328-8395 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (61 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/join_if_with_inner.dart:42— pkg/analysis_server/lib/src/services/correction/dart/join_if_with_inner.dart:42-102 | pkg/analysis_server/lib/src/services/correction/dart/join_if_with_outer.dart:48-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (61 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2163— pkg/dev_compiler/lib/src/kernel/compiler.dart:2163-2223 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2463-2523 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (61 lines × 2) pkg/vm_service/lib/src/_stream_helpers.dart:30— pkg/vm_service/lib/src/_stream_helpers.dart:30-90 | pkg/vm_service_interface/lib/src/stream_helpers.dart:28-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (56 lines × 2) pkg/dart2wasm/lib/list_factory_specializer.dart:38— pkg/dart2wasm/lib/list_factory_specializer.dart:38-93 | pkg/vm/lib/modular/specializer/list_factory_specializer.dart:36-91 — before extracting anything, compare `pkg/dart2wasm/lib/list_factory_specializer.dart` and `pkg/vm/lib/modular/specializer/list_factory_specializer.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (56 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:942— sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:942-997 | sdk/lib/_internal/js_runtime/lib/async_patch.dart:660-715 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart` and `sdk/lib/_internal/js_runtime/lib/async_patch.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (56 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5131— pkg/dev_compiler/lib/src/kernel/compiler.dart:5131-5186 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5741-5796 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (50 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1986— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1986-2035 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1524-1573 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (50 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:3626— pkg/dev_compiler/lib/src/kernel/compiler.dart:3626-3675 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4227-4276 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (50 lines × 2) pkg/dart_service_protocol_shared/lib/src/named_lookup.dart:19— pkg/dart_service_protocol_shared/lib/src/named_lookup.dart:19-68 | pkg/dds/lib/src/named_lookup.dart:19-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (39 lines × 2) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1543— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1543-1581 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1561-1599 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (39 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_string.dart:212— sdk/lib/_internal/js_dev_runtime/private/js_string.dart:212-250 | sdk/lib/_internal/js_runtime/lib/js_string.dart:199-237 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_string.dart` and `sdk/lib/_internal/js_runtime/lib/js_string.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (39 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5354— pkg/dev_compiler/lib/src/kernel/compiler.dart:5354-5392 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5964-6002 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (31 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/keyword_state.dart:48— pkg/_fe_analyzer_shared/lib/src/scanner/keyword_state.dart:48-78 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/keyword_state.dart:16-46 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/keyword_state.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/keyword_state.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (31 lines × 2) sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart:66— sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart:66-96 | sdk/lib/_internal/wasm/standalone/boxed_double_patch.dart:19-49 — `sdk/lib/_internal/wasm/js_common/boxed_double_patch.dart` and `sdk/lib/_internal/wasm/standalone/boxed_double_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 76 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (31 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5786— pkg/dev_compiler/lib/src/kernel/compiler.dart:5786-5816 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6441-6471 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (25–26 lines × 2) pkg/dart_runtime_service_dds/lib/devtools_server.dart:627— pkg/dart_runtime_service_dds/lib/devtools_server.dart:627-652 | pkg/dds/lib/devtools_server.dart:618-642 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (25–26 lines × 2) pkg/compiler/lib/src/dump_info.dart:688— pkg/compiler/lib/src/dump_info.dart:688-713 | pkg/compiler/lib/src/dump_info.dart:1501-1525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–26 lines × 2) pkg/front_end/lib/src/kernel/internal_ast.dart:7766— pkg/front_end/lib/src/kernel/internal_ast.dart:7766-7791 | pkg/kernel/lib/src/ast/statements.dart:1292-1316 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23–24 lines × 2) pkg/dart2wasm/lib/code_generator.dart:3061— pkg/dart2wasm/lib/code_generator.dart:3061-3084 | pkg/dart2wasm/lib/code_generator.dart:3166-3188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–24 lines × 2) pkg/front_end/lib/src/type_inference/collection_encoding.dart:1069— pkg/front_end/lib/src/type_inference/collection_encoding.dart:1069-1091 | pkg/front_end/lib/src/type_inference/collection_encoding.dart:1620-1643 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–24 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1267— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1267-1289 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:3838-3861 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 4) sdk/lib/internal/internal.dart:537— sdk/lib/internal/internal.dart:537-556 | sdk/lib/internal/internal.dart:579-598 | sdk/lib/internal/internal.dart:623-642 | sdk/lib/internal/internal.dart:669-688 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (20 lines × 4) pkg/front_end/lib/src/fragment/class/declaration.dart:76— pkg/front_end/lib/src/fragment/class/declaration.dart:76-95 | pkg/front_end/lib/src/fragment/class/declaration.dart:148-167 | pkg/front_end/lib/src/fragment/class/declaration.dart:221-240 | pkg/front_end/lib/src/fragment/class/declaration.dart:357-376 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (20 lines × 4) pkg/front_end/lib/src/type_inference/inference_visitor.dart:5559— pkg/front_end/lib/src/type_inference/inference_visitor.dart:5559-5578 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5647-5666 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5721-5740 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5858-5877 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–16 lines × 2) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:70— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:70-85 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_with_plugin_that_times_out.dart:73-85 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13–16 lines × 2) sdk/lib/_internal/vm/lib/growable_array.dart:50— sdk/lib/_internal/vm/lib/growable_array.dart:50-65 | sdk/lib/_internal/wasm/common/list.dart:568-580 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13–16 lines × 2) sdk/lib/core/uri.dart:2282— sdk/lib/core/uri.dart:2282-2297 | sdk/lib/core/uri.dart:4753-4765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 3) pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart:37— pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart:37-50 | pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart:31-43 | pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart:30-42 — before extracting anything, compare `pkg/analysis_server/lib/src/lsp/handlers/handler_format_range.dart` and `pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13–14 lines × 3) pkg/analyzer/lib/src/dart/analysis/driver.dart:1788— pkg/analyzer/lib/src/dart/analysis/driver.dart:1788-1801 | pkg/analyzer/lib/src/dart/analysis/driver.dart:1871-1884 | pkg/analyzer/lib/src/dart/analysis/driver.dart:2071-2083 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–14 lines × 3) pkg/analyzer/lib/src/summary2/bundle_writer.dart:139— pkg/analyzer/lib/src/summary2/bundle_writer.dart:139-152 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:265-277 | pkg/analyzer/lib/src/summary2/bundle_writer.dart:660-672 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 5) sdk/lib/_internal/vm/lib/typed_data_patch.dart:515— sdk/lib/_internal/vm/lib/typed_data_patch.dart:515-527 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:858-870 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:976-988 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1319-1331 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1662-1674 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 5) sdk/lib/_internal/vm/lib/typed_data_patch.dart:546— sdk/lib/_internal/vm/lib/typed_data_patch.dart:546-558 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:889-901 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1007-1019 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1350-1362 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1693-1705 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 5) pkg/analyzer/lib/src/fine/library_manifest.dart:2007— pkg/analyzer/lib/src/fine/library_manifest.dart:2007-2019 | pkg/analyzer/lib/src/fine/library_manifest.dart:2033-2045 | pkg/analyzer/lib/src/fine/library_manifest.dart:2059-2071 | pkg/analyzer/lib/src/fine/library_manifest.dart:2085-2097 | pkg/analyzer/lib/src/fine/library_manifest.dart:2111-2123 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–12 lines × 3) sdk/lib/_internal/vm/lib/mirrors_impl.dart:251— sdk/lib/_internal/vm/lib/mirrors_impl.dart:251-260 | sdk/lib/_internal/vm/lib/mirrors_impl.dart:348-357 | sdk/lib/_internal/vm/lib/mirrors_impl.dart:722-733 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–12 lines × 3) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart:56— pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart:56-67 | pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart:136-145 | pkg/analysis_server/lib/src/services/correction/dart/add_missing_switch_cases.dart:175-184 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10–12 lines × 3) pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:206— pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:206-215 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:381-390 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:424-435 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:282— sdk/lib/_internal/vm/lib/typed_data_patch.dart:282-292 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:618-628 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:964-974 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1307-1317 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1650-1660 | sdk/lib/_internal/wasm/common/typed_data.dart:2159-2169 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 6) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1227— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1227-1237 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1350-1360 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1475-1485 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1598-1608 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1794-1804 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1898-1908 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 6) sdk/lib/vmservice/devfs.dart:182— sdk/lib/vmservice/devfs.dart:182-192 | sdk/lib/vmservice/devfs.dart:204-214 | sdk/lib/vmservice/devfs.dart:224-234 | sdk/lib/vmservice/devfs.dart:281-291 | sdk/lib/vmservice/devfs.dart:338-348 | sdk/lib/vmservice/devfs.dart:398-408 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:382— sdk/lib/_internal/vm/lib/typed_data_patch.dart:382-391 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:719-728 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1111-1120 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1454-1463 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1797-1806 | sdk/lib/_internal/wasm/common/typed_data.dart:2259-2268 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:437— sdk/lib/_internal/vm/lib/typed_data_patch.dart:437-446 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:774-783 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1169-1178 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1512-1521 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1855-1864 | sdk/lib/_internal/wasm/common/typed_data.dart:2318-2327 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 6) pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:29— pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:29-38 | pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart:29-38 | pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart:29-38 | pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart:33-42 | pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart:31-40 | pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart:29-38 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 5) pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:249— pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:249-258 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:281-290 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:313-322 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:541-550 | pkg/front_end/lib/src/util/abstracted_ast_nodes.dart:572-581 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 5) pkg/linter/lib/src/rules/always_declare_return_types.dart:29— pkg/linter/lib/src/rules/always_declare_return_types.dart:29-38 | pkg/linter/lib/src/rules/annotate_overrides.dart:26-35 | pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart:32-41 | pkg/linter/lib/src/rules/noop_primitive_operations.dart:24-33 | pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart:33-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
Duplicated block (10 lines × 5) pkg/test_runner/lib/src/runtime_configuration.dart:437— pkg/test_runner/lib/src/runtime_configuration.dart:437-447 | pkg/test_runner/lib/src/runtime_configuration.dart:479-489 | pkg/test_runner/lib/src/runtime_configuration.dart:512-521 | pkg/test_runner/lib/src/runtime_configuration.dart:547-556 | pkg/test_runner/lib/src/runtime_configuration.dart:582-592 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–10 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart:60— pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart:60-68 | pkg/analysis_server/lib/src/services/correction/dart/change_to_static_access.dart:70-79 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart:88— pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart:88-96 | pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart:148-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart:296— pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart:296-304 | pkg/dds/lib/src/devtools/memory_profile.dart:335-344 — before extracting anything, compare `pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart` and `pkg/dds/lib/src/devtools/memory_profile.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–9 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:459— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:459-465 | sdk/lib/_internal/js_runtime/lib/js_array.dart:560-568 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–9 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:469— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:469-475 | sdk/lib/_internal/js_runtime/lib/js_array.dart:572-580 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–9 lines × 2) pkg/dart_runtime_service/lib/src/devtools/client.dart:111— pkg/dart_runtime_service/lib/src/devtools/client.dart:111-119 | pkg/dds/lib/src/devtools/client.dart:136-142 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 4) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:595— sdk/lib/_internal/js_runtime/lib/collection_patch.dart:595-599 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:282-286 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:500-504 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:521-525 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 4) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:358— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:358-362 | sdk/lib/_internal/js_runtime/lib/js_array.dart:467-471 | sdk/lib/_internal/vm/lib/array.dart:60-64 | sdk/lib/_internal/wasm/common/typed_data.dart:2365-2369 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 4) pkg/analyzer_plugin/lib/plugin/folding_mixin.dart:20— pkg/analyzer_plugin/lib/plugin/folding_mixin.dart:20-24 | pkg/analyzer_plugin/lib/plugin/highlights_mixin.dart:20-24 | pkg/analyzer_plugin/lib/plugin/occurrences_mixin.dart:20-24 | pkg/analyzer_plugin/lib/plugin/outline_mixin.dart:20-24 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (12 lines × 2 locations) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:868— pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:868 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:902 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:32— runtime/tools/graphexplorer/graphexplorer.js:32 · runtime/tools/graphexplorer/graphexplorer.js:46 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:1078— runtime/tools/graphexplorer/graphexplorer.js:1078 · runtime/tools/graphexplorer/graphexplorer.js:1091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:70— runtime/tools/graphexplorer/graphexplorer.js:70 · runtime/tools/graphexplorer/graphexplorer.js:202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:981— runtime/tools/graphexplorer/graphexplorer.js:981 · runtime/tools/graphexplorer/graphexplorer.js:994 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:1878— runtime/tools/graphexplorer/graphexplorer.js:1878 · runtime/tools/graphexplorer/graphexplorer.js:1887 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
_BigIntImpl._binaryGcd (cyclomatic 77) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1504— _BigIntImpl._binaryGcd has cyclomatic complexity 77 (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.
_BigIntImpl._binaryGcd (cyclomatic 77) sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1523— _BigIntImpl._binaryGcd has cyclomatic complexity 77 (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.
AbstractScanner.tokenizeLanguageVersionOrSingleLineComment (cyclomatic 22) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1386— AbstractScanner.tokenizeLanguageVersionOrSingleLineComment has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AbstractScanner.tokenizeLanguageVersionOrSingleLineComment (cyclomatic 22) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1828— AbstractScanner.tokenizeLanguageVersionOrSingleLineComment has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
(anonymous)::onRcpMessage (cyclomatic 18) REDACTED:58— (anonymous)::onRcpMessage 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.
(anonymous)::hotRestart (cyclomatic 17) REDACTED:481— (anonymous)::hotRestart 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.
AbstractScanner.tokenizeKeywordOrIdentifier (cyclomatic 17) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1353— AbstractScanner.tokenizeKeywordOrIdentifier has cyclomatic complexity 17 (threshold 15). 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.
AbstractScanner.tokenizeKeywordOrIdentifier (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2089— AbstractScanner.tokenizeKeywordOrIdentifier has cyclomatic complexity 17 (threshold 15). 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.
_ChunkedJsonParser.parseStringEscape (cyclomatic 17) sdk/lib/_internal/vm/lib/convert_patch.dart:1191— _ChunkedJsonParser.parseStringEscape 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.
_ChunkedJsonParser.parseStringEscape (cyclomatic 17) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1069— _ChunkedJsonParser.parseStringEscape 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.
_BigIntImpl._binaryGcd (cognitive 181) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1504— _BigIntImpl._binaryGcd has cognitive complexity 181 (threshold 15). Drivers by points: if/else 62 (142 pts), boolean chains 24, loops 8 (14 pts), ternaries 1 (nesting depth added 86). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_BigIntImpl._binaryGcd (cognitive 181) sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1523— _BigIntImpl._binaryGcd has cognitive complexity 181 (threshold 15). Drivers by points: if/else 62 (142 pts), boolean chains 24, loops 8 (14 pts), ternaries 1 (nesting depth added 86). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeMultiLineComment (cognitive 38) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1513— AbstractScanner.tokenizeMultiLineComment has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeMultiLineComment (cognitive 38) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1965— AbstractScanner.tokenizeMultiLineComment has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeNumber (cognitive 35) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1686— AbstractScanner.tokenizeNumber has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 2 (8 pts), boolean chains 3, loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeNumber (cognitive 35) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1533— AbstractScanner.tokenizeNumber has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 2 (8 pts), boolean chains 3, loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeMultiLineString (cognitive 33) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1621— AbstractScanner.tokenizeMultiLineString has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeMultiLineString (cognitive 33) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2402— AbstractScanner.tokenizeMultiLineString has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AsyncRewriterBase.visitSwitch (cognitive 26) pkg/compiler/lib/src/js/rewrite_async.dart:1571— AsyncRewriterBase.visitSwitch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 3 (5 pts), 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.
AsyncRewriterBase.visitSwitch (cognitive 26) pkg/dev_compiler/lib/src/compiler/rewrite_async.dart:1615— AsyncRewriterBase.visitSwitch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 3 (5 pts), 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.
AbstractScanner.tokenizeMultiLineRawString (cognitive 24) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1575— AbstractScanner.tokenizeMultiLineRawString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 pts) (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.
AbstractScanner.tokenizeMultiLineRawString (cognitive 24) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2352— AbstractScanner.tokenizeMultiLineRawString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 pts) (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.
AbstractScanner.tokenizeHex (cognitive 22) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1225— AbstractScanner.tokenizeHex has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, ternaries 1 (3 pts), 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.
AbstractScanner.tokenizeHex (cognitive 22) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1610— AbstractScanner.tokenizeHex has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, ternaries 1 (3 pts), 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.
AbstractScanner.tokenizeLanguageVersionOrSingleLineComment (cognitive 21) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1386— AbstractScanner.tokenizeLanguageVersionOrSingleLineComment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, loops 6, boolean chains 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.
AbstractScanner.tokenizeLanguageVersionOrSingleLineComment (cognitive 21) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1828— AbstractScanner.tokenizeLanguageVersionOrSingleLineComment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, loops 6, boolean chains 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.
AbstractScanner.tokenizeIdentifier (cognitive 20) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1268— AbstractScanner.tokenizeIdentifier has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (2 pts) (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.
AbstractScanner.tokenizeIdentifier (cognitive 20) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2124— AbstractScanner.tokenizeIdentifier has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (2 pts) (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.
AbstractScanner.discardBeginGroupUntil (cognitive 19) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:686— AbstractScanner.discardBeginGroupUntil has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (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.
AbstractScanner.discardBeginGroupUntil (cognitive 19) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:735— AbstractScanner.discardBeginGroupUntil has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (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.
_ChunkedJsonParser.parseStringEscape (cognitive 19) sdk/lib/_internal/vm/lib/convert_patch.dart:1191— _ChunkedJsonParser.parseStringEscape has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts), 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.
_ChunkedJsonParser.parseStringEscape (cognitive 19) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1069— _ChunkedJsonParser.parseStringEscape has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts), 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.
AbstractScanner.tokenizeSingleLineString (cognitive 18) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1852— AbstractScanner.tokenizeSingleLineString has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 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.
AbstractScanner.tokenizeSingleLineString (cognitive 18) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2198— AbstractScanner.tokenizeSingleLineString has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 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.
int._parse (cognitive 18) sdk/lib/_internal/vm_shared/lib/integers_patch.dart:84— int._parse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
int._parse (cognitive 18) sdk/lib/_internal/wasm/common/int_patch.dart:52— int._parse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.visitBinaryExpression (cognitive 18) REDACTED:42— _Visitor.visitBinaryExpression has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), 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.
_Visitor.visitBinaryExpression (cognitive 18) pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart:37— _Visitor.visitBinaryExpression has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, ternaries 1 (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.
AbstractScanner.tokenizeKeywordOrIdentifier (cognitive 17) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1353— AbstractScanner.tokenizeKeywordOrIdentifier has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 6, loops 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.
AbstractScanner.tokenizeKeywordOrIdentifier (cognitive 17) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:2089— AbstractScanner.tokenizeKeywordOrIdentifier has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 6, loops 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.
_LinkedHashSetMixin._add (cognitive 16) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1060— _LinkedHashSetMixin._add has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, ternaries 1 (2 pts), 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.
_LinkedHashSetMixin._add (cognitive 16) sdk/lib/_internal/wasm/common/compact_hash.dart:980— _LinkedHashSetMixin._add has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, ternaries 1 (2 pts), 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.
AsyncRewriterBase.visitTry (cognitive 16) pkg/compiler/lib/src/js/rewrite_async.dart:1715— AsyncRewriterBase.visitTry has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AsyncRewriterBase.visitTry (cognitive 16) pkg/dev_compiler/lib/src/compiler/rewrite_async.dart:1765— AsyncRewriterBase.visitTry has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FunctionTooLong: graphexplorer.showTables runtime/tools/graphexplorer/graphexplorer.js:1835— FunctionTooLong — showTables runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: graphexplorer.createTreemapTile runtime/tools/graphexplorer/graphexplorer.js:1279— FunctionTooLong — createTreemapTile runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Near-duplicate member pair (86 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821-7064 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7066-7255 — These two members are variants of one another: 86 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (86 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821-7064 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7257-7524 — These two members are variants of one another: 86 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) pkg/analyzer/lib/src/utilities/string_search.dart:87— pkg/analyzer/lib/src/utilities/string_search.dart:87-123 | pkg/analyzer/lib/src/utilities/string_search.dart:125-161 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) pkg/front_end/lib/src/fragment/constructor/encoding.dart:959— pkg/front_end/lib/src/fragment/constructor/encoding.dart:959-1005 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:1057-1100 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (14 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (14 members, 50+ identical tokens) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:152— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:152-161 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:196-202 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:228-237 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:272-278 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:167-176 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:211-217 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:255-264 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:299-305 | sdk/lib/_internal/wasm/common/simd.dart:24-33 | sdk/lib/_internal/wasm/common/simd.dart:64-70 | sdk/lib/_internal/wasm/common/simd.dart:128-137 | sdk/lib/_internal/wasm/common/simd.dart:168-174 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1705-1713 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2605-2613 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
Members sharing a duplicated core (14 members, 50+ identical tokens) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:132— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:132-180 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:243-285 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:580-618 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:629-676 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:698-745 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:795-834 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:842-878 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:885-919 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:953-1002 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1010-1052 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1068-1110 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1218-1252 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1263-1297 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1405-1451 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
Duplicated block (97 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1828— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1828-1924 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1386-1482 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (97 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2199— pkg/front_end/lib/src/type_inference/inference_visitor.dart:2199-2295 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6047-6143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (90 lines × 2) pkg/js_shared/lib/synced/recipe_syntax.dart:170— pkg/js_shared/lib/synced/recipe_syntax.dart:170-259 | sdk/lib/_internal/js_shared/lib/synced/recipe_syntax.dart:170-259 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (90 lines × 2) pkg/front_end/testcases/general/getter_call.dart:27— pkg/front_end/testcases/general/getter_call.dart:27-116 | pkg/front_end/testcases/implicit_getter_calls/getter_call.dart:27-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (70 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:1536— sdk/lib/_internal/wasm/common/convert_patch.dart:1536-1605 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1228-1297 — `sdk/lib/_internal/wasm/common/convert_patch.dart` and `sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 265 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (70 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5060— pkg/dev_compiler/lib/src/kernel/compiler.dart:5060-5129 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5670-5739 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (58 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2061— pkg/dev_compiler/lib/src/kernel/compiler.dart:2061-2118 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2361-2418 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (58 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8248— pkg/dev_compiler/lib/src/kernel/compiler.dart:8248-8305 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:9117-9174 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (49 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1093— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1093-1141 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:429-477 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (49 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:5752— pkg/front_end/lib/src/type_inference/inference_visitor.dart:5752-5800 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5899-5947 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (46 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:1233— pkg/dev_compiler/lib/src/kernel/compiler.dart:1233-1278 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1526-1571 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (46 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5307— pkg/dev_compiler/lib/src/kernel/compiler.dart:5307-5352 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5917-5962 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (42 lines × 2) sdk/lib/_internal/wasm/common/convert_patch.dart:1494— sdk/lib/_internal/wasm/common/convert_patch.dart:1494-1535 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1186-1227 — `sdk/lib/_internal/wasm/common/convert_patch.dart` and `sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 265 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (42 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7063— pkg/dev_compiler/lib/src/kernel/compiler.dart:7063-7104 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7930-7971 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (38 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:13808— pkg/front_end/lib/src/type_inference/inference_visitor.dart:13808-13845 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:14094-14131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (38 lines × 2) sdk/lib/vmservice/devfs.dart:229— sdk/lib/vmservice/devfs.dart:229-266 | sdk/lib/vmservice/devfs.dart:286-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1771— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1771-1802 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2355-2386 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7303-7334 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (32 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6592— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6592-6623 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6685-6716 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8874-8905 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (31–32 lines × 2) pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart:37— pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart:37-67 | pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart:43-74 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (31–32 lines × 2) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:327— pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:327-357 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:420-451 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 3) pkg/front_end/lib/src/source/source_method_builder.dart:347— pkg/front_end/lib/src/source/source_method_builder.dart:347-376 | pkg/front_end/lib/src/source/source_property_builder.dart:589-618 | pkg/front_end/lib/src/source/source_property_builder.dart:735-764 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (30 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:5557— pkg/front_end/lib/src/type_inference/inference_visitor.dart:5557-5586 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5645-5674 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:5719-5748 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (28–30 lines × 2) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:332— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:332-359 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:400-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28–30 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:2635— pkg/front_end/lib/src/kernel/body_builder.dart:2635-2664 | pkg/front_end/lib/src/kernel/body_builder.dart:2684-2711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–30 lines × 2) pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart:108— pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart:108-137 | pkg/analyzer/lib/src/generated/static_type_analyzer.dart:86-111 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (26–30 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2940— pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2940-2965 | pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3233-3262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 4) pkg/front_end/testcases/general/lookup.dart:82— pkg/front_end/testcases/general/lookup.dart:82-110 | pkg/front_end/testcases/general/lookup.dart:127-155 | pkg/front_end/testcases/general/lookup.dart:175-203 | pkg/front_end/testcases/general/lookup.dart:221-249 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (29 lines × 4) pkg/front_end/testcases/general/lookup.dart:372— pkg/front_end/testcases/general/lookup.dart:372-400 | pkg/front_end/testcases/general/lookup.dart:419-447 | pkg/front_end/testcases/general/lookup.dart:467-495 | pkg/front_end/testcases/general/lookup.dart:513-541 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (26–27 lines × 2) pkg/compiler/lib/src/universe/member_usage.dart:340— pkg/compiler/lib/src/universe/member_usage.dart:340-366 | pkg/compiler/lib/src/universe/member_usage.dart:495-520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–27 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:3709— pkg/dev_compiler/lib/src/kernel/compiler.dart:3709-3735 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4309-4334 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19–25 lines × 2) pkg/analyzer/tool/ast/generate.dart:233— pkg/analyzer/tool/ast/generate.dart:233-257 | pkg/analyzer/tool/ast/generate.dart:1218-1236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–25 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:10147— pkg/front_end/lib/src/kernel/body_builder.dart:10147-10171 | pkg/front_end/lib/src/kernel/body_builder.dart:10489-10507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 3) pkg/analyzer/lib/src/summary2/bundle_reader.dart:501— pkg/analyzer/lib/src/summary2/bundle_reader.dart:501-523 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:656-678 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1110-1132 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (23 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2267— pkg/front_end/lib/src/type_inference/inference_visitor.dart:2267-2289 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6115-6137 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6234-6256 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19–21 lines × 2) pkg/analysis_server/tool/code_completion/completion_metrics.dart:779— pkg/analysis_server/tool/code_completion/completion_metrics.dart:779-799 | REDACTED:489-507 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19–21 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:1772— pkg/front_end/lib/src/kernel/constant_evaluator.dart:1772-1790 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:1881-1901 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 3) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:264— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:264-282 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:301-319 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:369-386 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18–19 lines × 3) sdk/lib/_internal/vm/lib/math_patch.dart:294— sdk/lib/_internal/vm/lib/math_patch.dart:294-311 | sdk/lib/_internal/wasm/js_common/math_externs_patch.dart:116-134 | sdk/lib/_internal/wasm/standalone/math_externs_patch.dart:71-89 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (18 lines × 3) pkg/wasm_builder/lib/src/serialize/sections.dart:1183— pkg/wasm_builder/lib/src/serialize/sections.dart:1183-1200 | pkg/wasm_builder/lib/src/serialize/sections.dart:1235-1252 | pkg/wasm_builder/lib/src/serialize/sections.dart:1291-1308 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18 lines × 3) REDACTED:1972— REDACTED:1972-1989 | REDACTED:2117-2134 | REDACTED:2164-2181 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 5) pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:31— pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:31-46 | pkg/analysis_server/lib/src/services/snippets/dart/for_in_statement.dart:34-49 | pkg/analysis_server/lib/src/services/snippets/dart/function_declaration.dart:35-50 | pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart:31-46 | pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart:33-48 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 5) pkg/analyzer/lib/src/lint/pub.dart:334— pkg/analyzer/lib/src/lint/pub.dart:334-349 | pkg/analyzer/lib/src/summary2/informative_data.dart:650-665 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:1083-1100 | pkg/front_end/lib/src/kernel/resolver.dart:1538-1553 | pkg/front_end/lib/src/source/source_compilation_unit.dart:215-230 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
Duplicated block (16 lines × 4) pkg/analyzer/lib/src/dart/ast/ast.dart:20388— pkg/analyzer/lib/src/dart/ast/ast.dart:20388-20403 | pkg/analyzer/lib/src/dart/ast/ast.dart:22026-22041 | pkg/analyzer/lib/src/dart/ast/ast.dart:49557-49572 | pkg/analyzer/lib/src/dart/ast/ast.dart:53036-53051 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 4) pkg/front_end/lib/src/fragment/constructor/encoding.dart:218— pkg/front_end/lib/src/fragment/constructor/encoding.dart:218-233 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:267-282 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:965-980 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:1063-1078 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15–16 lines × 3) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:172— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:172-186 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:194-208 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:314-329 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15–16 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:281— pkg/front_end/lib/src/fragment/getter/encoding.dart:281-295 | pkg/front_end/lib/src/fragment/method/encoding.dart:225-240 | pkg/front_end/lib/src/fragment/setter/encoding.dart:281-295 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (14–15 lines × 3) pkg/analyzer/lib/src/dart/element/element.dart:1076— pkg/analyzer/lib/src/dart/element/element.dart:1076-1090 | pkg/analyzer/lib/src/dart/element/element.dart:9006-9019 | pkg/analyzer/lib/src/dart/element/element.dart:10880-10893 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–15 lines × 3) pkg/analyzer/lib/src/summary2/metadata_resolver.dart:53— pkg/analyzer/lib/src/summary2/metadata_resolver.dart:53-66 | pkg/analyzer/lib/src/summary2/metadata_resolver.dart:99-112 | pkg/analyzer/lib/src/summary2/metadata_resolver.dart:140-154 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 6) pkg/analyzer/tool/ast/generate.dart:398— pkg/analyzer/tool/ast/generate.dart:398-409 | pkg/analyzer/tool/ast/generate.dart:475-486 | pkg/analyzer/tool/ast/generate.dart:552-563 | pkg/analyzer/tool/ast/generate.dart:634-645 | pkg/analyzer/tool/ast/generate.dart:727-738 | pkg/analyzer/tool/ast/generate.dart:895-906 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 6) pkg/analyzer/tool/ast/generate.dart:441— pkg/analyzer/tool/ast/generate.dart:441-452 | pkg/analyzer/tool/ast/generate.dart:511-522 | pkg/analyzer/tool/ast/generate.dart:597-608 | pkg/analyzer/tool/ast/generate.dart:680-691 | pkg/analyzer/tool/ast/generate.dart:773-784 | pkg/analyzer/tool/ast/generate.dart:990-1001 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 4) pkg/observatory/lib/src/elements/instance_view.dart:355— pkg/observatory/lib/src/elements/instance_view.dart:355-365 | pkg/observatory/lib/src/elements/instance_view.dart:391-402 | pkg/observatory/lib/src/elements/instance_view.dart:430-441 | pkg/observatory/lib/src/elements/instance_view.dart:496-507 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 4) pkg/observatory/lib/src/elements/library_view.dart:212— pkg/observatory/lib/src/elements/library_view.dart:212-223 | pkg/observatory/lib/src/elements/library_view.dart:246-256 | pkg/observatory/lib/src/elements/library_view.dart:271-281 | pkg/observatory/lib/src/elements/library_view.dart:339-349 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 3) pkg/compiler/lib/src/ir/scope_visitor.dart:1140— pkg/compiler/lib/src/ir/scope_visitor.dart:1140-1150 | pkg/compiler/lib/src/ir/scope_visitor.dart:1168-1179 | pkg/compiler/lib/src/ir/scope_visitor.dart:1186-1197 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7030— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7030-7040 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7231-7242 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7496-7507 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 9) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart:121— pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart:121-131 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart:105-115 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart:145-155 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_label.dart:58-68 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_library.dart:60-70 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart:233-243 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_parameter.dart:139-149 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_type_parameter.dart:73-83 | pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart:160-170 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 9 call sites, so a change lands once.
Duplicated block (11 lines × 9) pkg/wasm_builder/lib/src/builder/instructions.dart:6016— pkg/wasm_builder/lib/src/builder/instructions.dart:6016-6026 | pkg/wasm_builder/lib/src/builder/instructions.dart:6031-6041 | pkg/wasm_builder/lib/src/builder/instructions.dart:6046-6056 | pkg/wasm_builder/lib/src/builder/instructions.dart:6061-6071 | pkg/wasm_builder/lib/src/builder/instructions.dart:6076-6086 | pkg/wasm_builder/lib/src/builder/instructions.dart:6091-6101 | pkg/wasm_builder/lib/src/builder/instructions.dart:6106-6116 | pkg/wasm_builder/lib/src/builder/instructions.dart:6121-6131 | pkg/wasm_builder/lib/src/builder/instructions.dart:6226-6236 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 7) pkg/analyzer/lib/src/dart/ast/ast.dart:25664— pkg/analyzer/lib/src/dart/ast/ast.dart:25664-25674 | pkg/analyzer/lib/src/dart/ast/ast.dart:26840-26850 | pkg/analyzer/lib/src/dart/ast/ast.dart:36875-36885 | pkg/analyzer/lib/src/dart/ast/ast.dart:37250-37260 | pkg/analyzer/lib/src/dart/ast/ast.dart:41373-41383 | pkg/analyzer/lib/src/dart/ast/ast.dart:51052-51062 | pkg/analyzer/lib/src/dart/ast/ast.dart:55522-55532 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 7) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2454— pkg/front_end/lib/src/type_inference/inference_visitor.dart:2454-2465 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8617-8627 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8639-8650 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8813-8823 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8835-8846 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9078-9088 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9102-9113 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–11 lines × 3) pkg/analyzer/lib/src/summary2/element_builder.dart:1629— pkg/analyzer/lib/src/summary2/element_builder.dart:1629-1638 | pkg/analyzer/lib/src/summary2/element_builder.dart:1662-1671 | pkg/analyzer/lib/src/summary2/element_builder.dart:1886-1896 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–11 lines × 3) pkg/observatory/lib/src/elements/field_view.dart:169— pkg/observatory/lib/src/elements/field_view.dart:169-178 | pkg/observatory/lib/src/elements/function_view.dart:152-161 | pkg/observatory/lib/src/elements/instance_view.dart:170-180 — before extracting anything, compare `pkg/observatory/lib/src/elements/field_view.dart` and `pkg/observatory/lib/src/elements/function_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 5) sdk/lib/_internal/vm/lib/typed_data_patch.dart:496— sdk/lib/_internal/vm/lib/typed_data_patch.dart:496-504 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:834-842 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1236-1244 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1579-1587 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1922-1930 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 5) pkg/analyzer/lib/src/fine/manifest_item.dart:83— pkg/analyzer/lib/src/fine/manifest_item.dart:83-91 | pkg/analyzer/lib/src/fine/manifest_item.dart:273-281 | pkg/analyzer/lib/src/fine/manifest_item.dart:380-388 | pkg/analyzer/lib/src/fine/manifest_item.dart:464-472 | pkg/analyzer/lib/src/fine/manifest_item.dart:1367-1375 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 7) pkg/analyzer/lib/src/summary2/informative_data.dart:178— pkg/analyzer/lib/src/summary2/informative_data.dart:178-186 | pkg/analyzer/lib/src/summary2/informative_data.dart:207-215 | pkg/analyzer/lib/src/summary2/informative_data.dart:277-285 | pkg/analyzer/lib/src/summary2/informative_data.dart:313-321 | pkg/analyzer/lib/src/summary2/informative_data.dart:341-349 | pkg/analyzer/lib/src/summary2/informative_data.dart:471-479 | pkg/analyzer/lib/src/summary2/informative_data.dart:519-526 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 7) pkg/linter/lib/src/rules/avoid_function_literals_in_foreach_calls.dart:52— pkg/linter/lib/src/rules/avoid_function_literals_in_foreach_calls.dart:52-59 | pkg/linter/lib/src/rules/avoid_print.dart:26-33 | pkg/linter/lib/src/rules/avoid_slow_async_io.dart:33-40 | pkg/linter/lib/src/rules/prefer_inlined_adds.dart:26-33 | pkg/linter/lib/src/rules/prefer_iterable_whereType.dart:25-32 | pkg/linter/lib/src/rules/prefer_spread_collections.dart:23-30 | pkg/linter/lib/src/rules/unnecessary_unawaited.dart:24-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once.
Duplicated block (8 lines × 9) pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart:33— pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart:33-40 | pkg/linter/lib/src/rules/avoid_null_checks_in_equality_operators.dart:54-61 | pkg/linter/lib/src/rules/avoid_returning_this.dart:28-35 | pkg/linter/lib/src/rules/no_logic_in_create_state.dart:24-31 | pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart:33-40 | pkg/linter/lib/src/rules/unnecessary_overrides.dart:28-35 | pkg/linter/lib/src/rules/use_setters_to_change_properties.dart:32-39 | pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart:35-42 | pkg/linter/tool/checks/rules/visit_registered_nodes.dart:27-34 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 9 times.
Duplicated block (8 lines × 9) pkg/linter/lib/src/rules/avoid_unnecessary_containers.dart:25— pkg/linter/lib/src/rules/avoid_unnecessary_containers.dart:25-33 | pkg/linter/lib/src/rules/sized_box_for_whitespace.dart:24-32 | pkg/linter/lib/src/rules/sized_box_shrink_expand.dart:26-34 | pkg/linter/lib/src/rules/sort_child_properties_last.dart:24-31 | pkg/linter/lib/src/rules/unnecessary_new.dart:27-34 | pkg/linter/lib/src/rules/use_colored_box.dart:25-33 | pkg/linter/lib/src/rules/use_decorated_box.dart:24-32 | pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart:30-37 | pkg/linter/lib/src/rules/valid_regexps.dart:23-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 9 call sites, so a change lands once.
Duplicated block (40 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:3193— pkg/dev_compiler/lib/src/kernel/compiler.dart:3193-3232 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:3708-3747 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (40 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4901— pkg/dev_compiler/lib/src/kernel/compiler.dart:4901-4940 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5511-5550 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2 locations) REDACTED:1705— REDACTED:1705 · REDACTED:1736 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (22 lines × 2 locations) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:443— pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:443 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:609 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) pkg/observatory/web/timeline.js:711— pkg/observatory/web/timeline.js:711 · pkg/observatory/web/timeline.js:750 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:144— runtime/tools/graphexplorer/graphexplorer.js:144 · runtime/tools/graphexplorer/graphexplorer.js:299 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:341— runtime/tools/graphexplorer/graphexplorer.js:341 · runtime/tools/graphexplorer/graphexplorer.js:359 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:392— runtime/tools/graphexplorer/graphexplorer.js:392 · runtime/tools/graphexplorer/graphexplorer.js:796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC3 · Page structure· Data table has no header cells · ×1
Data table has no header cells tools/dart2js/sourceMapViewer/web/display.html:37— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
REDACTED contrast colour pair in CSS (1.3:1) tools/dart2js/sourceMapViewer/web/display.html:7— `span.marker` sets color: green on background-color: red — 1.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
REDACTED contrast colour pair in CSS (3.9:1) pkg/observatory/lib/src/elements/css/shared.css:2049— `nav.nav-bar > ul` sets color: white on background-color: #0489c3 — 3.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no accessibility linting at author time and no automated accessibility check in tests or CI. Add your UI toolkit's own accessibility assertion to the test suite (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in the pipeline. What was searched, so you can tell an absence from a miss: the 13 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
Intrinsifier.generateStaticIntrinsic (cyclomatic 374) pkg/dart2wasm/lib/intrinsics.dart:1362— Intrinsifier.generateStaticIntrinsic has cyclomatic complexity 374 (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.
Instruction.deserialize (cyclomatic 240) pkg/wasm_builder/lib/src/ir/instruction.dart:87— Instruction.deserialize has cyclomatic complexity 240 (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.
Types.performSubtypeCheck (cyclomatic 195) pkg/kernel/lib/src/types.dart:65— Types.performSubtypeCheck has cyclomatic complexity 195 (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.
TokensWriter.astToBinaryTokenType (cyclomatic 143) pkg/analyzer/lib/src/summary2/tokens_writer.dart:9— TokensWriter.astToBinaryTokenType has cyclomatic complexity 143 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_HttpParser._doParse (cyclomatic 127) sdk/lib/_http/http_parser.dart:486— _HttpParser._doParse has cyclomatic complexity 127 (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.
RequirementsManifest.isSatisfied (cyclomatic 109) pkg/analyzer/lib/src/fine/requirements.dart:956— RequirementsManifest.isSatisfied has cyclomatic complexity 109 (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.
ImpactData.apply (cyclomatic 100) pkg/compiler/lib/src/ir/impact_data.dart:1438— ImpactData.apply has cyclomatic complexity 100 (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.
_Visitor.visitParenthesizedExpression (cyclomatic 94) pkg/linter/lib/src/rules/unnecessary_parenthesis.dart:56— _Visitor.visitParenthesizedExpression has cyclomatic complexity 94 (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.
BodyBuilderImpl.resolveAndBuildConstructorInvocation (cyclomatic 92) pkg/front_end/lib/src/kernel/body_builder.dart:9979— BodyBuilderImpl.resolveAndBuildConstructorInvocation has cyclomatic complexity 92 (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.parseClassOrMixinOrExtensionOrEnumMemberImpl (cyclomatic 90) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5273— Parser.parseClassOrMixinOrExtensionOrEnumMemberImpl 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.
SubtypeHelper._isSubtypeOf (cyclomatic 88) pkg/analyzer/lib/src/dart/element/subtype.dart:262— SubtypeHelper._isSubtypeOf has cyclomatic complexity 88 (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.parseFormalParameter (cyclomatic 84) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:2030— Parser.parseFormalParameter has cyclomatic complexity 84 (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.
BodyBuilderImpl.processLookupResult (cyclomatic 83) pkg/front_end/lib/src/kernel/body_builder.dart:9208— BodyBuilderImpl.processLookupResult has cyclomatic complexity 83 (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.
LibraryCompiler.visitStaticInvocation (cyclomatic 82) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7398— LibraryCompiler.visitStaticInvocation 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.
SourceClassBuilder.checkSupertypes (cyclomatic 82) pkg/front_end/lib/src/source/source_class_builder.dart:740— SourceClassBuilder.checkSupertypes 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.
_FfiUseSiteTransformer._visitStaticInvocation (cyclomatic 81) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:352— _FfiUseSiteTransformer._visitStaticInvocation has cyclomatic complexity 81 (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.
DartTypes._subtypeHelper (cyclomatic 81) pkg/compiler/lib/src/elements/types.dart:1949— DartTypes._subtypeHelper has cyclomatic complexity 81 (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.
StandardBounds.getStandardUpperBoundInternal (cyclomatic 81) pkg/kernel/lib/src/standard_bounds.dart:593— StandardBounds.getStandardUpperBoundInternal has cyclomatic complexity 81 (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.
StandardBounds.getStandardLowerBoundInternal (cyclomatic 80) pkg/kernel/lib/src/standard_bounds.dart:268— StandardBounds.getStandardLowerBoundInternal has cyclomatic complexity 80 (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.
V1Projection._toV1Expression (cyclomatic 78) pkg/analyzer/lib/src/dart/ast/ast.dart:57854— V1Projection._toV1Expression has cyclomatic complexity 78 (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.
ConstantEvaluator.visitBinaryExpression (cyclomatic 78) pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:114— ConstantEvaluator.visitBinaryExpression has cyclomatic complexity 78 (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.
RuntimeTypesNeedBuilderImpl.computeRuntimeTypesNeed (cyclomatic 78) pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart:1075— RuntimeTypesNeedBuilderImpl.computeRuntimeTypesNeed has cyclomatic complexity 78 (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.
ProgramCompiler.visitStaticInvocation (cyclomatic 78) pkg/dev_compiler/lib/src/kernel/compiler.dart:6709— ProgramCompiler.visitStaticInvocation has cyclomatic complexity 78 (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.
Type.generate (cyclomatic 77) pkg/vm_service/tool/dart/generate_dart_common.dart:571— Type.generate has cyclomatic complexity 77 (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.
_BigIntImpl._binaryGcd (cyclomatic 76) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2112— _BigIntImpl._binaryGcd has cyclomatic complexity 76 (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.parseMethod (cyclomatic 76) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5799— Parser.parseMethod has cyclomatic complexity 76 (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.
TypeUseGenerator.buildSelectorAccess (cyclomatic 76) pkg/front_end/lib/src/kernel/expression_generator.dart:4698— TypeUseGenerator.buildSelectorAccess has cyclomatic complexity 76 (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.
_Processor.calculate (cyclomatic 74) pkg/front_end/lib/src/util/outline_extractor.dart:309— _Processor.calculate 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.
VmServerConnection._delegateRequest (cyclomatic 74) pkg/vm_service_interface/lib/src/vm_service_interface.dart:1403— VmServerConnection._delegateRequest has cyclomatic complexity 74 (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.
ConstantEvaluator._handleInvocation (cyclomatic 73) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4297— ConstantEvaluator._handleInvocation has cyclomatic complexity 73 (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.
_MixinInferenceSolution._solveForEquality (cyclomatic 73) pkg/front_end/lib/src/kernel/hierarchy/mixin_inferrer.dart:270— _MixinInferenceSolution._solveForEquality has cyclomatic complexity 73 (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.
SourceLoader._checkSupertypeClassModifiers (cyclomatic 73) pkg/front_end/lib/src/source/source_loader.dart:2210— SourceLoader._checkSupertypeClassModifiers has cyclomatic complexity 73 (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.
ResolvedCorrectionProducer.inferUndefinedExpressionType (cyclomatic 70) pkg/analysis_server_plugin/lib/edit/dart/correction_producer.dart:520— ResolvedCorrectionProducer.inferUndefinedExpressionType 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.
ConstantEvaluator2.visitBinaryOperatorInvocation (cyclomatic 69) pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:436— ConstantEvaluator2.visitBinaryOperatorInvocation 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.
DartScopeBuilder2._filter (cyclomatic 69) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:605— DartScopeBuilder2._filter has cyclomatic complexity 69 (threshold 15). 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.
Intrinsifier.generateInstanceIntrinsic (cyclomatic 67) pkg/dart2wasm/lib/intrinsics.dart:761— Intrinsifier.generateInstanceIntrinsic has cyclomatic complexity 67 (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.
DartFileEditBuilderImpl._addLibraryImports (cyclomatic 67) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:2482— DartFileEditBuilderImpl._addLibraryImports 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.
_Tuple.sanitize (cyclomatic 67) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1503— _Tuple.sanitize 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.
ConstantsTransformer.visitPatternSwitchStatement (cyclomatic 65) pkg/front_end/lib/src/kernel/constant_evaluator.dart:750— ConstantsTransformer.visitPatternSwitchStatement has cyclomatic complexity 65 (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.
ClassMembersNodeBuilder.build (cyclomatic 65) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:617— ClassMembersNodeBuilder.build has cyclomatic complexity 65 (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.
_Collector.collect (cyclomatic 63) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:59— _Collector.collect has cyclomatic complexity 63 (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.
_Tuple.sanitize (cyclomatic 63) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:549— _Tuple.sanitize has cyclomatic complexity 63 (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.
CodegenImpactTransformer.transformCodegenImpact (cyclomatic 60) pkg/compiler/lib/src/js_backend/impact_transformer.dart:77— CodegenImpactTransformer.transformCodegenImpact has cyclomatic complexity 60 (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.parseTopLevelMemberImpl (cyclomatic 59) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4181— Parser.parseTopLevelMemberImpl 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.
LeastUpperBoundHelper._computeLeastUpperBound (cyclomatic 59) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:391— LeastUpperBoundHelper._computeLeastUpperBound has cyclomatic complexity 59 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DeclarationByElementLocator.visitNode (cyclomatic 57) pkg/analyzer/lib/src/dart/analysis/results.dart:67— DeclarationByElementLocator.visitNode 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.
UseResultVerifier._isUsed (cyclomatic 57) pkg/analyzer/lib/src/error/use_result_verifier.dart:214— UseResultVerifier._isUsed has cyclomatic complexity 57 (threshold 15). 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.
Parser._parsePrecedenceExpressionLoop (cyclomatic 56) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7203— Parser._parsePrecedenceExpressionLoop has cyclomatic complexity 56 (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.
KernelTarget._finishConstruction (cyclomatic 56) pkg/front_end/lib/src/kernel/kernel_target.dart:1542— KernelTarget._finishConstruction has cyclomatic complexity 56 (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.
TypeSystemImpl.canBeSubtypeOf (cyclomatic 55) pkg/analyzer/lib/src/dart/element/type_system.dart:140— TypeSystemImpl.canBeSubtypeOf has cyclomatic complexity 55 (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.
_SanitizedMember.computeMembers (cyclomatic 55) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1982— _SanitizedMember.computeMembers has cyclomatic complexity 55 (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.
OutlineBuilder.endFormalParameters (cyclomatic 55) pkg/front_end/lib/src/source/outline_builder.dart:3249— OutlineBuilder.endFormalParameters has cyclomatic complexity 55 (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.
KernelSsaGraphBuilder._doTryInlineMethod (cyclomatic 54) pkg/compiler/lib/src/ssa/builder.dart:7879— KernelSsaGraphBuilder._doTryInlineMethod has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
HttpDate._parseCookieDate (cyclomatic 53) sdk/lib/_http/http_date.dart:280— HttpDate._parseCookieDate has cyclomatic complexity 53 (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.
JFieldAnalysis.from (cyclomatic 53) pkg/compiler/lib/src/js_backend/field_analysis.dart:289— JFieldAnalysis.from has cyclomatic complexity 53 (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.
SummaryCollector.createSummary (cyclomatic 53) pkg/vm/lib/transformations/type_flow/summary_collector.dart:643— SummaryCollector.createSummary has cyclomatic complexity 53 (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.
FrontendCompiler.compile (cyclomatic 52) pkg/frontend_server/lib/frontend_server.dart:689— FrontendCompiler.compile has cyclomatic complexity 52 (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.
GreatestLowerBoundHelper.getGreatestLowerBound (cyclomatic 52) pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart:23— GreatestLowerBoundHelper.getGreatestLowerBound has cyclomatic complexity 52 (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.
InferenceVisitorBase._inferInvocation (cyclomatic 52) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:1734— InferenceVisitorBase._inferInvocation has cyclomatic complexity 52 (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.
SwitchInfo.SwitchInfo (cyclomatic 51) pkg/dart2wasm/lib/code_generator.dart:5298— SwitchInfo.SwitchInfo 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.
Evaluator._visitExpression (cyclomatic 51) pkg/_fe_analyzer_shared/lib/src/metadata/evaluate.dart:47— Evaluator._visitExpression has cyclomatic complexity 51 (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.
(anonymous) (cyclomatic 51) sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js:13— (anonymous) has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 7 of the 51 points are its own statements and the rest belongs to 26 function items inside it that branch (installMockDate::Date, nextEvent, bubbleDown, …). 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.
Uri.parse (cyclomatic 50) sdk/lib/core/uri.dart:841— Uri.parse 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.
ModifyParameters.apply (cyclomatic 50) pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart:81— ModifyParameters.apply 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.
Intrinsifier.generateMemberIntrinsic (cyclomatic 49) pkg/dart2wasm/lib/intrinsics.dart:3594— Intrinsifier.generateMemberIntrinsic 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.
Parser.parseExpressionStatementOrDeclarationAfterModifiers (cyclomatic 49) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9864— Parser.parseExpressionStatementOrDeclarationAfterModifiers 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.
DuplicateDefinitionVerifier.checkUnit (cyclomatic 49) pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart:115— DuplicateDefinitionVerifier.checkUnit 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.
InterceptorStubGenerator.generateGetInterceptorMethod (cyclomatic 49) pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart:50— InterceptorStubGenerator.generateGetInterceptorMethod has cyclomatic complexity 49 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
(anonymous) (cyclomatic 49) sdk/lib/_internal/js_runtime/lib/preambles/d8.js:13— (anonymous) has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 4 of the 49 points are its own statements and the rest belongs to 27 function items inside it that branch (installMockDate::Date, nextEvent, bubbleDown, …). 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.
AbstractScanner.bigSwitch (cyclomatic 48) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1093— AbstractScanner.bigSwitch has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AddNullCheck.compute (cyclomatic 47) pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart:78— AddNullCheck.compute has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
HValidator.visitBasicBlock (cyclomatic 47) pkg/compiler/lib/src/ssa/validate.dart:23— HValidator.visitBasicBlock 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.
InferenceVisitorBase.createPropertyGet (cyclomatic 47) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:5357— InferenceVisitorBase.createPropertyGet 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.
MiniJsParser.getToken (cyclomatic 47) pkg/js_ast/lib/src/builder.dart:619— MiniJsParser.getToken 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.
(anonymous) (cyclomatic 47) sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js:7— (anonymous) has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 2 of the 47 points are its own statements and the rest belongs to 27 function items inside it that branch (installMockDate::Date, nextEvent, bubbleDown, …). 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.
Class.test (cyclomatic 46) pkg/front_end/testcases/general/for_in.dart:295— Class.test has cyclomatic complexity 46 (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.
InScopeCompletionPass.visitVariableDeclaration (cyclomatic 46) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:3419— InScopeCompletionPass.visitVariableDeclaration 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.
ConvertToDeclaringParameter.compute (cyclomatic 46) pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart:41— ConvertToDeclaringParameter.compute 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.
ErrorVerifier._checkForAugmentationFormalParameters (cyclomatic 46) pkg/analyzer/lib/src/generated/error_verifier.dart:3274— ErrorVerifier._checkForAugmentationFormalParameters 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.
InvokeDynamicSpecializer.lookupSpecializer (cyclomatic 46) pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart:71— InvokeDynamicSpecializer.lookupSpecializer 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.
IncrementalCompiler._initializeExperimentalInvalidation (cyclomatic 46) pkg/front_end/lib/src/base/incremental_compiler.dart:1260— IncrementalCompiler._initializeExperimentalInvalidation 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.
BytecodeGenerator.getFunctionDeclaration (cyclomatic 45) pkg/dart2bytecode/lib/bytecode_generator.dart:615— BytecodeGenerator.getFunctionDeclaration has cyclomatic complexity 45 (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.
LinearScanRegisterAllocator.resolveDataFlow (cyclomatic 45) pkg/native_compiler/lib/back_end/register_allocator.dart:921— LinearScanRegisterAllocator.resolveDataFlow has cyclomatic complexity 45 (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.
ConstantPragmaAnnotationParser.parsePragma (cyclomatic 45) pkg/vm/lib/modular/transformations/pragma.dart:159— ConstantPragmaAnnotationParser.parsePragma has cyclomatic complexity 45 (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.parsePrimary (cyclomatic 45) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8094— Parser.parsePrimary has cyclomatic complexity 45 (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.
RelevanceComputer.computeRelevance (cyclomatic 45) pkg/analysis_server/lib/src/services/completion/dart/relevance_computer.dart:108— RelevanceComputer.computeRelevance has cyclomatic complexity 45 (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.
AddFieldFormalParameters._computeFromPieces (cyclomatic 45) pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart:87— AddFieldFormalParameters._computeFromPieces has cyclomatic complexity 45 (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.
MiniJsParser.getToken (cyclomatic 45) pkg/dev_compiler/lib/src/js_ast/builder.dart:701— MiniJsParser.getToken has cyclomatic complexity 45 (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.
SourceExtensionTypeDeclarationBuilder._checkRepresentationDependency (cyclomatic 45) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:524— SourceExtensionTypeDeclarationBuilder._checkRepresentationDependency has cyclomatic complexity 45 (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.
AbstractScanner.bigSwitch (cyclomatic 44) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:429— AbstractScanner.bigSwitch has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartLanguageServerBenchmark._listenToStdout (cyclomatic 44) pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart:347— DartLanguageServerBenchmark._listenToStdout has cyclomatic complexity 44 (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.
SourceTypeAliasBuilder._checkCyclicTypedefDependency (cyclomatic 44) pkg/front_end/lib/src/source/source_type_alias_builder.dart:158— SourceTypeAliasBuilder._checkCyclicTypedefDependency has cyclomatic complexity 44 (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.
HtmlDartInterfaceGenerator.GenerateInterface (cyclomatic 44) tools/dom/scripts/systemhtml.py:659— HtmlDartInterfaceGenerator.GenerateInterface has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartSnippetRequest._getContext (cyclomatic 43) pkg/analysis_server/lib/src/services/snippets/dart_snippet_request.dart:98— DartSnippetRequest._getContext 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.
ConstantVerifier._reportError (cyclomatic 43) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:714— ConstantVerifier._reportError has cyclomatic complexity 43 (threshold 15). 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.
ForwardingNode.finalize (cyclomatic 43) pkg/front_end/lib/src/kernel/forwarding_node.dart:71— ForwardingNode.finalize 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.
_Visitor.visitClassDeclaration (cyclomatic 43) pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:54— _Visitor.visitClassDeclaration 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.
FlutterConvertToStatefulWidget.compute (cyclomatic 42) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart:30— FlutterConvertToStatefulWidget.compute 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.
CompletionHandler._getServerDartItems (cyclomatic 41) pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart:390— CompletionHandler._getServerDartItems 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.
ReplaceWithVar.compute (cyclomatic 41) pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart:33— ReplaceWithVar.compute 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.
_ClassVerifier.verify (cyclomatic 41) pkg/analyzer/lib/src/error/inheritance_override.dart:309— _ClassVerifier.verify 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.
LanguageVersionOverrideVerifier._findLanguageVersionOverrideComment (cyclomatic 41) pkg/analyzer/lib/src/error/language_version_override_verifier.dart:37— LanguageVersionOverrideVerifier._findLanguageVersionOverrideComment has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
InstanceMemberInferrer._inferAccessorOrField (cyclomatic 41) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:88— InstanceMemberInferrer._inferAccessorOrField 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.
_IRInterpreter.run (cyclomatic 41) pkg/analyzer/lib/src/wolf/ir/interpreter.dart:261— _IRInterpreter.run 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.
DynamicCallSiteTypeInformation.handleIntrinsifiedSelector (cyclomatic 41) pkg/compiler/lib/src/inferrer/type_graph_nodes.dart:1321— DynamicCallSiteTypeInformation.handleIntrinsifiedSelector 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.
ProgramBuilder._buildClass (cyclomatic 41) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:657— ProgramBuilder._buildClass 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.
AnalyzeCommand.run (cyclomatic 41) pkg/dartdev/lib/src/commands/analyze.dart:172— AnalyzeCommand.run 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.
_Visitor.visitClassDeclaration (cyclomatic 41) pkg/linter/lib/src/rules/use_enums.dart:139— _Visitor.visitClassDeclaration 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.
InstanceViewElement._createMembers (cyclomatic 41) pkg/observatory/lib/src/elements/instance_view.dart:220— InstanceViewElement._createMembers 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.
MixinFullResolution.transformClass (cyclomatic 40) pkg/vm/lib/modular/transformations/mixin_full_resolution.dart:78— MixinFullResolution.transformClass 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.
TopMergeHelper.topMerge (cyclomatic 40) pkg/analyzer/lib/src/dart/element/top_merge.dart:22— TopMergeHelper.topMerge has cyclomatic complexity 40 (threshold 15). 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.
NamedTypeResolver.resolveConstructorTypeReference (cyclomatic 40) pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart:133— NamedTypeResolver.resolveConstructorTypeReference 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.
ResolutionEnqueuerListener._processClass (cyclomatic 40) pkg/compiler/lib/src/js_backend/resolution_listener.dart:387— ResolutionEnqueuerListener._processClass has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ClosureDataBuilder._updateScopeBasedOnRtiNeed (cyclomatic 40) pkg/compiler/lib/src/js_model/closure.dart:256— ClosureDataBuilder._updateScopeBasedOnRtiNeed 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.
DillExtensionTypeDeclarationBuilder.DillExtensionTypeDeclarationBuilder (cyclomatic 40) pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:38— DillExtensionTypeDeclarationBuilder.DillExtensionTypeDeclarationBuilder 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.
Instance.toJson (cyclomatic 40) pkg/vm_service/lib/src/vm_service.dart:5751— Instance.toJson has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
(anonymous) (cyclomatic 40) REDACTED:792— (anonymous) has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 5 of the 40 points are its own statements and the rest belongs to 28 function items inside it that branch (addScriptsToQueue, processAfterLoadOrErrorEvent, getScriptUrl, …). 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.
DispatchTable.build (cyclomatic 39) pkg/dart2wasm/lib/dispatch_table.dart:505— DispatchTable.build 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.
Sort._dualPivotQuicksort (cyclomatic 39) sdk/lib/internal/sort.dart:85— Sort._dualPivotQuicksort 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.
ComplexTypeInfo.computeRecordType (cyclomatic 39) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:756— ComplexTypeInfo.computeRecordType has cyclomatic complexity 39 (threshold 15). 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.
RenameRefactoring.getElementToRename (cyclomatic 39) pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart:574— RenameRefactoring.getElementToRename has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AstWriter._computeProperties (cyclomatic 39) pkg/analysis_server/lib/src/status/utilities/ast_writer.dart:30— AstWriter._computeProperties 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.
TypePropertyResolver.resolve (cyclomatic 39) pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart:56— TypePropertyResolver.resolve 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.
NativeEmitter.prepareNativeClasses (cyclomatic 39) pkg/compiler/lib/src/js_emitter/native_emitter.dart:41— NativeEmitter.prepareNativeClasses 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.
CompileWasmCommand.run (cyclomatic 39) pkg/dartdev/lib/src/commands/compile.dart:942— CompileWasmCommand.run has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DillLibraryBuilder.ensureLoaded (cyclomatic 39) pkg/front_end/lib/src/dill/dill_library_builder.dart:203— DillLibraryBuilder.ensureLoaded 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.
ExtensionTypeMembersNodeBuilder.build (cyclomatic 39) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:35— ExtensionTypeMembersNodeBuilder.build 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.
AsyncStateVisitor.visitBinaryExpression (cyclomatic 39) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:186— AsyncStateVisitor.visitBinaryExpression 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.
_WebSocketProtocolTransformer.add (cyclomatic 38) sdk/lib/_http/websocket_impl.dart:295— _WebSocketProtocolTransformer.add 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.
Simplification.visitBinaryIntOp (cyclomatic 38) pkg/cfg/lib/passes/simplification.dart:364— Simplification.visitBinaryIntOp 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.
Parser.parseStatementX (cyclomatic 38) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6720— Parser.parseStatementX 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.
ConvertToSwitchExpression._getSupportedSwitchType (cyclomatic 38) pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:386— ConvertToSwitchExpression._getSupportedSwitchType 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.
NullSafetyDeadCodeVerifier.flowEnd (cyclomatic 38) pkg/analyzer/lib/src/error/dead_code_verifier.dart:214— NullSafetyDeadCodeVerifier.flowEnd 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.
ElementUsageDetector.checkUsage (cyclomatic 38) pkg/analyzer/lib/src/error/element_usage_detector.dart:73— ElementUsageDetector.checkUsage 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.
AstBinaryFlags.encode (cyclomatic 38) pkg/analyzer/lib/src/summary2/ast_binary_flags.dart:154— AstBinaryFlags.encode has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
FuzzyMatcher.computeScore (cyclomatic 38) pkg/analyzer/lib/src/utilities/fuzzy_matcher.dart:161— FuzzyMatcher.computeScore 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.
SsaCodeGenerator.visitLoopInfo (cyclomatic 38) pkg/compiler/lib/src/ssa/codegen.dart:1046— SsaCodeGenerator.visitLoopInfo 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.
RunCommand._runLocal (cyclomatic 38) pkg/dartdev/lib/src/commands/run.dart:540— RunCommand._runLocal 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.
PatternConverter.dispatchPattern (cyclomatic 38) pkg/front_end/lib/src/kernel/exhaustiveness.dart:616— PatternConverter.dispatchPattern has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
JsInteropChecks.visitProcedure (cyclomatic 37) pkg/_js_interop_checks/lib/js_interop_checks.dart:312— JsInteropChecks.visitProcedure 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.
SessionLogAnalyzer.processFile (cyclomatic 37) pkg/analysis_server/.agents/skills/improve-performance-with-session-log/scripts/analyze_session_log.dart:217— SessionLogAnalyzer.processFile 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.
TypeEnvironment.computeTypeShapeCheckSufficiency (cyclomatic 37) pkg/kernel/lib/type_environment.dart:306— TypeEnvironment.computeTypeShapeCheckSufficiency 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.
Configuration.parse (cyclomatic 37) pkg/smith/lib/configuration.dart:107— Configuration.parse has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartUnitHoverComputer.compute (cyclomatic 37) pkg/analysis_server/lib/src/computer/computer_hover.dart:31— DartUnitHoverComputer.compute has cyclomatic complexity 37 (threshold 15). 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.
InScopeCompletionPass.visitArgumentList (cyclomatic 37) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:293— InScopeCompletionPass.visitArgumentList 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.
ImportLibrary._importLibraryForElement (cyclomatic 37) pkg/analysis_server/lib/src/services/correction/dart/import_library.dart:293— ImportLibrary._importLibraryForElement 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.
KernelSsaGraphBuilder._pushDynamicInvocation (cyclomatic 37) pkg/compiler/lib/src/ssa/builder.dart:6830— KernelSsaGraphBuilder._pushDynamicInvocation has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartDebugAdapter.variablesRequest (cyclomatic 37) pkg/dap_adapters/lib/src/adapters/dart.dart:2264— DartDebugAdapter.variablesRequest 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.
InferenceVisitorBase._computeAssignabilityKind (cyclomatic 37) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:859— InferenceVisitorBase._computeAssignabilityKind has cyclomatic complexity 37 (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.
DartDocTest.compileAndRun (cyclomatic 36) pkg/front_end/tool/dart_doctest_impl.dart:123— DartDocTest.compileAndRun 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.
SharedInteropTransformer._createIsACheck (cyclomatic 36) pkg/_js_interop_checks/lib/src/transformations/shared_interop_transformer.dart:713— SharedInteropTransformer._createIsACheck 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.
KeywordHelper.addExpressionKeywords (cyclomatic 36) pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart:312— KeywordHelper.addExpressionKeywords has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ConvertToSuperParameters.compute (cyclomatic 36) pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart:36— ConvertToSuperParameters.compute 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.
MethodInvocationResolver.resolveUnqualified (cyclomatic 36) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:380— MethodInvocationResolver.resolveUnqualified 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.
PatternConverter.dispatchPattern (cyclomatic 36) pkg/analyzer/lib/src/generated/exhaustiveness.dart:540— PatternConverter.dispatchPattern 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.
CompilerOptions.equivalent (cyclomatic 36) pkg/front_end/lib/src/api_prototype/compiler_options.dart:257— CompilerOptions.equivalent has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
IncrementalCompiler._computeReusedLibraries (cyclomatic 36) pkg/front_end/lib/src/base/incremental_compiler.dart:2660— IncrementalCompiler._computeReusedLibraries 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.
InferenceVisitorImpl.visitInstantiation (cyclomatic 36) pkg/front_end/lib/src/type_inference/inference_visitor.dart:671— InferenceVisitorImpl.visitInstantiation 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
SummaryCollector._visitCondition (cyclomatic 36) pkg/vm/lib/transformations/type_flow/summary_collector.dart:1619— SummaryCollector._visitCondition 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.
_ChunkedJsonParser.parse (cyclomatic 35) sdk/lib/_internal/wasm/common/convert_patch.dart:897— _ChunkedJsonParser.parse 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.
_Uri.resolveUri (cyclomatic 35) sdk/lib/core/uri.dart:3220— _Uri.resolveUri 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.
FfiTransformer.convertNativeTypeToDartType (cyclomatic 35) pkg/vm/lib/modular/transformations/ffi/common.dart:1088— FfiTransformer.convertNativeTypeToDartType has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Parser.parseTopLevelDeclarationImpl (cyclomatic 35) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:554— Parser.parseTopLevelDeclarationImpl has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LibrariesSpecification.parse (cyclomatic 35) pkg/_fe_analyzer_shared/lib/src/util/libraries_specification.dart:200— LibrariesSpecification.parse 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.
StatementCompletionProcessor.compute (cyclomatic 35) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:169— StatementCompletionProcessor.compute 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.
RemoveUnusedField.compute (cyclomatic 35) pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart:120— RemoveUnusedField.compute 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.
_SignatureUpdater.updateDeclaration (cyclomatic 35) pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart:782— _SignatureUpdater.updateDeclaration 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.
_ClassVerifier._verifyMustBeOverridden (cyclomatic 35) pkg/analyzer/lib/src/error/inheritance_override.dart:1050— _ClassVerifier._verifyMustBeOverridden 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.
InterceptorStubGenerator._fastPathForOneShotInterceptor (cyclomatic 35) pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart:317— InterceptorStubGenerator._fastPathForOneShotInterceptor 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.
ProgramCompiler._defineClass (cyclomatic 35) pkg/dev_compiler/lib/src/kernel/compiler.dart:1462— ProgramCompiler._defineClass 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.
NodeCreator.generateComponent (cyclomatic 35) pkg/kernel/lib/src/node_creator.dart:388— NodeCreator.generateComponent 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. This is NOT this file's highest cyclomatic complexity: NodeCreator._createExpressionFromKind (cyclomatic 70) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
StandardBounds._getFunctionStandardUpperBound (cyclomatic 35) pkg/kernel/lib/src/standard_bounds.dart:1332— StandardBounds._getFunctionStandardUpperBound 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. This is NOT this file's highest cyclomatic complexity: StandardBounds.morebottom (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
(anonymous) (cyclomatic 35) REDACTED:1344— (anonymous) has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 2 of the 35 points are its own statements and the rest belongs to 53 function items inside it that branch (defineLibrary, _runMain::runMainAndHandleErrors, hotReloadEnd, …). 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.
Application._printOutput (cyclomatic 34) pkg/front_end/tool/parser_direct_ast/console_helper.dart:108— Application._printOutput 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.
_Cookie._parseSetCookieValue (cyclomatic 34) sdk/lib/_http/http_headers.dart:1092— _Cookie._parseSetCookieValue 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.
_Future._propagateToListeners (cyclomatic 34) sdk/lib/async/future_impl.dart:848— _Future._propagateToListeners 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.
Arm64CodeGenerator.visitBinaryIntOp (cyclomatic 34) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2536— Arm64CodeGenerator.visitBinaryIntOp 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.
Parser.parseTopLevelKeywordDeclaration (cyclomatic 34) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:682— Parser.parseTopLevelKeywordDeclaration 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.
ColorComputer._getDartUiColor (cyclomatic 34) pkg/analysis_server/lib/src/computer/computer_color.dart:269— ColorComputer._getDartUiColor 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.
ExtractLocalRefactoringImpl._checkSelection (cyclomatic 34) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart:269— ExtractLocalRefactoringImpl._checkSelection 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.
InheritanceManager3._getInterfaceExtensionType (cyclomatic 34) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:746— InheritanceManager3._getInterfaceExtensionType 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.
MethodInvocationResolver._resolveInstanceInvocation (cyclomatic 34) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:975— MethodInvocationResolver._resolveInstanceInvocation 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.
ProgramBuilder._addJsInteropStubs (cyclomatic 34) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:455— ProgramBuilder._addJsInteropStubs 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.
FragmentEmitter.emitInstallTearOffs (cyclomatic 34) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:1422— FragmentEmitter.emitInstallTearOffs 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.
ProtocolConverter.convertVmInstanceToVariablesList (cyclomatic 34) pkg/dap_adapters/lib/src/protocol_converter.dart:128— ProtocolConverter.convertVmInstanceToVariablesList 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.
DartScopeBuilder2._looksLikeLateLoweredField (cyclomatic 34) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:889— DartScopeBuilder2._looksLikeLateLoweredField has cyclomatic complexity 34 (threshold 15). 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.
OutlineBuilder.endPrimaryConstructor (cyclomatic 34) pkg/front_end/lib/src/source/outline_builder.dart:1794— OutlineBuilder.endPrimaryConstructor 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.
AsyncStateVisitor._visitIfLike (cyclomatic 34) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:812— AsyncStateVisitor._visitIfLike 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.
InstanceRefElement._createValue (cyclomatic 34) pkg/observatory/lib/src/elements/instance_ref.dart:278— InstanceRefElement._createValue 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. This is NOT this file's highest cyclomatic complexity: InstanceRefElement._createLink (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
bin_to_assembly.Main (cyclomatic 34) runtime/tools/bin_to_assembly.py:15— bin_to_assembly.Main 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.
_ChunkedJsonParser.parse (cyclomatic 33) sdk/lib/_internal/vm/lib/convert_patch.dart:819— _ChunkedJsonParser.parse 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.
_Utf8Decoder._convertChunkInternal (cyclomatic 33) sdk/lib/_internal/wasm/common/convert_patch.dart:2398— _Utf8Decoder._convertChunkInternal 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.
ConvertToInitializingFormal._computeChange (cyclomatic 33) pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart:186— ConvertToInitializingFormal._computeChange 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.
FlutterConvertToStatelessWidget.compute (cyclomatic 33) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:31— FlutterConvertToStatelessWidget.compute 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.
KernelInfoCollector.visitFunction (cyclomatic 33) pkg/compiler/lib/src/dump_info.dart:1010— KernelInfoCollector.visitFunction has cyclomatic complexity 33 (threshold 15). 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.
ResolutionWorldBuilder.registerStaticUse (cyclomatic 33) pkg/compiler/lib/src/universe/resolution_world_builder.dart:577— ResolutionWorldBuilder.registerStaticUse has cyclomatic complexity 33 (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.
ConstantEvaluator.handleConstructorInvocation (cyclomatic 33) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3732— ConstantEvaluator.handleConstructorInvocation 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.
InferenceVisitorBase.inferMethodInvocation (cyclomatic 33) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3621— InferenceVisitorBase.inferMethodInvocation has cyclomatic complexity 33 (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.
_TextFormatter.add (cyclomatic 32) pkg/analyzer_utilities/lib/text_formatter.dart:58— _TextFormatter.add 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.
Translator.translateStorageType (cyclomatic 32) pkg/dart2wasm/lib/translator.dart:1050— Translator.translateStorageType 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.
DartdevRunner.runCommand (cyclomatic 32) pkg/dartdev/lib/dartdev.dart:199— DartdevRunner.runCommand 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.
NoSuchMethodError.toString (cyclomatic 32) sdk/lib/_internal/vm/lib/errors_patch.dart:233— NoSuchMethodError.toString 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.
_ChunkedJsonParser.parse (cyclomatic 32) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:772— _ChunkedJsonParser.parse 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.
Parser.parseFields (cyclomatic 32) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4438— Parser.parseFields 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.
DeclarationHelper._addStaticMembers (cyclomatic 32) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1633— DeclarationHelper._addStaticMembers 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.
ImportOrganizer._organizeDirectives (cyclomatic 32) pkg/analysis_server/lib/src/services/correction/organize_imports.dart:85— ImportOrganizer._organizeDirectives 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.
ExpressionImpl.constantContext (cyclomatic 32) pkg/analyzer/lib/src/dart/ast/ast.dart:18135— ExpressionImpl.constantContext 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. This shape REPEATS in the file: one other method here (ExpressionImpl.constantContext2) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ExpressionImpl.constantContext2 (cyclomatic 32) pkg/analyzer/lib/src/dart/ast/ast.dart:18203— ExpressionImpl.constantContext2 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. This shape REPEATS in the file: one other method here (ExpressionImpl.constantContext) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ConstantEvaluationEngine.computeDependencies (cyclomatic 32) pkg/analyzer/lib/src/dart/constant/evaluation.dart:234— ConstantEvaluationEngine.computeDependencies 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.
_TodoFinder._check (cyclomatic 32) pkg/analyzer/lib/src/error/todo_finder.dart:224— _TodoFinder._check 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.
FfiVerifier._checkFfiNativeFunction (cyclomatic 32) pkg/analyzer/lib/src/generated/ffi_verifier.dart:839— FfiVerifier._checkFfiNativeFunction 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.
Driver._analyzeAll (cyclomatic 32) pkg/analyzer_cli/lib/src/driver.dart:152— Driver._analyzeAll 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.
InferrerEngine._runOverAllElements (cyclomatic 32) pkg/compiler/lib/src/inferrer/engine.dart:358— InferrerEngine._runOverAllElements 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.
SsaSimplifyInterceptors.visitInterceptor (cyclomatic 32) pkg/compiler/lib/src/ssa/interceptor_simplifier.dart:235— SsaSimplifyInterceptors.visitInterceptor 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.
InferenceVisitorImpl.visitObjectPattern (cyclomatic 32) pkg/front_end/lib/src/type_inference/inference_visitor.dart:12652— InferenceVisitorImpl.visitObjectPattern 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
BestEffortParserAstVisitor.accept (cyclomatic 32) pkg/front_end/lib/src/util/parser_ast.dart:124— BestEffortParserAstVisitor.accept has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Visitor._check (cyclomatic 32) pkg/linter/lib/src/rules/prefer_is_empty.dart:66— _Visitor._check 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.
Instance._update (cyclomatic 32) pkg/observatory/lib/src/service/object.dart:3023— Instance._update has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: ServiceObject._fromMap (cyclomatic 50) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ClassIdNumbering._number (cyclomatic 31) pkg/dart2wasm/lib/class_info.dart:819— ClassIdNumbering._number 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.
ParserCreatorListener.endMethod (cyclomatic 31) pkg/front_end/tool/parser_ast_helper_creator.dart:259— ParserCreatorListener.endMethod 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.
Scrape._processPath (cyclomatic 31) pkg/scrape/lib/scrape.dart:233— Scrape._processPath 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.
_BigIntImpl.modPow (cyclomatic 31) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1939— _BigIntImpl.modPow 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.
Evaluator._visitElements (cyclomatic 31) pkg/_fe_analyzer_shared/lib/src/metadata/evaluate.dart:442— Evaluator._visitElements 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. This is NOT this file's highest cyclomatic complexity: Evaluator._isNull (cyclomatic 34) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
TypeConstraintGenerator.performSubtypeConstraintGenerationInternal (cyclomatic 31) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:2173— TypeConstraintGenerator.performSubtypeConstraintGenerationInternal has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ColorComputer.getExpressionColorObject (cyclomatic 31) pkg/analysis_server/lib/src/computer/computer_color.dart:115— ColorComputer.getExpressionColorObject 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.
DeclarationHelper._addLocalDeclarations (cyclomatic 31) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1309— DeclarationHelper._addLocalDeclarations 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.
InScopeCompletionPass.visitExpressionStatement (cyclomatic 31) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1168— InScopeCompletionPass.visitExpressionStatement 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.
ConvertToFunctionDeclaration.compute (cyclomatic 31) pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart:30— ConvertToFunctionDeclaration.compute 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.
PropertyElementResolver.resolveCascadeIndex (cyclomatic 31) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:48— PropertyElementResolver.resolveCascadeIndex 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.
ErrorVerifier._checkUseOfDefaultValuesInParameters (cyclomatic 31) pkg/analyzer/lib/src/generated/error_verifier.dart:8632— ErrorVerifier._checkUseOfDefaultValuesInParameters 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.
NativeBehavior.processSpecString (cyclomatic 31) pkg/compiler/lib/src/native/behavior.dart:221— NativeBehavior.processSpecString 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.
KernelSsaGraphBuilder.build (cyclomatic 31) pkg/compiler/lib/src/ssa/builder.dart:461— KernelSsaGraphBuilder.build 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.
SsaAssignmentChaining.tryChainAssignment (cyclomatic 31) pkg/compiler/lib/src/ssa/codegen_helpers.dart:687— SsaAssignmentChaining.tryChainAssignment 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.
ClassHierarchyImpl.commonSubclasses (cyclomatic 31) pkg/compiler/lib/src/universe/class_hierarchy.dart:449— ClassHierarchyImpl.commonSubclasses 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.
StaticUse.shortText (cyclomatic 31) pkg/compiler/lib/src/universe/use.dart:319— StaticUse.shortText 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.
ProgramCompiler._emitClassSignature (cyclomatic 31) pkg/dev_compiler/lib/src/kernel/compiler.dart:1816— ProgramCompiler._emitClassSignature 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.
LibraryCompiler._emitClassSignature (cyclomatic 31) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2113— LibraryCompiler._emitClassSignature 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.
Modifiers.from (cyclomatic 31) pkg/front_end/lib/src/base/modifiers.dart:97— Modifiers.from has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_ConstructorDeclarationMixin._finalizeSuperInitializingFormals (cyclomatic 31) pkg/front_end/lib/src/fragment/constructor/declaration.dart:299— _ConstructorDeclarationMixin._finalizeSuperInitializingFormals 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.
CfeTypeOperations.getFieldTypes (cyclomatic 31) pkg/front_end/lib/src/kernel/exhaustiveness.dart:126— CfeTypeOperations.getFieldTypes 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.
SourceClassBuilder.checkOverride (cyclomatic 31) pkg/front_end/lib/src/source/source_class_builder.dart:1493— SourceClassBuilder.checkOverride 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.
InferenceVisitorBase.inferLocalFunction (cyclomatic 31) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2225— InferenceVisitorBase.inferLocalFunction 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.
Event.toJson (cyclomatic 31) pkg/vm_service/lib/src/vm_service.dart:4168— Event.toJson has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Instructions.printTo (cyclomatic 31) pkg/wasm_builder/lib/src/ir/instructions.dart:129— Instructions.printTo 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.
_HttpClientConnection.send (cyclomatic 30) sdk/lib/_http/http_impl.dart:2274— _HttpClientConnection.send 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. This is NOT this file's highest cyclomatic complexity: _HttpResponse._findReasonPhrase (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DeeplyImmutableValidator._validateDeeplyImmutable (cyclomatic 30) pkg/vm/lib/modular/transformations/deeply_immutable.dart:129— DeeplyImmutableValidator._validateDeeplyImmutable 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.
Evaluator._visitElement (cyclomatic 30) pkg/_fe_analyzer_shared/lib/src/metadata/evaluate.dart:551— Evaluator._visitElement 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. This is NOT this file's highest cyclomatic complexity: Evaluator._isNull (cyclomatic 34) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
AbstractScanner._spacesAtStartOfLogicalLineOf (cyclomatic 30) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:405— AbstractScanner._spacesAtStartOfLogicalLineOf 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.
_EnumDescription._validateFields (cyclomatic 30) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:653— _EnumDescription._validateFields 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.
ExtractMethodRefactoringImpl.buildChange (cyclomatic 30) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:191— ExtractMethodRefactoringImpl.buildChange 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.
AstRewriter.parsedExpression (cyclomatic 30) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:291— AstRewriter.parsedExpression 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.
MemberDuplicateDefinitionVerifier._checkClassMembers (cyclomatic 30) pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:48— MemberDuplicateDefinitionVerifier._checkClassMembers 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.
RuntimeTypesSubstitutionsMixin._computeChecks (cyclomatic 30) pkg/compiler/lib/src/js_backend/runtime_types.dart:120— RuntimeTypesSubstitutionsMixin._computeChecks 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.
RuntimeTypesImpl.computeRequiredChecks (cyclomatic 30) pkg/compiler/lib/src/js_backend/runtime_types.dart:534— RuntimeTypesImpl.computeRequiredChecks has cyclomatic complexity 30 (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.
SsaConditionMerger.visitBasicBlock (cyclomatic 30) pkg/compiler/lib/src/ssa/codegen_helpers.dart:1303— SsaConditionMerger.visitBasicBlock 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.
BuildCliSubcommand.doBuild (cyclomatic 30) pkg/dartdev/lib/src/commands/build.dart:325— BuildCliSubcommand.doBuild 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.
NamedTypeBuilderImpl.findRawTypesWithInboundReferences (cyclomatic 30) pkg/front_end/lib/src/builder/named_type_builder.dart:1169— NamedTypeBuilderImpl.findRawTypesWithInboundReferences 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. This is NOT this file's highest cyclomatic complexity: NamedTypeBuilderImpl._checkDeferred (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DelayedDefaultValueCloner.cloneDefaultValues (cyclomatic 30) pkg/front_end/lib/src/kernel/kernel_helper.dart:116— DelayedDefaultValueCloner.cloneDefaultValues 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.
InferenceVisitorImpl.visitSpreadElement (cyclomatic 30) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4554— InferenceVisitorImpl.visitSpreadElement 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
InferenceVisitorImpl._computeIndexGet (cyclomatic 30) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8041— InferenceVisitorImpl._computeIndexGet 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
InferenceVisitorBase.inferPropertySet (cyclomatic 30) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:4595— InferenceVisitorBase.inferPropertySet 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.
ParserASTListener.seen (cyclomatic 30) pkg/front_end/lib/src/util/parser_ast.dart:1755— ParserASTListener.seen has cyclomatic complexity 30 (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.
_Transform.transformCall (cyclomatic 30) pkg/vm/lib/transformations/type_flow/signature_shaking.dart:608— _Transform.transformCall 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.
FunctionDeclaration.toString (cyclomatic 29) pkg/dart2bytecode/lib/declarations.dart:709— FunctionDeclaration.toString has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_KeyboardEventHandler._firesKeyPressEvent (cyclomatic 29) tools/dom/src/KeyboardEventStream.dart:207— _KeyboardEventHandler._firesKeyPressEvent has cyclomatic complexity 29 (threshold 15). 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. This is NOT this file's highest cyclomatic complexity: _KeyboardEventHandler._findCharCodeKeyDown (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
IrToText._printInputs (cyclomatic 29) pkg/cfg/lib/ir/ir_to_text.dart:112— IrToText._printInputs has cyclomatic complexity 29 (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.
ModifierContext.parseFormalParameterModifiers (cyclomatic 29) pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart:205— ModifierContext.parseFormalParameterModifiers 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.
Parser.parsePrimaryConstructorOpt (cyclomatic 29) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3782— Parser.parsePrimaryConstructorOpt 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.
FeaturesDataInterpreter.isAsExpected (cyclomatic 29) pkg/_fe_analyzer_shared/lib/src/testing/features.dart:252— FeaturesDataInterpreter.isAsExpected 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.
AddMissingRequiredArgument.compute (cyclomatic 29) pkg/analysis_server/lib/src/services/correction/dart/add_missing_required_argument.dart:48— AddMissingRequiredArgument.compute 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.
RemoveAsync.compute (cyclomatic 29) pkg/analysis_server/lib/src/services/correction/dart/remove_async.dart:38— RemoveAsync.compute 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.
_ParsedLinterData._parseLocalRules (cyclomatic 29) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1219— _ParsedLinterData._parseLocalRules has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
BaseOrFinalTypeVerifier._reportRestrictionError (cyclomatic 29) pkg/analyzer/lib/src/error/base_or_final_type_verifier.dart:175— BaseOrFinalTypeVerifier._reportRestrictionError 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.
ReturnTypeVerifier._checkReturnExpression (cyclomatic 29) pkg/analyzer/lib/src/error/return_type_verifier.dart:125— ReturnTypeVerifier._checkReturnExpression 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.
_TodoFinder.moveNext (cyclomatic 29) pkg/analyzer/lib/src/error/todo_finder.dart:163— _TodoFinder.moveNext 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.
OnlineJavaScriptTracer._handleNotifySteps (cyclomatic 29) pkg/compiler/lib/src/io/position_information.dart:1644— OnlineJavaScriptTracer._handleNotifySteps 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.
FormattingDiagnosticHandler.report (cyclomatic 29) pkg/compiler/lib/src/source_file_provider.dart:246— FormattingDiagnosticHandler.report 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.
DartDebugAdapter.evaluateRequest (cyclomatic 29) pkg/dap_adapters/lib/src/adapters/dart.dart:1050— DartDebugAdapter.evaluateRequest 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.
IncrementalCompiler._computeExpressionCompilationScopeData (cyclomatic 29) pkg/front_end/lib/src/base/incremental_compiler.dart:2476— IncrementalCompiler._computeExpressionCompilationScopeData 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.
ConstantEvaluator.visitStaticInvocation (cyclomatic 29) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5181— ConstantEvaluator.visitStaticInvocation 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.
BuilderFactory._createDeclarationFromFragment (cyclomatic 29) pkg/front_end/lib/src/source/builder_factory.dart:519— BuilderFactory._createDeclarationFromFragment has cyclomatic complexity 29 (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.
InferenceVisitorImpl._computeBinaryExpression (cyclomatic 29) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7651— InferenceVisitorImpl._computeBinaryExpression has cyclomatic complexity 29 (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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ResidentFrontendServer._generateCompilerOptions (cyclomatic 29) pkg/frontend_server/lib/src/resident_frontend_server.dart:732— ResidentFrontendServer._generateCompilerOptions has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ServiceEvent._update (cyclomatic 29) pkg/observatory/lib/src/service/object.dart:2342— ServiceEvent._update has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: ServiceObject._fromMap (cyclomatic 50) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
minimize.minimize (cyclomatic 29) runtime/tools/dartfuzz/minimize.py:198— minimize.minimize 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.
Dart2JSBackend.EmitAttribute (cyclomatic 29) tools/dom/scripts/systemhtml.py:1509— Dart2JSBackend.EmitAttribute 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.
LogPlayer.play (cyclomatic 28) pkg/analysis_server/tool/log_player/log_player.dart:63— LogPlayer.play 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.
_TypeUniverse.isSubtype (cyclomatic 28) sdk/lib/_internal/wasm/common/type.dart:1351— _TypeUniverse.isSubtype 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.
StackChecker.checkStackStateForAssert (cyclomatic 28) pkg/_fe_analyzer_shared/lib/src/util/stack_checker.dart:92— StackChecker.checkStackStateForAssert 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.
RenameHandler.handle (cyclomatic 28) pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:120— RenameHandler.handle 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.
AddDiagnosticPropertyReference.compute (cyclomatic 28) pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart:37— AddDiagnosticPropertyReference.compute has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_AddDigitSeparators.compute (cyclomatic 28) pkg/analysis_server/lib/src/services/correction/dart/add_digit_separators.dart:67— _AddDigitSeparators.compute 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.
PubspecFixGenerator._addMissingDependency (cyclomatic 28) pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart:147— PubspecFixGenerator._addMissingDependency 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.
ConstantVerifier._validateSwitchExhaustiveness (cyclomatic 28) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1017— ConstantVerifier._validateSwitchExhaustiveness 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.
BestPracticesVerifier._getSubExpressionsMarkedDoNotStore (cyclomatic 28) pkg/analyzer/lib/src/error/best_practices_verifier.dart:1651— BestPracticesVerifier._getSubExpressionsMarkedDoNotStore has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_InvalidAccessVerifier._checkForOtherInvalidAccess (cyclomatic 28) pkg/analyzer/lib/src/error/best_practices_verifier.dart:2065— _InvalidAccessVerifier._checkForOtherInvalidAccess 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.
_Validator.run (cyclomatic 28) pkg/analyzer/lib/src/wolf/ir/validator.dart:198— _Validator.run 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.
LibraryCompiler._defineClass (cyclomatic 28) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1792— LibraryCompiler._defineClass 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.
DillLibraryBuilder.finalizeExports (cyclomatic 28) pkg/front_end/lib/src/dill/dill_library_builder.dart:460— DillLibraryBuilder.finalizeExports 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.
_PropertyPreBuilder.absorbFragment (cyclomatic 28) pkg/front_end/lib/src/source/builder_factory.dart:2179— _PropertyPreBuilder.absorbFragment 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.
SourceTypeAliasBuilder.buildTypedefTearOffs (cyclomatic 28) pkg/front_end/lib/src/source/source_type_alias_builder.dart:462— SourceTypeAliasBuilder.buildTypedefTearOffs 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.
InferenceVisitorImpl._computeUnaryExpression (cyclomatic 28) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7864— InferenceVisitorImpl._computeUnaryExpression 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
InferenceVisitorImpl.visitRecordLiteral (cyclomatic 28) pkg/front_end/lib/src/type_inference/inference_visitor.dart:11054— InferenceVisitorImpl.visitRecordLiteral 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_ObjectAccessDescriptor._findNonExtensionTargetInternal (cyclomatic 28) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:6343— _ObjectAccessDescriptor._findNonExtensionTargetInternal 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.
_Visitor.getInvalidJsInteropTypeTest (cyclomatic 28) pkg/linter/lib/src/rules/invalid_runtime_check_with_js_interop_types.dart:278— _Visitor.getInvalidJsInteropTypeTest 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.
ObservatoryDebugger.onEvent (cyclomatic 28) pkg/observatory/lib/src/elements/debugger.dart:1740— ObservatoryDebugger.onEvent 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.
_KernelFromParsedType.visitNamedType (cyclomatic 28) pkg/kernel/lib/testing/type_parser_environment.dart:358— _KernelFromParsedType.visitNamedType 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.
gn.ToGnArgs (cyclomatic 28) tools/gn.py:190— gn.ToGnArgs has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
gn.ProcessOptions (cyclomatic 28) tools/gn.py:329— gn.ProcessOptions 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.
SessionLogAnalyzer.printReport (cyclomatic 27) pkg/analysis_server/.agents/skills/improve-performance-with-session-log/scripts/analyze_session_log.dart:116— SessionLogAnalyzer.printReport 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.
DevToolsServer._serveDevToolsWithArgs (cyclomatic 27) pkg/dart_runtime_service_dds/lib/devtools_server.dart:516— DevToolsServer._serveDevToolsWithArgs has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Configuration.optionsEqual (cyclomatic 27) pkg/smith/lib/configuration.dart:556— Configuration.optionsEqual has cyclomatic complexity 27 (threshold 15). 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.
StatusFile._parse (cyclomatic 27) pkg/status_file/lib/canonical_status_file.dart:93— StatusFile._parse 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.
KeyCode.isCharacterKey (cyclomatic 27) tools/dom/src/KeyCode.dart:202— KeyCode.isCharacterKey has cyclomatic complexity 27 (threshold 15). 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. This is NOT this file's highest cyclomatic complexity: KeyCode._convertKeyCodeToKeyName (cyclomatic 40) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_Utf8Decoder.convertChunked (cyclomatic 27) sdk/lib/_internal/vm/lib/convert_patch.dart:1869— _Utf8Decoder.convertChunked 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.
Arm64CodeGenerator.visitCompareAndBranch (cyclomatic 27) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:374— Arm64CodeGenerator.visitCompareAndBranch 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.
LinearScanRegisterAllocator.buildLiveRanges (cyclomatic 27) pkg/native_compiler/lib/back_end/register_allocator.dart:182— LinearScanRegisterAllocator.buildLiveRanges 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.
Parser.parsePrimaryPattern (cyclomatic 27) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11653— Parser.parsePrimaryPattern 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.
ComplexTypeParamOrArgInfo.parseUnexpectedEnd (cyclomatic 27) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1607— ComplexTypeParamOrArgInfo.parseUnexpectedEnd 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.
MessageScheduler.add (cyclomatic 27) pkg/analysis_server/lib/src/scheduler/message_scheduler.dart:69— MessageScheduler.add 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.
InScopeCompletionPass.visitClassDeclaration (cyclomatic 27) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:652— InScopeCompletionPass.visitClassDeclaration 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.
ConvertToFlutterStyleTodo.compute (cyclomatic 27) pkg/analysis_server/lib/src/services/correction/dart/convert_to_flutter_style_todo.dart:26— ConvertToFlutterStyleTodo.compute 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.
ConvertToInitializingFormal.compute (cyclomatic 27) pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart:39— ConvertToInitializingFormal.compute 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.
MoveTopLevelToFile._membersToMove (cyclomatic 27) pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart:270— MoveTopLevelToFile._membersToMove 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.
_ConstLiteralVerifier.verify (cyclomatic 27) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1243— _ConstLiteralVerifier.verify 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.
ConstantVisitor._getConstantValue (cyclomatic 27) pkg/analyzer/lib/src/dart/constant/evaluation.dart:2011— ConstantVisitor._getConstantValue 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.
_ConstructorInvocationEvaluator._checkInitializers (cyclomatic 27) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3256— _ConstructorInvocationEvaluator._checkInitializers 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.
InheritanceManager3._getInterfaceClass (cyclomatic 27) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:547— InheritanceManager3._getInterfaceClass 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.
ErrorVerifier._checkForFinalSupertypeOutsideOfLibrary (cyclomatic 27) pkg/analyzer/lib/src/generated/error_verifier.dart:5758— ErrorVerifier._checkForFinalSupertypeOutsideOfLibrary 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.
ErrorVerifier._checkForUnnecessaryNullAware (cyclomatic 27) pkg/analyzer/lib/src/generated/error_verifier.dart:7919— ErrorVerifier._checkForUnnecessaryNullAware 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.
ResolverVisitor.resolveArgumentsToParameters (cyclomatic 27) pkg/analyzer/lib/src/generated/resolver.dart:6183— ResolverVisitor.resolveArgumentsToParameters 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.
CompletionTarget.computeReplacementRange (cyclomatic 27) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:498— CompletionTarget.computeReplacementRange 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.
CodegenEnqueuerListener._processClass (cyclomatic 27) pkg/compiler/lib/src/js_backend/codegen_listener.dart:333— CodegenEnqueuerListener._processClass has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CodegenWorldBuilder.generateParameterStubs (cyclomatic 27) pkg/compiler/lib/src/universe/codegen_world_builder.dart:674— CodegenWorldBuilder.generateParameterStubs 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.
ProtocolConverter.convertVmToDapStackFrame (cyclomatic 27) pkg/dap_adapters/lib/src/protocol_converter.dart:612— ProtocolConverter.convertVmToDapStackFrame has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExpressionCompiler.compileExpressionToJs (cyclomatic 27) pkg/dev_compiler/lib/src/kernel/expression_compiler.dart:68— ExpressionCompiler.compileExpressionToJs 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.
BodyBuilderImpl.beginSwitchCase (cyclomatic 27) pkg/front_end/lib/src/kernel/body_builder.dart:957— BodyBuilderImpl.beginSwitchCase 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.
BodyBuilderImpl.endFormalParameter (cyclomatic 27) pkg/front_end/lib/src/kernel/body_builder.dart:3745— BodyBuilderImpl.endFormalParameter 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.
BodyBuilderImpl.endSwitchCase (cyclomatic 27) pkg/front_end/lib/src/kernel/body_builder.dart:5435— BodyBuilderImpl.endSwitchCase 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.
_InitializerBuilder._createImplicitSuperInitializer (cyclomatic 27) pkg/front_end/lib/src/kernel/resolver_helpers.dart:579— _InitializerBuilder._createImplicitSuperInitializer 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.
InferenceVisitorImpl._checkElement (cyclomatic 27) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4153— InferenceVisitorImpl._checkElement 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
NodeCreator._generateBodies (cyclomatic 27) pkg/kernel/lib/src/node_creator.dart:171— NodeCreator._generateBodies 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. This is NOT this file's highest cyclomatic complexity: NodeCreator._createExpressionFromKind (cyclomatic 70) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_Visitor.visitNamedType (cyclomatic 27) pkg/linter/lib/src/rules/prefer_void_to_null.dart:58— _Visitor.visitNamedType 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.
HeapSnapshotElement._createReport (cyclomatic 27) pkg/observatory/lib/src/elements/heap_snapshot.dart:670— HeapSnapshotElement._createReport 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.
PragmaEntryPointsVisitor.visitProcedure (cyclomatic 27) pkg/vm/lib/transformations/type_flow/native_code.dart:143— PragmaEntryPointsVisitor.visitProcedure 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.
TypeRegistry._TypeInfo (cyclomatic 27) tools/dom/scripts/generator.py:2088— TypeRegistry._TypeInfo 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.
_Visitor._tryFixingMethodInvocation (cyclomatic 26) pkg/analyzer_utilities/tool/messages/use_literate_api_in_analyzer.dart:211— _Visitor._tryFixingMethodInvocation 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.
BytecodeGenerator._genPrologue (cyclomatic 26) pkg/dart2bytecode/lib/bytecode_generator.dart:2152— BytecodeGenerator._genPrologue 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. This is NOT this file's highest cyclomatic complexity: BytecodeGenerator._genMethodInvocationUsingSpecializedBytecode (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DevToolsServer._serveDevToolsWithArgs (cyclomatic 26) pkg/dds/lib/devtools_server.dart:510— DevToolsServer._serveDevToolsWithArgs has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ClosedWorldClassHierarchy.applyTreeChanges (cyclomatic 26) pkg/kernel/lib/class_hierarchy.dart:1264— ClosedWorldClassHierarchy.applyTreeChanges has cyclomatic complexity 26 (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.
int._parseRadix (cyclomatic 26) sdk/lib/_internal/vm_shared/lib/integers_patch.dart:153— int._parseRadix 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.
_SimpleUri._simpleMerge (cyclomatic 26) sdk/lib/core/uri.dart:4869— _SimpleUri._simpleMerge 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.
ExpressionIdentifierContext.ensureIdentifier (cyclomatic 26) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:393— ExpressionIdentifierContext.ensureIdentifier has cyclomatic complexity 26 (threshold 15). 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.
Parser.parseTypedef (cyclomatic 26) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:1449— Parser.parseTypedef 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.
DartCompletionRequest.targetPrefix (cyclomatic 26) pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart:451— DartCompletionRequest.targetPrefix 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.
DeclarationHelper._addMembersOfEnclosingInstance (cyclomatic 26) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1458— DeclarationHelper._addMembersOfEnclosingInstance 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.
InScopeCompletionPass.visitForStatement (cyclomatic 26) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1602— InScopeCompletionPass.visitForStatement 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.
InScopeCompletionPass.visitSwitchPatternCase (cyclomatic 26) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:3155— InScopeCompletionPass.visitSwitchPatternCase 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.
AddExplicitCast._computeTargetAndTypes (cyclomatic 26) pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:122— AddExplicitCast._computeTargetAndTypes 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.
CreateExtensionMethod.compute (cyclomatic 26) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:167— CreateExtensionMethod.compute has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CreateOperator.compute (cyclomatic 26) pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart:33— CreateOperator.compute has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
InlineTypedef.compute (cyclomatic 26) pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart:32— InlineTypedef.compute 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.
RemoveUnusedParameter.compute (cyclomatic 26) pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart:27— RemoveUnusedParameter.compute 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.
ConstantVisitor._buildListConstant (cyclomatic 26) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1499— ConstantVisitor._buildListConstant 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. This shape REPEATS in the file: one other method here (ConstantVisitor._buildSetConstant) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ConstantVisitor._buildSetConstant (cyclomatic 26) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1741— ConstantVisitor._buildSetConstant 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. This shape REPEATS in the file: one other method here (ConstantVisitor._buildListConstant) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
GenericInferrer._reportInferenceFailure (cyclomatic 26) pkg/analyzer/lib/src/dart/element/generic_inferrer.dart:605— GenericInferrer._reportInferenceFailure 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.
DartEditBuilderImpl._writeType (cyclomatic 26) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1540— DartEditBuilderImpl._writeType 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.
KernelSsaGraphBuilder._handleInvokeStaticForeign (cyclomatic 26) pkg/compiler/lib/src/ssa/builder.dart:5464— KernelSsaGraphBuilder._handleInvokeStaticForeign has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
SsaInstructionSelection.visitFieldSet (cyclomatic 26) pkg/compiler/lib/src/ssa/codegen_helpers.dart:351— SsaInstructionSelection.visitFieldSet 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.
ConditionTargets._step (cyclomatic 26) pkg/compiler/lib/src/ssa/optimize.dart:4268— ConditionTargets._step 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.
MiniJsParser.parseStatement (cyclomatic 26) pkg/dev_compiler/lib/src/js_ast/builder.dart:1421— MiniJsParser.parseStatement 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.
ProgramCompiler._emitBinaryOperator (cyclomatic 26) pkg/dev_compiler/lib/src/kernel/compiler.dart:6341— ProgramCompiler._emitBinaryOperator 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.
LibraryCompiler._emitBinaryOperator (cyclomatic 26) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7030— LibraryCompiler._emitBinaryOperator 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.
FutureOrNormalizer.visitFutureOrType (cyclomatic 26) pkg/dev_compiler/lib/src/kernel/future_or_normalizer.dart:34— FutureOrNormalizer.visitFutureOrType 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.
JSTypeRep.typeFor (cyclomatic 26) pkg/dev_compiler/lib/src/kernel/js_typerep.dart:34— JSTypeRep.typeFor 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.
_LibraryVirtualFieldModel.build (cyclomatic 26) pkg/dev_compiler/lib/src/kernel/property_model.dart:61— _LibraryVirtualFieldModel.build 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.
BodyBuilderImpl._validateTypeParameterUseInternal (cyclomatic 26) pkg/front_end/lib/src/kernel/body_builder.dart:11415— BodyBuilderImpl._validateTypeParameterUseInternal 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.
ConstantEvaluator.visitInstanceGet (cyclomatic 26) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4727— ConstantEvaluator.visitInstanceGet 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.
ClassMembersNodeBuilder.inferMethodType (cyclomatic 26) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:133— ClassMembersNodeBuilder.inferMethodType 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.
OutlineBuilder.endMethod (cyclomatic 26) pkg/front_end/lib/src/source/outline_builder.dart:2373— OutlineBuilder.endMethod 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.
_ConstMapLiteralBuilder.translate (cyclomatic 26) pkg/front_end/lib/src/type_inference/collection_encoding.dart:322— _ConstMapLiteralBuilder.translate 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.
StandardBounds._getFunctionStandardLowerBound (cyclomatic 26) pkg/kernel/lib/src/standard_bounds.dart:1098— StandardBounds._getFunctionStandardLowerBound 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. This is NOT this file's highest cyclomatic complexity: StandardBounds.morebottom (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ChainContext.run (cyclomatic 26) pkg/testing/lib/src/chain.dart:149— ChainContext.run 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.
InstrumentationLog._parseLogContent (cyclomatic 25) pkg/analysis_server/tool/instrumentation/log/log.dart:285— InstrumentationLog._parseLogContent 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.
AstNodeImplGenerator._generateConstructor (cyclomatic 25) pkg/analyzer/tool/generators/ast_generator.dart:602— AstNodeImplGenerator._generateConstructor 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.
BytecodeGenerator.getFieldDeclaration (cyclomatic 25) pkg/dart2bytecode/lib/bytecode_generator.dart:513— BytecodeGenerator.getFieldDeclaration has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: BytecodeGenerator._genMethodInvocationUsingSpecializedBytecode (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
AstCodeGenerator.visitSwitchStatement (cyclomatic 25) pkg/dart2wasm/lib/code_generator.dart:1443— AstCodeGenerator.visitSwitchStatement 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.
DynamicDispatchTable._lookupTarget (cyclomatic 25) pkg/dart2wasm/lib/dynamic_dispatch_table.dart:141— DynamicDispatchTable._lookupTarget 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.
DevToolsServer.serveDevTools (cyclomatic 25) pkg/dds/lib/devtools_server.dart:260— DevToolsServer.serveDevTools 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.
JSNumber._binaryGcd (cyclomatic 25) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:534— JSNumber._binaryGcd 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.
Primitives._generalApplyFunction (cyclomatic 25) sdk/lib/_internal/js_runtime/lib/js_helper.dart:1097— Primitives._generalApplyFunction 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.
JSInt._binaryGcd (cyclomatic 25) sdk/lib/_internal/js_runtime/lib/js_number.dart:625— JSInt._binaryGcd 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.
_Parser.parse (cyclomatic 25) sdk/lib/_internal/js_shared/lib/rti.dart:3041— _Parser.parse 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.
_IntegerImplementation._binaryGcd (cyclomatic 25) sdk/lib/_internal/vm/lib/integers.dart:444— _IntegerImplementation._binaryGcd 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.
BoxedInt._binaryGcd (cyclomatic 25) sdk/lib/_internal/wasm/common/boxed_int.dart:337— BoxedInt._binaryGcd 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.
_FfiUseSiteTransformer._replaceNativeCallParameterAndArgument (cyclomatic 25) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:2195— _FfiUseSiteTransformer._replaceNativeCallParameterAndArgument 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.
TypeConstraintGenerator._handleNonGenericFunctionTypes (cyclomatic 25) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:2574— TypeConstraintGenerator._handleNonGenericFunctionTypes 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.
DartUnitHighlightsComputer._isCallMethod (cyclomatic 25) pkg/analysis_server/lib/src/computer/computer_highlights.dart:677— DartUnitHighlightsComputer._isCallMethod has cyclomatic complexity 25 (threshold 15). 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.
FlutterOutlineComputer._createOutline (cyclomatic 25) pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart:137— FlutterOutlineComputer._createOutline 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.
_MinimalEditComputer.computeMinimalEdits (cyclomatic 25) pkg/analysis_server/lib/src/lsp/source_edits.dart:297— _MinimalEditComputer.computeMinimalEdits 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.
AddLate.compute (cyclomatic 25) pkg/analysis_server/lib/src/services/correction/dart/add_late.dart:35— AddLate.compute 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.
ConvertToCascade.compute (cyclomatic 25) pkg/analysis_server/lib/src/services/correction/dart/convert_to_cascade.dart:26— ConvertToCascade.compute 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.
TemplateContext._getInvocation (cyclomatic 25) pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart:81— TemplateContext._getInvocation 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.
_ParsedExpressionBuilder.build (cyclomatic 25) pkg/analyzer/lib/src/dart/ast/ast.dart:60164— _ParsedExpressionBuilder.build 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.
ConstantVisitor._buildMapConstant (cyclomatic 25) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1621— ConstantVisitor._buildMapConstant 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.
FunctionReferenceResolver.resolveInstantiation (cyclomatic 25) pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart:30— FunctionReferenceResolver.resolveInstantiation 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.
LibraryManifestBuilder._buildManifests (cyclomatic 25) pkg/analyzer/lib/src/fine/library_manifest.dart:888— LibraryManifestBuilder._buildManifests 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.
ErrorVerifier._checkForWrongNumberOfParametersForOperator (cyclomatic 25) pkg/analyzer/lib/src/generated/error_verifier.dart:8149— ErrorVerifier._checkForWrongNumberOfParametersForOperator has cyclomatic complexity 25 (threshold 15). 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.
_OpTypeAstVisitor.visitArgumentList (cyclomatic 25) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:214— _OpTypeAstVisitor.visitArgumentList 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.
_OpTypeAstVisitor.visitRegularFormalParameter (cyclomatic 25) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:1514— _OpTypeAstVisitor.visitRegularFormalParameter has cyclomatic complexity 25 (threshold 15). 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.
SsaPhiConditioning.handlePhi (cyclomatic 25) pkg/compiler/lib/src/ssa/codegen_helpers.dart:1485— SsaPhiConditioning.handlePhi 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.
SsaInstructionSimplifier.handleInterceptedCall (cyclomatic 25) pkg/compiler/lib/src/ssa/optimize.dart:851— SsaInstructionSimplifier.handleInterceptedCall 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.
SsaInstructionSimplifier.visitInvokeStatic (cyclomatic 25) pkg/compiler/lib/src/ssa/optimize.dart:2242— SsaInstructionSimplifier.visitInvokeStatic 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.
FixCommand.run (cyclomatic 25) pkg/dartdev/lib/src/commands/fix.dart:97— FixCommand.run has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ProgramCompiler._emitClassMethods (cyclomatic 25) pkg/dev_compiler/lib/src/kernel/compiler.dart:2483— ProgramCompiler._emitClassMethods 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.
DillClassBuilder.DillClassBuilder (cyclomatic 25) pkg/front_end/lib/src/dill/dill_class_builder.dart:39— DillClassBuilder.DillClassBuilder 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.
ConstantsTransformer.visitSwitchExpression (cyclomatic 25) pkg/front_end/lib/src/kernel/constant_evaluator.dart:2001— ConstantsTransformer.visitSwitchExpression 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.
SourceLoader.checkClassSupertypes (cyclomatic 25) pkg/front_end/lib/src/source/source_loader.dart:2061— SourceLoader.checkClassSupertypes 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.
_Visitor.visitClassDeclaration (cyclomatic 25) pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart:75— _Visitor.visitClassDeclaration 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.
_DeclarationGatherer._addMembers (cyclomatic 25) pkg/linter/lib/src/rules/unreachable_from_main.dart:97— _DeclarationGatherer._addMembers 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.
AnnotateKernel._convertType (cyclomatic 25) pkg/vm/lib/transformations/type_flow/transformer.dart:497— AnnotateKernel._convertType 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.
AnnotateKernel._annotateCallSite (cyclomatic 25) pkg/vm/lib/transformations/type_flow/transformer.dart:633— AnnotateKernel._annotateCallSite has cyclomatic complexity 25 (threshold 15). 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.
JsInteropChecks.visitClass (cyclomatic 24) pkg/_js_interop_checks/lib/js_interop_checks.dart:174— JsInteropChecks.visitClass 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.
CompletionResult.group (cyclomatic 24) pkg/analysis_server/tool/code_completion/completion_metrics.dart:1696— CompletionResult.group 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.
_BuilderGenerator._generateFinish (cyclomatic 24) pkg/analyzer/tool/summary/generate.dart:290— _BuilderGenerator._generateFinish 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.
DebugInfoWriter._flushPending (cyclomatic 24) pkg/wasm_builder/lib/debug_info.dart:371— DebugInfoWriter._flushPending 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.
_LibraryManager.findMatches (cyclomatic 24) tools/dom/src/native_DOMImplementation.dart:73— _LibraryManager.findMatches 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.
double._tryParseDouble (cyclomatic 24) sdk/lib/_internal/vm/lib/double_patch.dart:16— double._tryParseDouble 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.
Arm64CodeGenerator.visitTypeCast (cyclomatic 24) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1629— Arm64CodeGenerator.visitTypeCast 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.
BinaryPrinter.writeConstantTableEntry (cyclomatic 24) pkg/kernel/lib/binary/ast_to_binary.dart:232— BinaryPrinter.writeConstantTableEntry has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_RawSecureSocket._tryFilter (cyclomatic 24) sdk/lib/io/secure_socket.dart:1069— _RawSecureSocket._tryFilter 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.
_FfiDefinitionTransformer._findFields (cyclomatic 24) pkg/vm/lib/modular/transformations/ffi/definitions.dart:691— _FfiDefinitionTransformer._findFields 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.
AbstractScanner.tokenizeFractionPart (cyclomatic 24) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1695— AbstractScanner.tokenizeFractionPart 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.
Utf8BytesScanner.skipSpaces (cyclomatic 24) pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart:319— Utf8BytesScanner.skipSpaces has cyclomatic complexity 24 (threshold 15). 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.
ImportElementsComputer.createEdits (cyclomatic 24) pkg/analysis_server/lib/src/computer/import_elements_computer.dart:31— ImportElementsComputer.createEdits 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.
ResultMerger.mergeRefactoringFeedbacks (cyclomatic 24) pkg/analysis_server/lib/src/plugin/result_merger.dart:547— ResultMerger.mergeRefactoringFeedbacks 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.
InScopeCompletionPass.visitMethodInvocation (cyclomatic 24) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2121— InScopeCompletionPass.visitMethodInvocation 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.
InScopeCompletionPass.visitPrimaryConstructorDeclaration (cyclomatic 24) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2577— InScopeCompletionPass.visitPrimaryConstructorDeclaration 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.
AddExplicitCast.compute (cyclomatic 24) pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:31— AddExplicitCast.compute 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.
_EnumDescription.applyChanges (cyclomatic 24) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:193— _EnumDescription.applyChanges 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.
CreateExtensionOperator.compute (cyclomatic 24) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:352— CreateExtensionOperator.compute has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
MakeFinal.compute (cyclomatic 24) pkg/analysis_server/lib/src/services/correction/dart/make_final.dart:26— MakeFinal.compute 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.
RemoveLeadingUnderscore.compute (cyclomatic 24) pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart:27— RemoveLeadingUnderscore.compute 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.
ReplacedBy._rangeWithTarget (cyclomatic 24) pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart:183— ReplacedBy._rangeWithTarget 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.
ElementWriter._computeProperties (cyclomatic 24) pkg/analysis_server/lib/src/status/utilities/element_writer.dart:35— ElementWriter._computeProperties 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.
_Collector._identifier (cyclomatic 24) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:307— _Collector._identifier 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.
SubtypeHelper._isFunctionSubtypeOf (cyclomatic 24) pkg/analyzer/lib/src/dart/element/subtype.dart:85— SubtypeHelper._isFunctionSubtypeOf 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.
AstRewriter.methodInvocation (cyclomatic 24) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:93— AstRewriter.methodInvocation 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.
PropertyElementResolver.resolveReceiverPropertyExtraction (cyclomatic 24) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:989— PropertyElementResolver.resolveReceiverPropertyExtraction 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.
PropertyElementResolver.resolveReceiverPropertyReadWriteAssignmentTarget (cyclomatic 24) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1193— PropertyElementResolver.resolveReceiverPropertyReadWriteAssignmentTarget 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.
PropertyElementResolver._resolve (cyclomatic 24) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1857— PropertyElementResolver._resolve 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.
VariableDeclarationResolver.resolve (cyclomatic 24) pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart:28— VariableDeclarationResolver.resolve has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ErrorHandlerVerifier._verifyInvocation (cyclomatic 24) pkg/analyzer/lib/src/error/error_handler_verifier.dart:300— ErrorHandlerVerifier._verifyInvocation 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.
TypeArgumentsVerifier._checkForTypeArgumentNotMatchingBounds (cyclomatic 24) pkg/analyzer/lib/src/error/type_arguments_verifier.dart:356— TypeArgumentsVerifier._checkForTypeArgumentNotMatchingBounds 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.
_LibraryMatch.compareStructures (cyclomatic 24) pkg/analyzer/lib/src/fine/library_manifest.dart:1760— _LibraryMatch.compareStructures 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.
ResolverVisitor._reportNotEnoughPositionalArguments (cyclomatic 24) pkg/analyzer/lib/src/generated/resolver.dart:6339— ResolverVisitor._reportNotEnoughPositionalArguments 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.
SizeEstimator.visitAssignment (cyclomatic 24) pkg/compiler/lib/src/js/size_estimator.dart:566— SizeEstimator.visitAssignment has cyclomatic complexity 24 (threshold 15). 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. This is NOT this file's highest cyclomatic complexity: SizeEstimator.visitBinary (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
SpecializedChecks.findIsTestSpecialization (cyclomatic 24) pkg/compiler/lib/src/js_backend/specialized_checks.dart:32— SpecializedChecks.findIsTestSpecialization 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.
SsaInstructionSimplifier.simplifyExpressionPhi (cyclomatic 24) pkg/compiler/lib/src/ssa/optimize.dart:525— SsaInstructionSimplifier.simplifyExpressionPhi has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ResolutionWorldBuilder._getMemberUsage (cyclomatic 24) pkg/compiler/lib/src/universe/resolution_world_builder.dart:799— ResolutionWorldBuilder._getMemberUsage 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.
ExecutableCompiler._compileToSnapshot (cyclomatic 24) pkg/dartdev/lib/src/executable_compiler.dart:321— ExecutableCompiler._compileToSnapshot 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.
JsBuilder.escapedString (cyclomatic 24) pkg/dev_compiler/lib/src/js_ast/builder.dart:288— JsBuilder.escapedString 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.
ExpressionEvaluationHelperImpl.overwriteFindInterfaceMember (cyclomatic 24) pkg/front_end/lib/src/base/incremental_compiler.dart:2980— ExpressionEvaluationHelperImpl.overwriteFindInterfaceMember 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.
_InitializationFromExperimentalCache.loadLibrariesFromCache (cyclomatic 24) pkg/front_end/lib/src/base/incremental_compiler.dart:3663— _InitializationFromExperimentalCache.loadLibrariesFromCache 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.
InferenceVisitorImpl.visitDotShorthandInvocation (cyclomatic 24) pkg/front_end/lib/src/type_inference/inference_visitor.dart:13806— InferenceVisitorImpl.visitDotShorthandInvocation 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
InferenceVisitorBase._findExtensionMember (cyclomatic 24) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:1180— InferenceVisitorBase._findExtensionMember 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.
MiniJsParser.parseStatement (cyclomatic 24) pkg/js_ast/lib/src/builder.dart:1236— MiniJsParser.parseStatement 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.
Printer.visitAssignment (cyclomatic 24) pkg/js_ast/lib/src/printer.dart:922— Printer.visitAssignment has cyclomatic complexity 24 (threshold 15). 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. This is NOT this file's highest cyclomatic complexity: Printer.visitBinary (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
IntersectionType.nullability (cyclomatic 24) pkg/kernel/lib/src/ast/types.dart:2171— IntersectionType.nullability has cyclomatic complexity 24 (threshold 15). 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.
VarianceChecker.check (cyclomatic 24) pkg/linter/lib/src/util/variance_checker.dart:37— VarianceChecker.check 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.
Printer.visitProcedure (cyclomatic 24) pkg/kernel/lib/text/ast_to_text.dart:1341— Printer.visitProcedure has cyclomatic complexity 24 (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.
UnboxingInfoManager.analyzeComponent (cyclomatic 24) pkg/vm/lib/transformations/type_flow/unboxing_info.dart:51— UnboxingInfoManager.analyzeComponent has cyclomatic complexity 24 (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.
AbstractScanner.tokenizeFractionPart (cyclomatic 23) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1095— AbstractScanner.tokenizeFractionPart 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.
LogPage._writeEntry (cyclomatic 23) pkg/analysis_server/tool/instrumentation/page/log_page.dart:115— LogPage._writeEntry 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.
WasmCompilerOptions._validatePhases (cyclomatic 23) pkg/dart2wasm/lib/compiler_options.dart:184— WasmCompilerOptions._validatePhases 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.
DevToolsServer.serveDevTools (cyclomatic 23) pkg/dart_runtime_service_dds/lib/devtools_server.dart:262— DevToolsServer.serveDevTools 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.
_VerifyingVisitor.visitProcedure (cyclomatic 23) pkg/kernel/lib/verifier.dart:896— _VerifyingVisitor.visitProcedure has cyclomatic complexity 23 (threshold 15). 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.
HttpDate._parse (cyclomatic 23) sdk/lib/_http/http_date.dart:129— HttpDate._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.
NativeRuntime.streamTimelineTo (cyclomatic 23) sdk/lib/_internal/vm/lib/developer.dart:234— NativeRuntime.streamTimelineTo 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.
_JsonStringifier.writeStringContent (cyclomatic 23) sdk/lib/convert/json.dart:714— _JsonStringifier.writeStringContent 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.
_Uri._makeWindowsFileUrl (cyclomatic 23) sdk/lib/core/uri.dart:2208— _Uri._makeWindowsFileUrl 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.
_SimpleUri.replace (cyclomatic 23) sdk/lib/core/uri.dart:4753— _SimpleUri.replace has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Algorithm._filterUserConstraints (cyclomatic 23) pkg/dart2wasm/lib/deferred_load/partition.dart:318— _Algorithm._filterUserConstraints 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.
FunctionRegistry.getFunction (cyclomatic 23) pkg/cfg/lib/ir/functions.dart:340— FunctionRegistry.getFunction 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.
Simplification.visitComparison (cyclomatic 23) pkg/cfg/lib/passes/simplification.dart:103— Simplification.visitComparison 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.
SharedInteropTransformer.visitStaticInvocation (cyclomatic 23) pkg/_js_interop_checks/lib/src/transformations/shared_interop_transformer.dart:203— SharedInteropTransformer.visitStaticInvocation 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.
DartUnitHighlightsComputer._addIdentifierRegion_field (cyclomatic 23) pkg/analysis_server/lib/src/computer/computer_highlights.dart:257— DartUnitHighlightsComputer._addIdentifierRegion_field 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.
DartUnitHoverComputer._typeDisplayString (cyclomatic 23) pkg/analysis_server/lib/src/computer/computer_hover.dart:352— DartUnitHoverComputer._typeDisplayString has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: DartUnitHoverComputer._locationEntity (cyclomatic 35) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
CompletionResolveHandler.resolveDartCompletion (cyclomatic 23) pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart:60— CompletionResolveHandler.resolveDartCompletion 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.
TypeDefinitionHandler.handle (cyclomatic 23) pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart:42— TypeDefinitionHandler.handle has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ResultMerger.mergeNavigation (cyclomatic 23) pkg/analysis_server/lib/src/plugin/result_merger.dart:198— ResultMerger.mergeNavigation 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.
MessageScheduler._processDocumentChange (cyclomatic 23) pkg/analysis_server/lib/src/scheduler/message_scheduler.dart:440— MessageScheduler._processDocumentChange 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.
DeclarationHelper._visitPattern (cyclomatic 23) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:3071— DeclarationHelper._visitPattern 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.
AddAsync.compute (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/dart/add_async.dart:35— AddAsync.compute 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.
_CreateClass.compute (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:170— _CreateClass.compute 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.
_CreateConstructor._computeWithoutSuperParameters (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart:95— _CreateConstructor._computeWithoutSuperParameters has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CreateSetter.compute (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/dart/create_setter.dart:32— CreateSetter.compute 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.
RemoveTypeAnnotation._removeFromDeclarationList (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:72— RemoveTypeAnnotation._removeFromDeclarationList 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.
ReplaceWithDecoratedBox.compute (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart:28— ReplaceWithDecoratedBox.compute 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.
ElementMatcher.matches (cyclomatic 23) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart:52— ElementMatcher.matches 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.
_EdgeInsetsProperty.changeValue (cyclomatic 23) pkg/analysis_server/lib/src/services/flutter/property.dart:514— _EdgeInsetsProperty.changeValue 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.
RefactoringManager._createRefactoringFromKind (cyclomatic 23) pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_manager.dart:220— RefactoringManager._createRefactoringFromKind 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.
AnalysisOptionsImpl.signature (cyclomatic 23) pkg/analyzer/lib/src/analysis_options/analysis_options.dart:299— AnalysisOptionsImpl.signature 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.
FileState.serializeAstUnlinked2 (cyclomatic 23) pkg/analyzer/lib/src/dart/analysis/file_state.dart:959— FileState.serializeAstUnlinked2 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.
Search.references (cyclomatic 23) pkg/analyzer/lib/src/dart/analysis/search.dart:588— Search.references has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_ElementMapper.visitIdentifier (cyclomatic 23) pkg/analyzer/lib/src/dart/ast/element_locator.dart:107— _ElementMapper.visitIdentifier 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.
ConstantVisitor.visitBinaryOperatorInvocation (cyclomatic 23) pkg/analyzer/lib/src/dart/constant/evaluation.dart:673— ConstantVisitor.visitBinaryOperatorInvocation has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LeastUpperBoundHelper._functionType (cyclomatic 23) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:674— LeastUpperBoundHelper._functionType 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.
TypeSystemImpl._refineNumericInvocationTypeNullSafe (cyclomatic 23) pkg/analyzer/lib/src/dart/element/type_system.dart:2056— TypeSystemImpl._refineNumericInvocationTypeNullSafe 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.
FullInvocationInferrer.resolveInvocation (cyclomatic 23) pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart:274— FullInvocationInferrer.resolveInvocation 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.
ErrorVerifier._checkForEachParts (cyclomatic 23) pkg/analyzer/lib/src/generated/error_verifier.dart:5041— ErrorVerifier._checkForEachParts 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.
IgnoreInfo.isIgnoreForFileComment (cyclomatic 23) pkg/analyzer/lib/src/ignore_comments/ignore_info.dart:248— IgnoreInfo.isIgnoreForFileComment has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ManifestParser._parseAttribute (cyclomatic 23) pkg/analyzer/lib/src/manifest/manifest_validator.dart:145— ManifestParser._parseAttribute 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.
ManifestParser._parseNormalTag (cyclomatic 23) pkg/analyzer/lib/src/manifest/manifest_validator.dart:287— ManifestParser._parseNormalTag 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.
KFieldAnalysis.registerInstantiatedClass (cyclomatic 23) pkg/compiler/lib/src/js_backend/field_analysis.dart:47— KFieldAnalysis.registerInstantiatedClass 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.
SsaInstructionSelection._followingSameFaultInstruction (cyclomatic 23) pkg/compiler/lib/src/ssa/codegen_helpers.dart:106— SsaInstructionSelection._followingSameFaultInstruction 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.
MemorySet.intersectionFor (cyclomatic 23) pkg/compiler/lib/src/ssa/optimize.dart:5097— MemorySet.intersectionFor 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.
ClassPropertyModel.build (cyclomatic 23) pkg/dev_compiler/lib/src/kernel/property_model.dart:224— ClassPropertyModel.build 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.
IncrementalCompiler._computeTransitiveClosure (cyclomatic 23) pkg/front_end/lib/src/base/incremental_compiler.dart:1773— IncrementalCompiler._computeTransitiveClosure 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.
NamedTypeBuilderImpl.buildSupertype (cyclomatic 23) pkg/front_end/lib/src/builder/named_type_builder.dart:654— NamedTypeBuilderImpl.buildSupertype 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. This is NOT this file's highest cyclomatic complexity: NamedTypeBuilderImpl._checkDeferred (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DartScopeBuilder2._looksLikePatternMatching (cyclomatic 23) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:946— DartScopeBuilder2._looksLikePatternMatching 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.
Resolver._finishFunction (cyclomatic 23) pkg/front_end/lib/src/kernel/resolver.dart:1413— Resolver._finishFunction 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.
_ConstListOrSetLiteralBuilder.translate (cyclomatic 23) pkg/front_end/lib/src/type_inference/collection_encoding.dart:168— _ConstListOrSetLiteralBuilder.translate 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.
InferenceVisitorImpl.dispatchPatternSchema (cyclomatic 23) pkg/front_end/lib/src/type_inference/inference_visitor.dart:11359— InferenceVisitorImpl.dispatchPatternSchema 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
StandardBounds._getLegacyLeastUpperBound (cyclomatic 23) pkg/kernel/lib/src/standard_bounds.dart:978— StandardBounds._getLegacyLeastUpperBound 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. This is NOT this file's highest cyclomatic complexity: StandardBounds.morebottom (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_Visitor._visitInvocationExpression (cyclomatic 23) pkg/linter/lib/src/rules/unnecessary_lambdas.dart:228— _Visitor._visitInvocationExpression 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.
NameSection.serializeContents (cyclomatic 23) pkg/wasm_builder/lib/src/serialize/sections.dart:910— NameSection.serializeContents 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.
DFilterExpression.evaluate (cyclomatic 23) runtime/tools/heapsnapshot/lib/src/expression.dart:53— DFilterExpression.evaluate 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.
_DirectInvocation._processFunction (cyclomatic 23) pkg/vm/lib/transformations/type_flow/analysis.dart:384— _DirectInvocation._processFunction 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.
RuntimeType.isSubtypeOfRuntimeType (cyclomatic 23) pkg/vm/lib/transformations/type_flow/types.dart:1640— RuntimeType.isSubtypeOfRuntimeType has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
bin_to_coff.main (cyclomatic 23) runtime/tools/bin_to_coff.py:113— bin_to_coff.main has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Version.__lt__ (cyclomatic 23) tools/utils.py:192— Version.__lt__ has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
MutationRunner._runChain (cyclomatic 22) pkg/analyzer/tool/fine/ab_mutate.dart:250— MutationRunner._runChain 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.
_CodeGenerator.extractIdl (cyclomatic 22) pkg/analyzer/tool/summary/generate.dart:590— _CodeGenerator.extractIdl 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.
_ScopeBuilder._visitFunction (cyclomatic 22) pkg/dart2bytecode/lib/local_vars.dart:317— _ScopeBuilder._visitFunction 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.
AstIndexerAndIgnoreCollector._checkCommentAndIgnoreCoverageWithBeginAndEnd (cyclomatic 22) pkg/front_end/tool/coverage_merger.dart:967— AstIndexerAndIgnoreCollector._checkCommentAndIgnoreCoverageWithBeginAndEnd has cyclomatic complexity 22 (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.
_TraceReader.readTrace (cyclomatic 22) pkg/vm_snapshot_analysis/lib/precompiler_trace.dart:210— _TraceReader.readTrace 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.
AppWindowCreateWindowOptions.AppWindowCreateWindowOptions (cyclomatic 22) tools/dom/src/_chrome/app_window.dart:61— AppWindowCreateWindowOptions.AppWindowCreateWindowOptions has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_HttpClientResponse._authenticate (cyclomatic 22) sdk/lib/_http/http_impl.dart:775— _HttpClientResponse._authenticate 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. This is NOT this file's highest cyclomatic complexity: _HttpResponse._findReasonPhrase (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_WebSocketOutgoingTransformer.createFrame (cyclomatic 22) sdk/lib/_http/websocket_impl.dart:1089— _WebSocketOutgoingTransformer.createFrame 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.
FormatException.toString (cyclomatic 22) sdk/lib/core/exceptions.dart:75— FormatException.toString 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.
Uri.parseIPv6Address (cyclomatic 22) sdk/lib/core/uri.dart:1611— Uri.parseIPv6Address 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.
Stdin.readLineSync (cyclomatic 22) sdk/lib/io/stdio.dart:46— Stdin.readLineSync 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.
PromotionModel._tryPromoteToTypeOfInterest (cyclomatic 22) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:4911— PromotionModel._tryPromoteToTypeOfInterest 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.
Parser.parseExtensionDeclaration (cyclomatic 22) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3641— Parser.parseExtensionDeclaration 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.
Parser.parseFactoryMethod (cyclomatic 22) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6162— Parser.parseFactoryMethod 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.
Parser.parseUnaryExpression (cyclomatic 22) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7872— Parser.parseUnaryExpression 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.
_MinimalEditComputer._addEditFor (cyclomatic 22) pkg/analysis_server/lib/src/lsp/source_edits.dart:465— _MinimalEditComputer._addEditFor has cyclomatic complexity 22 (threshold 15). 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.
TypeHierarchyComputerHelper.findMemberElement (cyclomatic 22) pkg/analysis_server/lib/src/search/type_hierarchy.dart:194— TypeHierarchyComputerHelper.findMemberElement 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.
Driver.start (cyclomatic 22) pkg/analysis_server/lib/src/server/driver.dart:175— Driver.start has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DeclarationHelper._addMembersOfEnclosingNode (cyclomatic 22) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1568— DeclarationHelper._addMembersOfEnclosingNode 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.
DeclarationHelper._suggestMethod (cyclomatic 22) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2390— DeclarationHelper._suggestMethod 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.
FeatureComputer.computeElementKind (cyclomatic 22) pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart:186— FeatureComputer.computeElementKind has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This shape REPEATS in the file: one other method here (FeatureComputer.computeElementKind2) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
FeatureComputer.computeElementKind2 (cyclomatic 22) pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart:238— FeatureComputer.computeElementKind2 has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This shape REPEATS in the file: one other method here (FeatureComputer.computeElementKind) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
InScopeCompletionPass.visitRegularFormalParameter (cyclomatic 22) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2888— InScopeCompletionPass.visitRegularFormalParameter 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.
BulkFixProcessor._fixErrorsInLibraryUnit (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:703— BulkFixProcessor._fixErrorsInLibraryUnit 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.
BindToField._replaceParameterWithThis (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart:121— BindToField._replaceParameterWithThis 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.
ConvertIntoFinalField.compute (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart:26— ConvertIntoFinalField.compute 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.
ConvertToDeclaringParameter._resolveParameterFromFieldNode (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart:476— ConvertToDeclaringParameter._resolveParameterFromFieldNode 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.
ConvertToNullAware.compute (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware.dart:32— ConvertToNullAware.compute 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.
_RemoveConst.compute (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart:164— _RemoveConst.compute 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.
ReplaceWithIsEmpty._analyzeBinaryExpression (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart:94— ReplaceWithIsEmpty._analyzeBinaryExpression 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.
_MatcherBuilder._buildFromSimpleIdentifier (cyclomatic 22) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart:601— _MatcherBuilder._buildFromSimpleIdentifier 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.
PluginsPage._emitIsolateInfo (cyclomatic 22) pkg/analysis_server/lib/src/status/pages/plugins_page.dart:145— PluginsPage._emitIsolateInfo 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.
AnalysisDriver.workPriority (cyclomatic 22) pkg/analyzer/lib/src/dart/analysis/driver.dart:468— AnalysisDriver.workPriority has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
GenericInferrer.tryChooseFinalTypes (cyclomatic 22) pkg/analyzer/lib/src/dart/element/generic_inferrer.dart:298— GenericInferrer.tryChooseFinalTypes 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.
AnnotationResolver._resolve (cyclomatic 22) pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:222— AnnotationResolver._resolve 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.
AssignmentExpressionResolver.resolveCompound (cyclomatic 22) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:156— AssignmentExpressionResolver.resolveCompound 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.
ConstructorTearOffResolver.resolve (cyclomatic 22) pkg/analyzer/lib/src/dart/resolver/constructor_tear_off_resolver.dart:22— ConstructorTearOffResolver.resolve 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.
TypedLiteralResolver._inferSetOrMapLiteralType (cyclomatic 22) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:553— TypedLiteralResolver._inferSetOrMapLiteralType has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartdocDirectiveInfo.extractTemplate (cyclomatic 22) pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart:48— DartdocDirectiveInfo.extractTemplate 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.
ConstArgumentsVerifier._isConst (cyclomatic 22) pkg/analyzer/lib/src/error/const_argument_verifier.dart:220— ConstArgumentsVerifier._isConst 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.
UnusedLocalElementsVerifier._isUsedElement (cyclomatic 22) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:1186— UnusedLocalElementsVerifier._isUsedElement 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.
DocCommentBuilder._parseOneCommentReference (cyclomatic 22) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:605— DocCommentBuilder._parseOneCommentReference 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.
ErrorVerifier._checkForConflictingClassMembers (cyclomatic 22) pkg/analyzer/lib/src/generated/error_verifier.dart:4015— ErrorVerifier._checkForConflictingClassMembers 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.
ErrorVerifier._checkForConflictingInitializerErrorCodes (cyclomatic 22) pkg/analyzer/lib/src/generated/error_verifier.dart:4420— ErrorVerifier._checkForConflictingInitializerErrorCodes 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.
ErrorVerifier._checkForExtensionTypeRepresentationErrorCodes (cyclomatic 22) pkg/analyzer/lib/src/generated/error_verifier.dart:5511— ErrorVerifier._checkForExtensionTypeRepresentationErrorCodes 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.
FfiVerifier.visitClassDeclaration (cyclomatic 22) pkg/analyzer/lib/src/generated/ffi_verifier.dart:270— FfiVerifier.visitClassDeclaration 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.
ResolverVisitor.visitAnonymousMethodInvocation (cyclomatic 22) pkg/analyzer/lib/src/generated/resolver.dart:2123— ResolverVisitor.visitAnonymousMethodInvocation 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.
LocalDeclarationVisitor._addVariables (cyclomatic 22) pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:310— LocalDeclarationVisitor._addVariables 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.
SpecializedChecks._findAsCheck (cyclomatic 22) pkg/compiler/lib/src/js_backend/specialized_checks.dart:153— SpecializedChecks._findAsCheck 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.
KernelSsaGraphBuilder._buildConstructor (cyclomatic 22) pkg/compiler/lib/src/ssa/builder.dart:788— KernelSsaGraphBuilder._buildConstructor 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.
DartDebugAdapter._buildOutputEventsWithSourceReferences (cyclomatic 22) pkg/dap_adapters/lib/src/adapters/dart.dart:2659— DartDebugAdapter._buildOutputEventsWithSourceReferences 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.
BaseDebugAdapter.handleIncomingRequest (cyclomatic 22) pkg/dap_adapters/lib/src/base_debug_adapter.dart:326— BaseDebugAdapter.handleIncomingRequest has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ProgramCompiler._emitFactoryInvocation (cyclomatic 22) pkg/dev_compiler/lib/src/kernel/compiler.dart:7461— ProgramCompiler._emitFactoryInvocation 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.
LibraryCompiler._emitClassProperties (cyclomatic 22) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2799— LibraryCompiler._emitClassProperties 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.
LibraryCompiler._emitFactoryInvocation (cyclomatic 22) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8328— LibraryCompiler._emitFactoryInvocation 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.
NamedTypeBuilderImpl.substituteRange (cyclomatic 22) pkg/front_end/lib/src/builder/named_type_builder.dart:1011— NamedTypeBuilderImpl.substituteRange 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. This is NOT this file's highest cyclomatic complexity: NamedTypeBuilderImpl._checkDeferred (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
RecordTypeBuilderImpl.buildAliased (cyclomatic 22) pkg/front_end/lib/src/builder/record_type_builder.dart:159— RecordTypeBuilderImpl.buildAliased 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.
ForwardingNode._createForwardingImplIfNeeded (cyclomatic 22) pkg/front_end/lib/src/kernel/forwarding_node.dart:299— ForwardingNode._createForwardingImplIfNeeded 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.
SourceLibraryBuilder.computeFieldPromotability (cyclomatic 22) pkg/front_end/lib/src/source/source_library_builder.dart:829— SourceLibraryBuilder.computeFieldPromotability 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. This is NOT this file's highest cyclomatic complexity: SourceLibraryBuilder.checkPendingBoundsChecks (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
StringToSource.analyze (cyclomatic 22) pkg/js_ast/lib/src/strings.dart:26— StringToSource.analyze has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
IntersectionType.IntersectionType (cyclomatic 22) pkg/kernel/lib/src/ast/types.dart:2050— IntersectionType.IntersectionType has cyclomatic complexity 22 (threshold 15). 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.
InstructionsBuilder.forceBuild (cyclomatic 22) pkg/wasm_builder/lib/src/builder/instructions.dart:296— InstructionsBuilder.forceBuild 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.
_RecGroupBuilder._assignBrandTypes (cyclomatic 22) pkg/wasm_builder/lib/src/builder/types.dart:124— _RecGroupBuilder._assignBrandTypes 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.
PragmaEntryPointsVisitor.visitField (cyclomatic 22) pkg/vm/lib/transformations/type_flow/native_code.dart:265— PragmaEntryPointsVisitor.visitField 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.
_Transform.transformMemberSignature (cyclomatic 22) pkg/vm/lib/transformations/type_flow/signature_shaking.dart:405— _Transform.transformMemberSignature 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.
HtmlDartGenerator._AddFutureifiedOperation (cyclomatic 22) tools/dom/scripts/htmldartgenerator.py:694— HtmlDartGenerator._AddFutureifiedOperation 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.
IDLNode._find_all (cyclomatic 22) tools/dom/scripts/idlnode.py:191— IDLNode._find_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.
ConfigurationFilesMixin.writePackageConfig2 (cyclomatic 21) pkg/analyzer_testing/lib/configuration_files_mixin.dart:54— ConfigurationFilesMixin.writePackageConfig2 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.
Utils.formatDuration (cyclomatic 21) pkg/observatory/lib/utils.dart:150— Utils.formatDuration 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.
DartFuzz.pickScalarVar (cyclomatic 21) runtime/tools/dartfuzz/dartfuzz.dart:2128— DartFuzz.pickScalarVar 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.
Future.wait (cyclomatic 21) sdk/lib/async/future.dart:472— Future.wait 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.
Arm64CodeGenerator.visitTypeTest (cyclomatic 21) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1764— Arm64CodeGenerator.visitTypeTest 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. This is NOT this file's highest cyclomatic complexity: Arm64CodeGenerator.visitComparison (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Base64Codec.normalize (cyclomatic 21) sdk/lib/convert/base64.dart:85— Base64Codec.normalize 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.
_Utf8Decoder.decodeGeneral (cyclomatic 21) sdk/lib/convert/utf.dart:575— _Utf8Decoder.decodeGeneral 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.
_Uri._normalizeRegName (cyclomatic 21) sdk/lib/core/uri.dart:2550— _Uri._normalizeRegName 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.
UriData._parse (cyclomatic 21) sdk/lib/core/uri.dart:4254— UriData._parse 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.
AstToIr._buildPrologue (cyclomatic 21) pkg/cfg/lib/front_end/ast_to_ir.dart:143— AstToIr._buildPrologue 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.
_FfiUseSiteTransformer._verifyAndReplaceNativeCallable (cyclomatic 21) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:1274— _FfiUseSiteTransformer._verifyAndReplaceNativeCallable 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.
Parser.parseArgumentOrIndexStar (cyclomatic 21) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7995— Parser.parseArgumentOrIndexStar 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.
Parser.parseArgumentsRest (cyclomatic 21) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9511— Parser.parseArgumentsRest 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.
Parser.parseVariablePattern (cyclomatic 21) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11885— Parser.parseVariablePattern 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.
ComplexTypeInfo._checkIfRecordTypeParenthesisAreRecovered (cyclomatic 21) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:879— ComplexTypeInfo._checkIfRecordTypeParenthesisAreRecovered 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.
ComplexTypeParamOrArgInfo.compute (cyclomatic 21) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1345— ComplexTypeParamOrArgInfo.compute 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.
Features.fromText (cyclomatic 21) pkg/_fe_analyzer_shared/lib/src/testing/features.dart:155— Features.fromText 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.
ExportChecker.visitClass (cyclomatic 21) pkg/_js_interop_checks/lib/src/transformations/export_checker.dart:95— ExportChecker.visitClass 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.
ContextManagerImpl._createAnalysisContexts (cyclomatic 21) pkg/analysis_server/lib/src/context_manager.dart:687— ContextManagerImpl._createAnalysisContexts 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.
TokenData.fromSelection (cyclomatic 21) pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart:548— TokenData.fromSelection 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.
UriHelper._addFileSuggestions (cyclomatic 21) pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart:82— UriHelper._addFileSuggestions 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.
YamlCompletionGenerator._siblingsOnPath (cyclomatic 21) pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart:220— YamlCompletionGenerator._siblingsOnPath 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.
BulkFixProcessor._computeChangesToPubspec (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:423— BulkFixProcessor._computeChangesToPubspec 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.
AddSuperParameter._addToConstructor (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/dart/add_super_parameter.dart:62— AddSuperParameter._addToConstructor 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.
ConvertNullCheckToNullAwareElementOrEntry.compute (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/dart/convert_null_check_to_null_aware_element_or_entry.dart:29— ConvertNullCheckToNullAwareElementOrEntry.compute 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.
ConvertToNamedArguments.compute (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart:25— ConvertToNamedArguments.compute 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.
CreateExtensionGetter.compute (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:34— CreateExtensionGetter.compute has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
RemoveThisAlias.compute (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/dart/remove_this_alias.dart:32— RemoveThisAlias.compute 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.
_CodeFragmentScanner.scan (cyclomatic 21) pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart:387— _CodeFragmentScanner.scan 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.
ContextsPage.generateContent (cyclomatic 21) pkg/analysis_server/lib/src/status/pages/contexts_page.dart:37— ContextsPage.generateContent 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.
ExpressionImpl.computeConstantValue (cyclomatic 21) pkg/analyzer/lib/src/dart/ast/ast.dart:17991— ExpressionImpl.computeConstantValue 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. This is NOT this file's highest cyclomatic complexity: V1Projection._sourceOf (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
GreatestLowerBoundHelper._functionType (cyclomatic 21) pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart:251— GreatestLowerBoundHelper._functionType 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.
AssignmentExpressionResolver.resolveDirect (cyclomatic 21) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:317— AssignmentExpressionResolver.resolveDirect 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.
PropertyElementResolver._resolveTargetInterfaceElement (cyclomatic 21) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:2243— PropertyElementResolver._resolveTargetInterfaceElement 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.
AssignmentVerifier._verify (cyclomatic 21) pkg/analyzer/lib/src/error/assignment_verifier.dart:91— AssignmentVerifier._verify 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.
BestPracticesVerifier.visitMethodDeclaration (cyclomatic 21) pkg/analyzer/lib/src/error/best_practices_verifier.dart:651— BestPracticesVerifier.visitMethodDeclaration 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.
GatherUsedLocalElementsVisitor.visitSimpleIdentifier (cyclomatic 21) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:375— GatherUsedLocalElementsVisitor.visitSimpleIdentifier 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.
AstBuilder.endFormalParameter (cyclomatic 21) pkg/analyzer/lib/src/fasta/ast_builder.dart:1877— AstBuilder.endFormalParameter 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.
ErrorVerifier._checkForAllMixinErrorCodes (cyclomatic 21) pkg/analyzer/lib/src/generated/error_verifier.dart:2967— ErrorVerifier._checkForAllMixinErrorCodes 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.
FfiVerifier._isValidFfiNativeType (cyclomatic 21) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1116— FfiVerifier._isValidFfiNativeType 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.
FfiVerifier._validateCompatibleNativeType (cyclomatic 21) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1665— FfiVerifier._validateCompatibleNativeType has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
FfiVerifier._validateNativeAddressOf (cyclomatic 21) pkg/analyzer/lib/src/generated/ffi_verifier.dart:2059— FfiVerifier._validateNativeAddressOf 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.
FfiVerifier._validateNativeCallable (cyclomatic 21) pkg/analyzer/lib/src/generated/ffi_verifier.dart:2186— FfiVerifier._validateNativeCallable 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.
MissingDependencyValidator.validate (cyclomatic 21) pkg/analyzer/lib/src/pubspec/validators/missing_dependency_validator.dart:60— MissingDependencyValidator.validate 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.
_InfoBuilder.build (cyclomatic 21) pkg/analyzer/lib/src/summary2/informative_data.dart:566— _InfoBuilder.build has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Finder._visit (cyclomatic 21) pkg/analyzer/lib/src/summary2/type_alias.dart:83— _Finder._visit 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.
DartEditBuilderImpl._canWriteType (cyclomatic 21) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1131— DartEditBuilderImpl._canWriteType has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
InferrerEngine._isFieldInitializerPotentiallyNull (cyclomatic 21) pkg/compiler/lib/src/inferrer/engine.dart:769— InferrerEngine._isFieldInitializerPotentiallyNull has cyclomatic complexity 21 (threshold 15). 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.
ListTracerVisitor.visitDynamicCallSiteTypeInformation (cyclomatic 21) pkg/compiler/lib/src/inferrer/list_tracer.dart:175— ListTracerVisitor.visitDynamicCallSiteTypeInformation 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.
KClassEnv._ensureMaps (cyclomatic 21) pkg/compiler/lib/src/kernel/env.dart:243— KClassEnv._ensureMaps 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.
NativeEnqueuer._processNativeBehavior (cyclomatic 21) pkg/compiler/lib/src/native/enqueue.dart:81— NativeEnqueuer._processNativeBehavior 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.
ResolutionEnqueuer.processTypeUse (cyclomatic 21) pkg/compiler/lib/src/resolution/enqueuer.dart:208— ResolutionEnqueuer.processTypeUse 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. This is NOT this file's highest cyclomatic complexity: ResolutionEnqueuer.processStaticUse (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DartCliDebugAdapter.launchAndRespond (cyclomatic 21) pkg/dap_adapters/lib/src/adapters/dart_cli_adapter.dart:73— DartCliDebugAdapter.launchAndRespond has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ProtocolConverter.convertVmInstanceRefToDisplayString (cyclomatic 21) pkg/dap_adapters/lib/src/protocol_converter.dart:45— ProtocolConverter.convertVmInstanceRefToDisplayString 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.
MiniJsParser.parsePrimary (cyclomatic 21) pkg/dev_compiler/lib/src/js_ast/builder.dart:866— MiniJsParser.parsePrimary 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. This is NOT this file's highest cyclomatic complexity: MiniJsParser.categoryToString (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ProgramCompiler._emitCovarianceCheckStub (cyclomatic 21) pkg/dev_compiler/lib/src/kernel/compiler.dart:2693— ProgramCompiler._emitCovarianceCheckStub 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.
LibraryCompiler._emitCovarianceCheckStub (cyclomatic 21) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:3003— LibraryCompiler._emitCovarianceCheckStub 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.
DillExtensionBuilder.DillExtensionBuilder (cyclomatic 21) pkg/front_end/lib/src/dill/dill_extension_builder.dart:34— DillExtensionBuilder.DillExtensionBuilder 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.
RegularFieldDeclaration.createFieldEncoding (cyclomatic 21) pkg/front_end/lib/src/fragment/field/declaration.dart:521— RegularFieldDeclaration.createFieldEncoding 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.
ConstantEvaluator._evaluateSubexpression (cyclomatic 21) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3110— ConstantEvaluator._evaluateSubexpression 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.
DynamicInterfaceSpecification.findNodes (cyclomatic 21) pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:216— DynamicInterfaceSpecification.findNodes 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.
SourceExtensionTypeDeclarationBuilder.build (cyclomatic 21) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:252— SourceExtensionTypeDeclarationBuilder.build 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. This is NOT this file's highest cyclomatic complexity: SourceExtensionTypeDeclarationBuilder.addMemberInternal (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
InferenceVisitorBase._finishFieldGetterInvocation (cyclomatic 21) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3282— InferenceVisitorBase._finishFieldGetterInvocation has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorBase._tearOffCall (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_Visitor.visitCompilationUnit (cyclomatic 21) pkg/linter/lib/src/rules/unreachable_from_main.dart:503— _Visitor.visitCompilationUnit 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.
LineNumberProgram._readOpcodes (cyclomatic 21) pkg/native_stack_traces/lib/src/dwarf.dart:1559— LineNumberProgram._readOpcodes 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. This is NOT this file's highest cyclomatic complexity: _AttributeForm.read (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
InspectPage._visitObject (cyclomatic 21) pkg/observatory/lib/src/app/page.dart:249— InspectPage._visitObject has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Instruction.deserializeConst (cyclomatic 21) pkg/wasm_builder/lib/src/ir/instruction.dart:41— Instruction.deserializeConst 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.
TypeMemberContributor._computeSuggestions (cyclomatic 21) pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart:64— TypeMemberContributor._computeSuggestions 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.
DatabaseBuilder._merge_nodes (cyclomatic 21) tools/dom/scripts/databasebuilder.py:361— DatabaseBuilder._merge_nodes 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.
IDLFile.__init__ (cyclomatic 21) tools/dom/scripts/idlnode.py:418— IDLFile.__init__ 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.
graphexplorer.Graph.loadDartHeapSnapshot (cyclomatic 21) runtime/tools/graphexplorer/graphexplorer.js:155— graphexplorer.Graph.loadDartHeapSnapshot 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.
ConstantCreator._makeWasmArrayLiteral (cyclomatic 20) pkg/dart2wasm/lib/constants.dart:1009— ConstantCreator._makeWasmArrayLiteral 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. This is NOT this file's highest cyclomatic complexity: Constants._lowerTypeConstantImpl (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DartDevelopmentServiceLauncher.start (cyclomatic 20) pkg/dds/lib/dds_launcher.dart:52— DartDevelopmentServiceLauncher.start has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Expect._deepEquals (cyclomatic 20) pkg/expect/lib/expect.dart:729— Expect._deepEquals 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.
Analysis.reverseTransitiveGraph (cyclomatic 20) pkg/heap_snapshot/lib/analysis.dart:335— Analysis.reverseTransitiveGraph 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.
_Utils._addInstanceMirrors (cyclomatic 20) tools/dom/src/native_DOMImplementation.dart:924— _Utils._addInstanceMirrors has cyclomatic complexity 20 (threshold 15). 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.
_HttpClient._findProxyFromEnvironment (cyclomatic 20) sdk/lib/_http/http_impl.dart:3251— _HttpClient._findProxyFromEnvironment 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. This is NOT this file's highest cyclomatic complexity: _HttpResponse._findReasonPhrase (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_HttpParser._headersEnd (cyclomatic 20) sdk/lib/_http/http_parser.dart:388— _HttpParser._headersEnd has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Utf8Decoder._decodeGeneral (cyclomatic 20) sdk/lib/_internal/wasm/common/convert_patch.dart:2725— _Utf8Decoder._decodeGeneral 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.
TypeReferenceIdentifierContext.ensureIdentifier (cyclomatic 20) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1511— TypeReferenceIdentifierContext.ensureIdentifier has cyclomatic complexity 20 (threshold 15). 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.
Parser.parseDeclarationHeaderRecoveryInternal (cyclomatic 20) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3172— Parser.parseDeclarationHeaderRecoveryInternal 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._attemptPrecedenceLevelRecovery (cyclomatic 20) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7614— Parser._attemptPrecedenceLevelRecovery has cyclomatic complexity 20 (threshold 15). 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.
Parser.looksLikeExpressionAfterAwaitOrYield (cyclomatic 20) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:10551— Parser.looksLikeExpressionAfterAwaitOrYield 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.
ComplexTypeInfo.parseType (cyclomatic 20) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:615— ComplexTypeInfo.parseType 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.
DeclarationHelper._suggestProperty (cyclomatic 20) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2551— DeclarationHelper._suggestProperty 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.
AddConst.compute (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/dart/add_const.dart:32— AddConst.compute 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.
ConvertIntoGetter.compute (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart:41— ConvertIntoGetter.compute 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.
ConvertToDeclaringParameter._getRefactorData (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart:388— ConvertToDeclaringParameter._getRefactorData 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.
ConvertToExpressionFunctionBody.compute (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart:30— ConvertToExpressionFunctionBody.compute has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
RemoveDeadCode._handleDeadAtStartOfNode (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart:126— RemoveDeadCode._handleDeadAtStartOfNode 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.
RemoveIfNullOperator.compute (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/dart/remove_if_null_operator.dart:26— RemoveIfNullOperator.compute 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.
_MatcherBuilder.buildMatchersForNode (cyclomatic 20) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart:203— _MatcherBuilder.buildMatchersForNode has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExtractWidgetRefactoringImpl._initializeParameters (cyclomatic 20) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:276— ExtractWidgetRefactoringImpl._initializeParameters 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.
MoveTopLevelToFile.compute (cyclomatic 20) pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart:84— MoveTopLevelToFile.compute 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.
FixProcessor._addFromProducers (cyclomatic 20) pkg/analysis_server_plugin/lib/src/correction/fix_processor.dart:115— FixProcessor._addFromProducers 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.
_ElementMapperV2._visitIdentifier (cyclomatic 20) pkg/analyzer/lib/src/dart/ast/element_locator.dart:595— _ElementMapperV2._visitIdentifier 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.
AssignmentExpressionResolver.resolveIfNull (cyclomatic 20) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:507— AssignmentExpressionResolver.resolveIfNull 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.
BinaryExpressionResolver._resolveEqual (cyclomatic 20) pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart:176— BinaryExpressionResolver._resolveEqual has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExtensionMemberResolver._isValidContext (cyclomatic 20) pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart:527— ExtensionMemberResolver._isValidContext has cyclomatic complexity 20 (threshold 15). 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.
_ErrorHelper.reportNullOrNonTypeElement (cyclomatic 20) pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart:709— _ErrorHelper.reportNullOrNonTypeElement has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
SimpleIdentifierResolver._resolve2 (cyclomatic 20) pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart:195— SimpleIdentifierResolver._resolve2 has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
NullSafetyDeadCodeVerifier._verifyUnassignedSimpleIdentifier (cyclomatic 20) pkg/analyzer/lib/src/error/dead_code_verifier.dart:474— NullSafetyDeadCodeVerifier._verifyUnassignedSimpleIdentifier 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.
ErrorVerifier._checkForMixinClassErrorCodes (cyclomatic 20) pkg/analyzer/lib/src/generated/error_verifier.dart:6566— ErrorVerifier._checkForMixinClassErrorCodes 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.
ErrorVerifier._checkForMixinWithConflictingPrivateMember (cyclomatic 20) pkg/analyzer/lib/src/generated/error_verifier.dart:6801— ErrorVerifier._checkForMixinWithConflictingPrivateMember 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.
FfiVerifier._validateFieldsInCompound (cyclomatic 20) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1815— FfiVerifier._validateFieldsInCompound 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.
FfiVerifier._validateSizeOfAnnotation (cyclomatic 20) pkg/analyzer/lib/src/generated/ffi_verifier.dart:2425— FfiVerifier._validateSizeOfAnnotation 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.
SuperContext.of (cyclomatic 20) pkg/analyzer/lib/src/generated/super_context.dart:36— SuperContext.of 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.
ElementBuilder._buildInstanceElementMembers (cyclomatic 20) pkg/analyzer/lib/src/summary2/element_builder.dart:95— ElementBuilder._buildInstanceElementMembers 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.
DartEditBuilderImpl.writeOverride (cyclomatic 20) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:605— DartEditBuilderImpl.writeOverride 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.
AnalysisOptionLinkComputer.findLinks (cyclomatic 20) pkg/analyzer_plugin/lib/src/utilities/navigation/document_links.dart:26— AnalysisOptionLinkComputer.findLinks 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.
_Builder.build (cyclomatic 20) pkg/compiler/lib/src/deferred_load/program_split_constraints/builder.dart:79— _Builder.build 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.
CodegenEnqueuer.processTypeUse (cyclomatic 20) pkg/compiler/lib/src/js_backend/enqueuer.dart:194— CodegenEnqueuer.processTypeUse 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. This is NOT this file's highest cyclomatic complexity: CodegenEnqueuer.processStaticUse (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
JsKernelToElementMap.readFromDataSource (cyclomatic 20) pkg/compiler/lib/src/js_model/element_map_impl.dart:275— JsKernelToElementMap.readFromDataSource 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.
SsaCodeGenerator.visitInvokeExternal (cyclomatic 20) pkg/compiler/lib/src/ssa/codegen.dart:2901— SsaCodeGenerator.visitInvokeExternal 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.
SsaLoadElimination.visitBasicBlock (cyclomatic 20) pkg/compiler/lib/src/ssa/optimize.dart:4439— SsaLoadElimination.visitBasicBlock 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.
CodegenWorldBuilder._getMemberUsage (cyclomatic 20) pkg/compiler/lib/src/universe/codegen_world_builder.dart:495— CodegenWorldBuilder._getMemberUsage 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. This is NOT this file's highest cyclomatic complexity: CodegenWorldBuilder.registerStaticUse (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ResolutionWorldBuilder._processMemberInUsedClass (cyclomatic 20) pkg/compiler/lib/src/universe/resolution_world_builder.dart:886— ResolutionWorldBuilder._processMemberInUsedClass 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.
MigrateCommand.run (cyclomatic 20) pkg/dartdev/lib/src/commands/migrate.dart:56— MigrateCommand.run 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.
ProgramCompiler._emitImports (cyclomatic 20) pkg/dev_compiler/lib/src/kernel/compiler.dart:8916— ProgramCompiler._emitImports 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.
LibraryCompiler._emitClassDeclaration (cyclomatic 20) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1463— LibraryCompiler._emitClassDeclaration 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.
LibraryCompiler._emitLibraryMembers (cyclomatic 20) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4054— LibraryCompiler._emitLibraryMembers 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.
IncrementalCompiler.updateNeededDillLibrariesWithHierarchy (cyclomatic 20) pkg/front_end/lib/src/base/incremental_compiler.dart:1605— IncrementalCompiler.updateNeededDillLibrariesWithHierarchy 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.
FactoryEncoding.inferRedirectionTarget (cyclomatic 20) pkg/front_end/lib/src/fragment/factory/encoding.dart:225— FactoryEncoding.inferRedirectionTarget 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.
FactoryEncoding.resolveRedirectingFactory (cyclomatic 20) pkg/front_end/lib/src/fragment/factory/encoding.dart:368— FactoryEncoding.resolveRedirectingFactory 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.
BodyBuilderImpl.endFormalParameters (cyclomatic 20) pkg/front_end/lib/src/kernel/body_builder.dart:3944— BodyBuilderImpl.endFormalParameters 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.
_InitializerBuilder.processInitializers (cyclomatic 20) pkg/front_end/lib/src/kernel/resolver_helpers.dart:235— _InitializerBuilder.processInitializers 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.
SourceClassBuilder.checkMethodOverride (cyclomatic 20) pkg/front_end/lib/src/source/source_class_builder.dart:1890— SourceClassBuilder.checkMethodOverride 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.
SourceLoader._createSourceCompilationUnit (cyclomatic 20) pkg/front_end/lib/src/source/source_loader.dart:486— SourceLoader._createSourceCompilationUnit 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.
FrontendServerClient.start (cyclomatic 20) pkg/frontend_server_client/lib/src/frontend_server_client.dart:33— FrontendServerClient.start has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
FrontendServerClient.compile (cyclomatic 20) pkg/frontend_server_client/lib/src/frontend_server_client.dart:178— FrontendServerClient.compile 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.
MiniJsParser.getString (cyclomatic 20) pkg/js_ast/lib/src/builder.dart:579— MiniJsParser.getString 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.
DartTypeEquivalence.visitFunctionType (cyclomatic 20) pkg/kernel/lib/src/dart_type_equivalence.dart:43— DartTypeEquivalence.visitFunctionType 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.
_Visitor._checkTopLevelFragment (cyclomatic 20) pkg/linter/lib/src/rules/analyzer_public_api.dart:162— _Visitor._checkTopLevelFragment has cyclomatic complexity 20 (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.
_Visitor.visitSwitchCase (cyclomatic 20) pkg/linter/lib/src/rules/invalid_case_patterns.dart:49— _Visitor.visitSwitchCase 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.
_Visitor.visitInstanceCreationExpression (cyclomatic 20) pkg/linter/lib/src/rules/prefer_collection_literals.dart:40— _Visitor.visitInstanceCreationExpression 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.
_Visitor._visitVariableDeclarationList (cyclomatic 20) pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart:59— _Visitor._visitVariableDeclarationList 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.
_LineNumberContentType.validate (cyclomatic 20) pkg/native_stack_traces/lib/src/dwarf.dart:1070— _LineNumberContentType.validate 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. This is NOT this file's highest cyclomatic complexity: _AttributeForm.read (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
TreeMap._createTreemapTile (cyclomatic 20) pkg/observatory/lib/src/elements/tree_map.dart:32— TreeMap._createTreemapTile 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.
NameSection.deserialize (cyclomatic 20) pkg/wasm_builder/lib/src/serialize/sections.dart:1043— NameSection.deserialize has cyclomatic complexity 20 (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.
WidgetCreatorTracker._resolveWellKnownClasses (cyclomatic 20) pkg/kernel/lib/transformations/track_widget_constructor_locations.dart:389— WidgetCreatorTracker._resolveWellKnownClasses 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.
Summary.apply (cyclomatic 20) pkg/vm/lib/transformations/type_flow/summary.dart:1066— Summary.apply 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.
_TreeShakerPass2.defaultMember (cyclomatic 20) pkg/vm/lib/transformations/type_flow/transformer.dart:2321— _TreeShakerPass2.defaultMember 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.
graphexplorer.createTreemapTile (cyclomatic 20) runtime/tools/graphexplorer/graphexplorer.js:1279— graphexplorer.createTreemapTile has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
_ImplGenerator.generate (cyclomatic 19) pkg/analyzer/tool/summary/generate.dart:960— _ImplGenerator.generate 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.
GraphIsomorphizer.generateRootImport (cyclomatic 19) pkg/compiler/tool/graph_isomorphizer.dart:189— GraphIsomorphizer.generateRootImport 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.
Component.write (cyclomatic 19) pkg/dart2bytecode/lib/declarations.dart:1420— Component.write has cyclomatic complexity 19 (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.
_ConstObjectHandle.== (cyclomatic 19) pkg/dart2bytecode/lib/object_table.dart:1497— _ConstObjectHandle.== 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. This is NOT this file's highest cyclomatic complexity: ObjectHandle._empty (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
AstCodeGenerator._setupLocalParameters (cyclomatic 19) pkg/dart2wasm/lib/code_generator.dart:248— AstCodeGenerator._setupLocalParameters 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.
ConstructorInitializerCodeGenerator.generateInitializerList (cyclomatic 19) pkg/dart2wasm/lib/code_generator.dart:4353— ConstructorInitializerCodeGenerator.generateInitializerList has cyclomatic complexity 19 (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.
FunctionCollector.getFunction (cyclomatic 19) pkg/dart2wasm/lib/functions.dart:90— FunctionCollector.getFunction has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Types.isTypeConstant (cyclomatic 19) pkg/dart2wasm/lib/types.dart:121— Types.isTypeConstant has cyclomatic complexity 19 (threshold 15). 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.
C.m (cyclomatic 19) pkg/front_end/testcases/general/for_in_without_declaration.dart:21— C.m has cyclomatic complexity 19 (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.
Analysis.transitiveGraph (cyclomatic 19) pkg/heap_snapshot/lib/analysis.dart:259— Analysis.transitiveGraph 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.
_StringBase.createFromCharCodes (cyclomatic 19) sdk/lib/_internal/vm/lib/string_patch.dart:115— _StringBase.createFromCharCodes 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.
_BigIntImpl._divRem (cyclomatic 19) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1477— _BigIntImpl._divRem 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.
_TypeUniverse.isFunctionSubtype (cyclomatic 19) sdk/lib/_internal/wasm/common/type.dart:1212— _TypeUniverse.isFunctionSubtype 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.
MultiBinaryLoader.load (cyclomatic 19) pkg/kernel/lib/binary/multi_binary_loader.dart:53— MultiBinaryLoader.load 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.
Object.hash (cyclomatic 19) sdk/lib/core/object.dart:152— Object.hash has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Uri._makeHttpUri (cyclomatic 19) sdk/lib/core/uri.dart:2053— _Uri._makeHttpUri 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.
_Uri.replace (cyclomatic 19) sdk/lib/core/uri.dart:2282— _Uri.replace has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ConstantFolding.binaryIntOp (cyclomatic 19) pkg/cfg/lib/ir/constant_value.dart:125— ConstantFolding.binaryIntOp 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.
ConstantFolding.unaryDoubleOp (cyclomatic 19) pkg/cfg/lib/ir/constant_value.dart:208— ConstantFolding.unaryDoubleOp 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.
Parser.parseImportRecovery (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:994— Parser.parseImportRecovery 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.parseRecordType (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:1735— Parser.parseRecordType 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.parseParenthesizedExpressionOrRecordLiteral (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8293— Parser.parseParenthesizedExpressionOrRecordLiteral 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.parseLiteralSetOrMapSuffix (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8555— Parser.parseLiteralSetOrMapSuffix 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.parseConstExpression (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9015— Parser.parseConstExpression 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.parseSend (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9337— Parser.parseSend 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.computeTypeAfterIsOrAs (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9647— Parser.computeTypeAfterIsOrAs has cyclomatic complexity 19 (threshold 15). 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.
Parser.parseTryStatement (cyclomatic 19) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:10709— Parser.parseTryStatement 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.
JsUtilOptimizer._getPrefixSelectorsForStaticallyResolvableMember (cyclomatic 19) pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart:301— JsUtilOptimizer._getPrefixSelectorsForStaticallyResolvableMember 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.
_DartUnitHighlightsComputerVisitor._findEscapes (cyclomatic 19) pkg/analysis_server/lib/src/computer/computer_highlights.dart:2088— _DartUnitHighlightsComputerVisitor._findEscapes 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.
DartCodeActionsProducer.getRefactorActions (cyclomatic 19) pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart:306— DartCodeActionsProducer.getRefactorActions 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.
EditArgumentHandler._writeNewArgument (cyclomatic 19) pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart:384— EditArgumentHandler._writeNewArgument 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.
SummaryWriter.summarize (cyclomatic 19) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart:71— SummaryWriter.summarize 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.
PluginWatcher._addPlugins (cyclomatic 19) pkg/analysis_server/lib/src/plugin/plugin_watcher.dart:126— PluginWatcher._addPlugins has cyclomatic complexity 19 (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.
DevAnalysisServer.processDirectories (cyclomatic 19) pkg/analysis_server/lib/src/server/dev_server.dart:37— DevAnalysisServer.processDirectories has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DeclarationHelper.addLexicalDeclarations (cyclomatic 19) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:440— DeclarationHelper.addLexicalDeclarations has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DeclarationHelper._addInheritedMembers (cyclomatic 19) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1119— DeclarationHelper._addInheritedMembers 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.
KeywordHelper.addFieldDeclarationKeywords (cyclomatic 19) pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart:444— KeywordHelper.addFieldDeclarationKeywords 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.
StatementCompletionProcessor._complete_tryStatement (cyclomatic 19) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:1029— StatementCompletionProcessor._complete_tryStatement 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.
AddAwait.compute (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/add_await.dart:46— AddAwait.compute 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.
AddKeyToConstructors._updateSuper (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart:247— AddKeyToConstructors._updateSuper 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.
AddMissingEnumCaseClauses.compute (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart:26— AddMissingEnumCaseClauses.compute 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.
AddNullCheck._computeTargetAndNullAwareToken (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart:225— AddNullCheck._computeTargetAndNullAwareToken has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_EnumDescription._removeUnnamedConstructor (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:369— _EnumDescription._removeUnnamedConstructor 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.
ConvertForEachToForLoop.compute (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart:28— ConvertForEachToForLoop.compute 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.
ConvertToWildcardVariable.compute (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_variable.dart:37— ConvertToWildcardVariable.compute 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.
CreateExtensionSetter.compute (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:511— CreateExtensionSetter.compute has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CreateMethod._createMethodFromMethodInvocation (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/create_method.dart:127— CreateMethod._createMethodFromMethodInvocation 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.
_CreateMixin.compute (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart:125— _CreateMixin.compute 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.
PubspecFixGenerator.computeFixes (cyclomatic 19) pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart:75— PubspecFixGenerator.computeFixes has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AnalysisDriver._analyzeFileImpl (cyclomatic 19) pkg/analyzer/lib/src/dart/analysis/driver.dart:1340— AnalysisDriver._analyzeFileImpl 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.
AnalysisDriver._produceErrors (cyclomatic 19) pkg/analyzer/lib/src/dart/analysis/driver.dart:2132— AnalysisDriver._produceErrors 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.
_ConstLiteralVerifier._validateMapLiteralEntry (cyclomatic 19) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1475— _ConstLiteralVerifier._validateMapLiteralEntry 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.
ConstantEvaluationEngine.computeConstantValue (cyclomatic 19) pkg/analyzer/lib/src/dart/constant/evaluation.dart:84— ConstantEvaluationEngine.computeConstantValue 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.
_ConstructorInvocationEvaluator.evaluate (cyclomatic 19) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3684— _ConstructorInvocationEvaluator.evaluate 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.
TypeSystemImpl.isMoreBottom (cyclomatic 19) pkg/analyzer/lib/src/dart/element/type_system.dart:1039— TypeSystemImpl.isMoreBottom has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
TypeSystemImpl.isMoreTop (cyclomatic 19) pkg/analyzer/lib/src/dart/element/type_system.dart:1123— TypeSystemImpl.isMoreTop has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
TypeSystemImpl._refineNumericInvocationContextNullSafe (cyclomatic 19) pkg/analyzer/lib/src/dart/element/type_system.dart:1953— TypeSystemImpl._refineNumericInvocationContextNullSafe 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.
AstRewriter._prepareReceiverInvocation (cyclomatic 19) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:955— AstRewriter._prepareReceiverInvocation 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.
PrefixedIdentifierResolver.resolve (cyclomatic 19) pkg/analyzer/lib/src/dart/resolver/prefixed_identifier_resolver.dart:24— PrefixedIdentifierResolver.resolve has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
PropertyElementResolver._resolveUnqualifiedNameRead (cyclomatic 19) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:2552— PropertyElementResolver._resolveUnqualifiedNameRead 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.
ResolutionVisitor._resolveType (cyclomatic 19) pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart:1251— ResolutionVisitor._resolveType 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.
AnnotationVerifier._checkVisibility (cyclomatic 19) pkg/analyzer/lib/src/error/annotation_verifier.dart:536— AnnotationVerifier._checkVisibility 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.
BestPracticesVerifier._checkForUnnecessaryNoSuchMethod (cyclomatic 19) pkg/analyzer/lib/src/error/best_practices_verifier.dart:1456— BestPracticesVerifier._checkForUnnecessaryNoSuchMethod 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.
ElementUsageDetectorV2.checkUsage (cyclomatic 19) pkg/analyzer/lib/src/error/element_usage_detector.dart:556— ElementUsageDetectorV2.checkUsage 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.
IgnoreValidator.reportErrors (cyclomatic 19) pkg/analyzer/lib/src/error/ignore_validator.dart:72— IgnoreValidator.reportErrors 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.
LiteralElementVerifier._verifyElement (cyclomatic 19) pkg/analyzer/lib/src/error/literal_element_verifier.dart:88— LiteralElementVerifier._verifyElement 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.
AstBuilder.buildInitializer (cyclomatic 19) pkg/analyzer/lib/src/fasta/ast_builder.dart:639— AstBuilder.buildInitializer 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.
ResolverVisitor.checkForBodyMayCompleteNormally (cyclomatic 19) pkg/analyzer/lib/src/generated/resolver.dart:573— ResolverVisitor.checkForBodyMayCompleteNormally 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.
FuzzyMatcher.fuzzyMap (cyclomatic 19) pkg/analyzer/lib/src/utilities/fuzzy_matcher.dart:298— FuzzyMatcher.fuzzyMap 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.
DartFileEditBuilderImpl._insertDocImportIntoBlockDocComment (cyclomatic 19) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:3094— DartFileEditBuilderImpl._insertDocImportIntoBlockDocComment 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.
DeferredLoadTask.dump (cyclomatic 19) pkg/compiler/lib/src/deferred_load/deferred_load.dart:585— DeferredLoadTask.dump 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.
InferrerEngine.analyze (cyclomatic 19) pkg/compiler/lib/src/inferrer/engine.dart:676— InferrerEngine.analyze 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.
DynamicCallSiteTypeInformation.computeType (cyclomatic 19) pkg/compiler/lib/src/inferrer/type_graph_nodes.dart:1431— DynamicCallSiteTypeInformation.computeType 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.
CommonMasks._createFromStaticType (cyclomatic 19) pkg/compiler/lib/src/inferrer/typemasks/masks.dart:332— CommonMasks._createFromStaticType 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.
ProgramBuilder._buildMethod (cyclomatic 19) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:965— ProgramBuilder._buildMethod 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.
NativeBehavior.processEffects (cyclomatic 19) pkg/compiler/lib/src/native/behavior.dart:503— NativeBehavior.processEffects has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CompilerOptions.deriveOptions (cyclomatic 19) pkg/compiler/lib/src/options.dart:1077— CompilerOptions.deriveOptions has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DominatedUses._compute (cyclomatic 19) pkg/compiler/lib/src/ssa/nodes.dart:1655— DominatedUses._compute 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.
SsaInstructionSimplifier.visitParameterValue (cyclomatic 19) pkg/compiler/lib/src/ssa/optimize.dart:676— SsaInstructionSimplifier.visitParameterValue 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.
CompileNativeCommand.run (cyclomatic 19) pkg/dartdev/lib/src/commands/compile.dart:639— CompileNativeCommand.run 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.
Debugger._pauseHandler (cyclomatic 19) pkg/dwds/lib/src/debugging/debugger.dart:544— Debugger._pauseHandler 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.
IncrementalCompiler.computeDelta (cyclomatic 19) pkg/front_end/lib/src/base/incremental_compiler.dart:318— IncrementalCompiler.computeDelta has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
IncrementalCompiler.compileExpression (cyclomatic 19) pkg/front_end/lib/src/base/incremental_compiler.dart:2002— IncrementalCompiler.compileExpression 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.
_InitializationFromUri._initializeFromDill (cyclomatic 19) pkg/front_end/lib/src/base/incremental_compiler.dart:3481— _InitializationFromUri._initializeFromDill 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.
NamedTypeBuilderImpl.computeTypeParameterBuilderVariance (cyclomatic 19) pkg/front_end/lib/src/builder/named_type_builder.dart:860— NamedTypeBuilderImpl.computeTypeParameterBuilderVariance has cyclomatic complexity 19 (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. This is NOT this file's highest cyclomatic complexity: NamedTypeBuilderImpl._checkDeferred (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
KernelTarget.installForwardingConstructors (cyclomatic 19) pkg/front_end/lib/src/kernel/kernel_target.dart:920— KernelTarget.installForwardingConstructors 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.
SourceLibraryBuilder._buildOutlineNodes (cyclomatic 19) pkg/front_end/lib/src/source/source_library_builder.dart:1071— SourceLibraryBuilder._buildOutlineNodes 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. This is NOT this file's highest cyclomatic complexity: SourceLibraryBuilder.checkPendingBoundsChecks (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
VerifyingAnalysis.run (cyclomatic 19) pkg/front_end/lib/src/testing/verifying_analysis.dart:29— VerifyingAnalysis.run 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.
InferenceVisitorBase._inferInstanceMethodInvocation (cyclomatic 19) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3036— InferenceVisitorBase._inferInstanceMethodInvocation has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorBase._tearOffCall (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
IncrementalJavaScriptBundler.compile (cyclomatic 19) pkg/frontend_server/lib/src/javascript_bundle.dart:252— IncrementalJavaScriptBundler.compile 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.
MiniJsParser.parsePrimary (cyclomatic 19) pkg/js_ast/lib/src/builder.dart:790— MiniJsParser.parsePrimary 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.
FunctionType.equals (cyclomatic 19) pkg/kernel/lib/src/ast/types.dart:1414— FunctionType.equals 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.
_Visitor._problemsForAnalyzerPublicApi (cyclomatic 19) pkg/linter/lib/src/rules/analyzer_public_api.dart:362— _Visitor._problemsForAnalyzerPublicApi has cyclomatic complexity 19 (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.
FileInfo.fromReaderDwarf5 (cyclomatic 19) pkg/native_stack_traces/lib/src/dwarf.dart:1153— FileInfo.fromReaderDwarf5 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. This is NOT this file's highest cyclomatic complexity: _AttributeForm.read (cyclomatic 31) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
VirtualCollectionElement.render (cyclomatic 19) pkg/observatory/lib/src/elements/containers/virtual_collection.dart:144— VirtualCollectionElement.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.
_DispatchableInvocation.process (cyclomatic 19) pkg/vm/lib/transformations/type_flow/analysis.dart:538— _DispatchableInvocation.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.
MoveFieldInitializers.transformClass (cyclomatic 19) pkg/vm/lib/transformations/type_flow/transformer.dart:221— MoveFieldInitializers.transformClass 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.
graphexplorer.Graph.rewriteEdgesForOwners (cyclomatic 19) runtime/tools/graphexplorer/graphexplorer.js:381— graphexplorer.Graph.rewriteEdgesForOwners 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.
JsInteropChecks._checkDisallowedTearoff (cyclomatic 18) pkg/_js_interop_checks/lib/js_interop_checks.dart:685— JsInteropChecks._checkDisallowedTearoff 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.
DartLanguageServerBenchmark._launch (cyclomatic 18) pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart:256— DartLanguageServerBenchmark._launch 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.
LogEntry.from (cyclomatic 18) pkg/analysis_server/tool/instrumentation/log/log.dart:573— LogEntry.from has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AstNodeImplGenerator._generateBeginToken (cyclomatic 18) pkg/analyzer/tool/generators/ast_generator.dart:306— AstNodeImplGenerator._generateBeginToken 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.
_ErrorCodeDocumentationParser.processCodeBlock (cyclomatic 18) pkg/analyzer/tool/messages/error_code_documentation_info.dart:173— _ErrorCodeDocumentationParser.processCodeBlock 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.
BytecodeGenerator.getClassDeclaration (cyclomatic 18) pkg/dart2bytecode/lib/bytecode_generator.dart:313— BytecodeGenerator.getClassDeclaration has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: BytecodeGenerator._genMethodInvocationUsingSpecializedBytecode (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
FieldDeclaration.toString (cyclomatic 18) pkg/dart2bytecode/lib/declarations.dart:491— FieldDeclaration.toString has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ClassInfoCollector._createStructForClass (cyclomatic 18) pkg/dart2wasm/lib/class_info.dart:381— ClassInfoCollector._createStructForClass 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.
StateMachineCodeGenerator.visitSwitchStatement (cyclomatic 18) pkg/dart2wasm/lib/state_machine.dart:970— StateMachineCodeGenerator.visitSwitchStatement 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.
Expect.stringEquals (cyclomatic 18) pkg/expect/lib/expect.dart:490— Expect.stringEquals has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ClosedWorldClassHierarchy._buildDeclaredMembers (cyclomatic 18) pkg/kernel/lib/class_hierarchy.dart:1636— ClosedWorldClassHierarchy._buildDeclaredMembers 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.
NaiveTypeChecker._checkFunctionOverride (cyclomatic 18) pkg/kernel/lib/naive_type_checker.dart:163— NaiveTypeChecker._checkFunctionOverride 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.
_SnapshotGraph._readObjects (cyclomatic 18) pkg/observatory/lib/object_graph.dart:969— _SnapshotGraph._readObjects 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.
_Recorder.record (cyclomatic 18) pkg/perf_witness/lib/recorder.dart:117— _Recorder.record 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.
Configuration.toString (cyclomatic 18) pkg/smith/lib/configuration.dart:640— Configuration.toString has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: Architecture._computeHost (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
BoxedDouble.computeRemainder (cyclomatic 18) sdk/lib/_internal/wasm/common/boxed_double.dart:83— BoxedDouble.computeRemainder 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.
Arm64CodeGenerator.visitAllocateArray (cyclomatic 18) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2128— Arm64CodeGenerator.visitAllocateArray 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. This is NOT this file's highest cyclomatic complexity: Arm64CodeGenerator.visitComparison (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
LinearScanRegisterAllocator.allocateBlockedRegister (cyclomatic 18) pkg/native_compiler/lib/back_end/register_allocator.dart:746— LinearScanRegisterAllocator.allocateBlockedRegister 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.
_Uri._normalizeZoneID (cyclomatic 18) sdk/lib/core/uri.dart:2468— _Uri._normalizeZoneID 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.
CorrectionUtils._invertCondition0 (cyclomatic 18) pkg/analysis_server_plugin/lib/edit/correction_utils.dart:348— CorrectionUtils._invertCondition0 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.
_StructuredClone.walk (cyclomatic 18) sdk/lib/html/html_common/conversions.dart:87— _StructuredClone.walk has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
NativeTypeCfe.NativeTypeCfe (cyclomatic 18) pkg/vm/lib/modular/transformations/ffi/native_type_cfe.dart:19— NativeTypeCfe.NativeTypeCfe 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.
Parser._computePrecedence (cyclomatic 18) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7726— Parser._computePrecedence 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
IdValue.decode (cyclomatic 18) pkg/_fe_analyzer_shared/lib/src/testing/id.dart:128— IdValue.decode has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Writer._typeAnnotationToText (cyclomatic 18) pkg/_fe_analyzer_shared/lib/src/testing/metadata_helper.dart:364— Writer._typeAnnotationToText 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. This is NOT this file's highest cyclomatic complexity: Writer._expressionToText (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ParsedOptions.parse (cyclomatic 18) pkg/_fe_analyzer_shared/lib/src/util/options.dart:39— ParsedOptions.parse 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.
DartUnitSignatureComputer.compute (cyclomatic 18) pkg/analysis_server/lib/src/computer/computer_signature.dart:27— DartUnitSignatureComputer.compute 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.
ContextManagerImpl._handleWatchEvent (cyclomatic 18) pkg/analysis_server/lib/src/context_manager.dart:952— ContextManagerImpl._handleWatchEvent 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.
AbstractNotificationManager.setSubscriptions (cyclomatic 18) pkg/analysis_server/lib/src/plugin/notification_manager.dart:302— AbstractNotificationManager.setSubscriptions 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.
DeclarationHelper._addExtensionMembers (cyclomatic 18) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:857— DeclarationHelper._addExtensionMembers 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.
DeclarationHelper._addExternalTopLevelDeclarations (cyclomatic 18) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:934— DeclarationHelper._addExternalTopLevelDeclarations 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.
DeclarationHelper._suggestStaticField (cyclomatic 18) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2729— DeclarationHelper._suggestStaticField 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.
StatementCompletionProcessor._complete_forStatement (cyclomatic 18) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:626— StatementCompletionProcessor._complete_forStatement 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.
AddDiagnosticPropertyReference._getPropertyInfo (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart:345— AddDiagnosticPropertyReference._getPropertyInfo has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ConvertToBooleanExpression.compute (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart:28— ConvertToBooleanExpression.compute 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.
ConvertToInBodyConstructor._convertPrimaryConstructorInBlockBody (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/convert_to_in_body_constructor.dart:101— ConvertToInBodyConstructor._convertPrimaryConstructorInBlockBody 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.
CreateField._proposeFromIdentifier (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/create_field.dart:147— CreateField._proposeFromIdentifier 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.
CreateGetter.compute (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/create_getter.dart:130— CreateGetter.compute 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.
CreateParameter.compute (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/create_parameter.dart:29— CreateParameter.compute has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
MakeFieldPublic.compute (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart:33— MakeFieldPublic.compute 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.
RemoveUnexpectedUnderscores.compute (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/remove_unexpected_underscores.dart:26— RemoveUnexpectedUnderscores.compute 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.
SimplifyDirectivePath.compute (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/dart/simplify_directive_path.dart:26— SimplifyDirectivePath.compute has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ImportOrganizer._organizeDocImportsInBlockComment (cyclomatic 18) pkg/analysis_server/lib/src/services/correction/organize_imports.dart:344— ImportOrganizer._organizeDocImportsInBlockComment 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.
ExtractMethodRefactoringImpl._checkSelection (cyclomatic 18) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:489— ExtractMethodRefactoringImpl._checkSelection 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.
_IndexContributor.recordRelationOffset (cyclomatic 18) pkg/analyzer/lib/src/dart/analysis/index.dart:576— _IndexContributor.recordRelationOffset has cyclomatic complexity 18 (threshold 15). 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.
ConstantVisitor._getDeferredLibraryError (cyclomatic 18) pkg/analyzer/lib/src/dart/constant/evaluation.dart:2191— ConstantVisitor._getDeferredLibraryError has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AstRewriter.prefixedIdentifier (cyclomatic 18) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:497— AstRewriter.prefixedIdentifier has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
MethodInvocationResolver.resolve (cyclomatic 18) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:70— MethodInvocationResolver.resolve 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.
TypedLiteralResolver._inferCollectionElementType (cyclomatic 18) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:366— TypedLiteralResolver._inferCollectionElementType 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.
AstBuilder.doDotExpression (cyclomatic 18) pkg/analyzer/lib/src/fasta/ast_builder.dart:859— AstBuilder.doDotExpression 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.
LibraryManifestBuilder._fillInterfaceElementInterface (cyclomatic 18) pkg/analyzer/lib/src/fine/library_manifest.dart:1338— LibraryManifestBuilder._fillInterfaceElementInterface 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.
FragmentBuilder.visitPrimaryConstructorDeclaration (cyclomatic 18) pkg/analyzer/lib/src/summary2/element_builder.dart:2027— FragmentBuilder.visitPrimaryConstructorDeclaration 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.
Linker._buildExportScopes (cyclomatic 18) pkg/analyzer/lib/src/summary2/link.dart:161— Linker._buildExportScopes has cyclomatic complexity 18 (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.
_PropertyInducingElementTypeInference.perform (cyclomatic 18) pkg/analyzer/lib/src/summary2/top_level_inference.dart:213— _PropertyInducingElementTypeInference.perform 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.
TypesBuilder._declaration (cyclomatic 18) pkg/analyzer/lib/src/summary2/types_builder.dart:152— TypesBuilder._declaration has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartEditBuilderImpl.writeFormalParameters (cyclomatic 18) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:347— DartEditBuilderImpl.writeFormalParameters 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.
CompletionTarget.forOffset (cyclomatic 18) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:140— CompletionTarget.forOffset 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.
_OpTypeAstVisitor._argumentListContext (cyclomatic 18) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:1856— _OpTypeAstVisitor._argumentListContext has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ElementInfoCollector.visitClass (cyclomatic 18) pkg/compiler/lib/src/dump_info.dart:561— ElementInfoCollector.visitClass has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DumpInfoAnnotator.visitClass (cyclomatic 18) pkg/compiler/lib/src/dump_info.dart:1348— DumpInfoAnnotator.visitClass has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ResolutionEnqueuerListener.registerUsedElement (cyclomatic 18) pkg/compiler/lib/src/js_backend/resolution_listener.dart:293— ResolutionEnqueuerListener.registerUsedElement 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.
KernelSsaGraphBuilder._buildParameterStub (cyclomatic 18) pkg/compiler/lib/src/ssa/builder.dart:1383— KernelSsaGraphBuilder._buildParameterStub has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
InlineData.cannotBeInlinedReductiveReason (cyclomatic 18) pkg/compiler/lib/src/ssa/builder.dart:9044— InlineData.cannotBeInlinedReductiveReason has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
TestAdapter.sendTestTextOutput (cyclomatic 18) pkg/dap_adapters/lib/src/adapters/mixins.dart:93— TestAdapter.sendTestTextOutput 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.
BuildCliSubcommand.run (cyclomatic 18) pkg/dartdev/lib/src/commands/build.dart:192— BuildCliSubcommand.run has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExecutableCompiler.isSnapshotFresh (cyclomatic 18) pkg/dartdev/lib/src/executable_compiler.dart:131— ExecutableCompiler.isSnapshotFresh 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.
ProgramCompiler.emitModule (cyclomatic 18) pkg/dev_compiler/lib/src/kernel/compiler.dart:651— ProgramCompiler.emitModule has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ProgramCompiler._emitClassDeclaration (cyclomatic 18) pkg/dev_compiler/lib/src/kernel/compiler.dart:1170— ProgramCompiler._emitClassDeclaration 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.
IncrementalCompiler._computeExpressionCompilationExtensionData (cyclomatic 18) pkg/front_end/lib/src/base/incremental_compiler.dart:2393— IncrementalCompiler._computeExpressionCompilationExtensionData 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.
BodyBuilderImpl.createFieldInitializer (cyclomatic 18) pkg/front_end/lib/src/kernel/body_builder.dart:2234— BodyBuilderImpl.createFieldInitializer 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.
ConstantEvaluator.visitConstructorInvocation (cyclomatic 18) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3533— ConstantEvaluator.visitConstructorInvocation has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ClassHierarchyNodeBuilder.build (cyclomatic 18) pkg/front_end/lib/src/kernel/hierarchy/hierarchy_node.dart:128— ClassHierarchyNodeBuilder.build 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.
Covariance.== (cyclomatic 18) pkg/front_end/lib/src/kernel/member_covariance.dart:366— Covariance.== 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.
OutlineBuilder.endConstructor (cyclomatic 18) pkg/front_end/lib/src/source/outline_builder.dart:2591— OutlineBuilder.endConstructor has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: OutlineBuilder._createOmittedParameterTypeBuilder (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_Visitor._checkConstant (cyclomatic 18) pkg/linter/lib/src/rules/prefer_contains.dart:73— _Visitor._checkConstant 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.
_Visitor.visitBinaryExpression (cyclomatic 18) pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart:37— _Visitor.visitBinaryExpression has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Visitor._checkForConvertiblePositionalParams (cyclomatic 18) pkg/linter/lib/src/rules/use_super_parameters.dart:157— _Visitor._checkForConvertiblePositionalParams 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.
DebuggerInputElement._onKeyDown (cyclomatic 18) pkg/observatory/lib/src/elements/debugger.dart:3258— DebuggerInputElement._onKeyDown 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.
InstanceRef.toJson (cyclomatic 18) pkg/vm_service/lib/src/vm_service.dart:5166— InstanceRef.toJson has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
WidgetCreatorTracker._transformWidgetConstructors (cyclomatic 18) pkg/kernel/lib/transformations/track_widget_constructor_locations.dart:771— WidgetCreatorTracker._transformWidgetConstructors 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.
_DirectInvocation._processField (cyclomatic 18) pkg/vm/lib/transformations/type_flow/analysis.dart:313— _DirectInvocation._processField 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.
TableSelectorAssigner._memberIdsForClass (cyclomatic 18) pkg/vm/lib/transformations/type_flow/table_selector_assigner.dart:45— TableSelectorAssigner._memberIdsForClass 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.
AnnotateKernel._annotateMember (cyclomatic 18) pkg/vm/lib/transformations/type_flow/transformer.dart:714— AnnotateKernel._annotateMember 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.
build_devtools.main (cyclomatic 18) tools/build_devtools.py:17— build_devtools.main has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
Emitter._ParseTemplate (cyclomatic 18) tools/dom/scripts/emitter.py:142— Emitter._ParseTemplate 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.
idlsync.copy_files (cyclomatic 18) tools/dom/scripts/idlsync.py:157— idlsync.copy_files 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.
DartiumBackend._AddGetter (cyclomatic 18) tools/dom/scripts/systemnative.py:558— DartiumBackend._AddGetter has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LibraryLoader.load (cyclomatic 18) REDACTED:214— LibraryLoader.load has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
D3SymbolTreeMap.D3SymbolTreeMap._handleInodes (cyclomatic 18) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:382— D3SymbolTreeMap.D3SymbolTreeMap._handleInodes has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 429, 464, 533, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
RemoveLastFormalParameterMutation._deletionForLast (cyclomatic 17) pkg/analyzer/tool/fine/ab_mutate/mutations/impl/remove_last_formal_parameter.dart:49— RemoveLastFormalParameterMutation._deletionForLast 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.
AstNodeImplGenerator._generateFields (cyclomatic 17) pkg/analyzer/tool/generators/ast_generator.dart:766— AstNodeImplGenerator._generateFields 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.
BytecodeGenerator.getClosureDeclaration (cyclomatic 17) pkg/dart2bytecode/lib/bytecode_generator.dart:2681— BytecodeGenerator.getClosureDeclaration 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. This is NOT this file's highest cyclomatic complexity: BytecodeGenerator._genMethodInvocationUsingSpecializedBytecode (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
SelectorInfo._computeSignature (cyclomatic 17) pkg/dart2wasm/lib/dispatch_table.dart:111— SelectorInfo._computeSignature 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.
Translator.getClosure (cyclomatic 17) pkg/dart2wasm/lib/translator.dart:1343— Translator.getClosure has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: Translator.toMostSpecificInterfaceType (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
AstCompilationTask.run (cyclomatic 17) pkg/dart2wasm/lib/translator.dart:2753— AstCompilationTask.run 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. This is NOT this file's highest cyclomatic complexity: Translator.toMostSpecificInterfaceType (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ClosedWorldClassHierarchy._getLegacyLeastUpperBoundInternal (cyclomatic 17) pkg/kernel/lib/class_hierarchy.dart:961— ClosedWorldClassHierarchy._getLegacyLeastUpperBoundInternal 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.
TypeCheckingVisitor.getReceiverType (cyclomatic 17) pkg/kernel/lib/type_checker.dart:319— TypeCheckingVisitor.getReceiverType 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.
_HttpOutgoing.writeHeaders (cyclomatic 17) sdk/lib/_http/http_impl.dart:1795— _HttpOutgoing.writeHeaders 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. This is NOT this file's highest cyclomatic complexity: _HttpResponse._findReasonPhrase (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Primitives.applyFunction (cyclomatic 17) sdk/lib/_internal/js_runtime/lib/js_helper.dart:980— Primitives.applyFunction 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.
_ChunkedJsonParser._parseStringInternal (cyclomatic 17) sdk/lib/_internal/wasm/common/convert_patch.dart:1155— _ChunkedJsonParser._parseStringInternal 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.
_ChunkedJsonParser.parseStringToBuffer (cyclomatic 17) sdk/lib/_internal/wasm/common/convert_patch.dart:1291— _ChunkedJsonParser.parseStringToBuffer 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.
_TypeUniverse.substituteTypeArgument (cyclomatic 17) sdk/lib/_internal/wasm/common/type.dart:802— _TypeUniverse.substituteTypeArgument has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LinearScanRegisterAllocator.allocate (cyclomatic 17) pkg/native_compiler/lib/back_end/register_allocator.dart:509— LinearScanRegisterAllocator.allocate 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.
_Base64Decoder.decodeChunk (cyclomatic 17) sdk/lib/convert/base64.dart:695— _Base64Decoder.decodeChunk 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.
HtmlEscape._convert (cyclomatic 17) sdk/lib/convert/html_escape.dart:241— HtmlEscape._convert 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.
AstToIr._translateConditionForValue (cyclomatic 17) pkg/cfg/lib/front_end/ast_to_ir.dart:2043— AstToIr._translateConditionForValue 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.
_NetworkProfiling._serviceExtensionHandler (cyclomatic 17) sdk/lib/io/network_profiling.dart:93— _NetworkProfiling._serviceExtensionHandler 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.
Lowering.visitComparison (cyclomatic 17) pkg/native_compiler/lib/passes/lowering.dart:95— Lowering.visitComparison 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.
_FlowAnalysisImpl._getNonPromotionReasons (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:8681— _FlowAnalysisImpl._getNonPromotionReasons 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.
RecordFieldDeclarationIdentifierContext.ensureIdentifier (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:629— RecordFieldDeclarationIdentifierContext.ensureIdentifier has cyclomatic complexity 17 (threshold 15). 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.
Parser.parseEnum (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:2593— Parser.parseEnum 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Parser.parseInitializer (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4804— Parser.parseInitializer 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Parser.parseFunctionBody (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6531— Parser.parseFunctionBody 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Parser.parseNewExpression (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8896— Parser.parseNewExpression 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Parser.parseParenthesizedPatternOrRecordPattern (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:12159— Parser.parseParenthesizedPatternOrRecordPattern 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ComplexTypeParamOrArgInfo.parseVariables (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1475— ComplexTypeParamOrArgInfo.parseVariables 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.
Features.getText (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/testing/features.dart:80— Features.getText 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.
TypeAnalyzer._finishJoinedPatternVariables (cyclomatic 17) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:3223— TypeAnalyzer._finishJoinedPatternVariables 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.
StaticInteropMockValidator.validateCreateStaticInteropMock (cyclomatic 17) pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart:100— StaticInteropMockValidator.validateCreateStaticInteropMock 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.
AnalysisServer.reportAnalysisAnalytics (cyclomatic 17) pkg/analysis_server/lib/src/analysis_server.dart:1172— AnalysisServer.reportAnalysisAnalytics 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.
CheckNameResponse.computeRenameRanges2 (cyclomatic 17) pkg/analysis_server/lib/src/cider/rename.dart:125— CheckNameResponse.computeRenameRanges2 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.
AbstractRefactorCommandHandler.getRefactoring (cyclomatic 17) pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart:48— AbstractRefactorCommandHandler.getRefactoring 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.
EditableArgumentsMixin.getInvocationInfo (cyclomatic 17) pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/editable_arguments_mixin.dart:67— EditableArgumentsMixin.getInvocationInfo 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.
DeclarationHelper._addInstanceMembers (cyclomatic 17) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1202— DeclarationHelper._addInstanceMembers 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.
DeclarationHelper._addTopLevelDeclarations (cyclomatic 17) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1710— DeclarationHelper._addTopLevelDeclarations 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.
InScopeCompletionPass.visitIfStatement (cyclomatic 17) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1816— InScopeCompletionPass.visitIfStatement 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.
StatementCompletionProcessor._complete_doStatement (cyclomatic 17) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:462— StatementCompletionProcessor._complete_doStatement 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.
AddDiagnosticPropertyReference._fixAllDiagnosticPropertyReferences (cyclomatic 17) pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart:209— AddDiagnosticPropertyReference._fixAllDiagnosticPropertyReferences 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.
ConvertClassToMixin.compute (cyclomatic 17) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart:26— ConvertClassToMixin.compute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CreateEnumConstant.compute (cyclomatic 17) pkg/analysis_server/lib/src/services/correction/dart/create_enum_constant.dart:32— CreateEnumConstant.compute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
EncapsulateField._updateReferencesInConstructor (cyclomatic 17) pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart:298— EncapsulateField._updateReferencesInConstructor 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.
MemberSorter._sortUnitMembers (cyclomatic 17) pkg/analysis_server/lib/src/services/correction/sort_members.dart:169— MemberSorter._sortUnitMembers 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.
_PreviewVisitor.visitAnnotation (cyclomatic 17) pkg/analysis_server/lib/src/services/flutter/widget_previews.dart:271— _PreviewVisitor.visitAnnotation 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.
_ReferenceProcessor._process (cyclomatic 17) pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart:958— _ReferenceProcessor._process 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.
_IndexContributor.visitSimpleIdentifier (cyclomatic 17) pkg/analyzer/lib/src/dart/analysis/index.dart:1405— _IndexContributor.visitSimpleIdentifier has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExpressionImpl.correspondingParameter (cyclomatic 17) pkg/analyzer/lib/src/dart/ast/ast.dart:17913— ExpressionImpl.correspondingParameter 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. This is NOT this file's highest cyclomatic complexity: V1Projection._sourceOf (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ConstantVerifier._checkForConstWithTypeParameters (cyclomatic 17) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:604— ConstantVerifier._checkForConstWithTypeParameters 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.
_ConstructorInvocationEvaluator.evaluateFactoryConstructorCall (cyclomatic 17) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3027— _ConstructorInvocationEvaluator.evaluateFactoryConstructorCall 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.
ClassElementImpl.allSubtypes (cyclomatic 17) pkg/analyzer/lib/src/dart/element/element.dart:157— ClassElementImpl.allSubtypes 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.
InterfaceLeastUpperBoundHelper._computeLongestInheritancePathToObject (cyclomatic 17) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:199— InterfaceLeastUpperBoundHelper._computeLongestInheritancePathToObject 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.
LeastUpperBoundHelper._futureOr (cyclomatic 17) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:796— LeastUpperBoundHelper._futureOr has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ReplacementVisitor.visitFunctionType (cyclomatic 17) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:164— ReplacementVisitor.visitFunctionType 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.
UnknownInferredType.isUnknown (cyclomatic 17) pkg/analyzer/lib/src/dart/element/type_schema.dart:84— UnknownInferredType.isUnknown 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.
TypeSystemImpl.isAlwaysExhaustive (cyclomatic 17) pkg/analyzer/lib/src/dart/element/type_system.dart:844— TypeSystemImpl.isAlwaysExhaustive 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.
AstRewriter._parsedConstructorType (cyclomatic 17) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:786— AstRewriter._parsedConstructorType 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.
PropertyElementResolver.resolveCascadeProperty (cyclomatic 17) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:180— PropertyElementResolver.resolveCascadeProperty 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.
PropertyElementResolver.resolveIndexExpression (cyclomatic 17) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:505— PropertyElementResolver.resolveIndexExpression has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
PropertyElementResolver.resolveIndexReadWriteAssignmentTarget (cyclomatic 17) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:610— PropertyElementResolver.resolveIndexReadWriteAssignmentTarget 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.
SimpleIdentifierResolver._resolve1 (cyclomatic 17) pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart:113— SimpleIdentifierResolver._resolve1 has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AnnotationVerifier._checkReopen (cyclomatic 17) pkg/analyzer/lib/src/error/annotation_verifier.dart:452— AnnotationVerifier._checkReopen has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
GatherUsedLocalElementsVisitor._useNamedReadResolution (cyclomatic 17) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:590— GatherUsedLocalElementsVisitor._useNamedReadResolution 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.
ErrorVerifier.visitTopLevelVariableDeclaration (cyclomatic 17) pkg/analyzer/lib/src/generated/error_verifier.dart:2485— ErrorVerifier.visitTopLevelVariableDeclaration 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.
ErrorVerifier._checkForFunctionBodyCompleteness (cyclomatic 17) pkg/analyzer/lib/src/generated/error_verifier.dart:5864— ErrorVerifier._checkForFunctionBodyCompleteness has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ErrorVerifier._validateConstructorBodyAllowed (cyclomatic 17) pkg/analyzer/lib/src/generated/error_verifier.dart:8855— ErrorVerifier._validateConstructorBodyAllowed 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.
FfiVerifier.visitCascadeMethodInvocation (cyclomatic 17) pkg/analyzer/lib/src/generated/ffi_verifier.dart:170— FfiVerifier.visitCascadeMethodInvocation 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.
SdkConstraintVerifier._checkSinceSdkVersion (cyclomatic 17) pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart:325— SdkConstraintVerifier._checkSinceSdkVersion 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.
InstanceMemberInferrer._inferExecutable (cyclomatic 17) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:410— InstanceMemberInferrer._inferExecutable 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.
InstanceMemberInferrer._setInducedModifier (cyclomatic 17) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:638— InstanceMemberInferrer._setInducedModifier 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.
DartEditBuilderImpl._getBaseNameFromUnwrappedExpression (cyclomatic 17) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1266— DartEditBuilderImpl._getBaseNameFromUnwrappedExpression 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.
DartFileEditBuilderImpl._insertDocImportIntoLibraryDirective (cyclomatic 17) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:3210— DartFileEditBuilderImpl._insertDocImportIntoLibraryDirective 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.
KernelSourceInformationBuilder._buildMemberBody (cyclomatic 17) pkg/compiler/lib/src/io/kernel_source_information.dart:261— KernelSourceInformationBuilder._buildMemberBody 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.
CallPosition.getSemanticPositionForCall (cyclomatic 17) pkg/compiler/lib/src/io/position_information.dart:720— CallPosition.getSemanticPositionForCall 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. This is NOT this file's highest cyclomatic complexity: PositionTraceListener.onStep (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ConstantEmitter.visitMap (cyclomatic 17) pkg/compiler/lib/src/js_backend/constant_emitter.dart:319— ConstantEmitter.visitMap has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
JsKernelToElementMap.JsKernelToElementMap (cyclomatic 17) pkg/compiler/lib/src/js_model/element_map_impl.dart:117— JsKernelToElementMap.JsKernelToElementMap 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.
KernelSsaGraphBuilder._handleCreateInvocationMirror (cyclomatic 17) pkg/compiler/lib/src/ssa/builder.dart:5579— KernelSsaGraphBuilder._handleCreateInvocationMirror 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.
SsaCodeGenerator.generateExpressionAssignment (cyclomatic 17) pkg/compiler/lib/src/ssa/codegen.dart:698— SsaCodeGenerator.generateExpressionAssignment 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.
SsaInstructionSelection._computeBitWidth (cyclomatic 17) pkg/compiler/lib/src/ssa/codegen_helpers.dart:284— SsaInstructionSelection._computeBitWidth 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.
SsaGlobalValueNumberer.moveLoopInvariantCodeFromBlock (cyclomatic 17) pkg/compiler/lib/src/ssa/optimize.dart:3755— SsaGlobalValueNumberer.moveLoopInvariantCodeFromBlock 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.
SsaCodeMotion.visitBasicBlock (cyclomatic 17) pkg/compiler/lib/src/ssa/optimize.dart:3988— SsaCodeMotion.visitBasicBlock 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.
MemberUsage.dataEquals (cyclomatic 17) pkg/compiler/lib/src/universe/member_usage.dart:251— MemberUsage.dataEquals has cyclomatic complexity 17 (threshold 15). 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.
DDSRunner.start (cyclomatic 17) pkg/dartdev/lib/src/dds_runner.dart:16— DDSRunner.start 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.
EvalPackageResolver.resolvePackageConfig (cyclomatic 17) pkg/dartdev/lib/src/eval_packages.dart:72— EvalPackageResolver.resolvePackageConfig 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.
DartDevelopmentServiceImpl._startDDSServer (cyclomatic 17) pkg/dds/lib/src/dds_impl.dart:168— DartDevelopmentServiceImpl._startDDSServer 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.
StreamManager.streamListen (cyclomatic 17) pkg/dds/lib/src/stream_manager.dart:189— StreamManager.streamListen 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.
ProgramCompiler._is31BitUnsigned (cyclomatic 17) pkg/dev_compiler/lib/src/kernel/compiler.dart:6283— ProgramCompiler._is31BitUnsigned 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.
ProgramCompiler._emitSuperTarget (cyclomatic 17) pkg/dev_compiler/lib/src/kernel/compiler.dart:6579— ProgramCompiler._emitSuperTarget has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LibraryCompiler.emitLibrary (cyclomatic 17) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:905— LibraryCompiler.emitLibrary has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LibraryCompiler._is31BitUnsigned (cyclomatic 17) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6972— LibraryCompiler._is31BitUnsigned 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.
LibraryCompiler._emitSuperTarget (cyclomatic 17) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7268— LibraryCompiler._emitSuperTarget has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExpressionCompiler._findScopeAt (cyclomatic 17) pkg/dev_compiler/lib/src/kernel/expression_compiler.dart:328— ExpressionCompiler._findScopeAt 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.
TypeLabeler.visitFunctionType (cyclomatic 17) pkg/front_end/lib/src/codes/type_labeler.dart:214— TypeLabeler.visitFunctionType 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.
FactoryEncoding._isCyclicRedirectingFactory (cyclomatic 17) pkg/front_end/lib/src/fragment/factory/encoding.dart:804— FactoryEncoding._isCyclicRedirectingFactory 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.
BodyBuilderImpl._buildConstructorInvocation (cyclomatic 17) pkg/front_end/lib/src/kernel/body_builder.dart:10756— BodyBuilderImpl._buildConstructorInvocation 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.
ForwardingNode._createNoSuchMethodForwarder (cyclomatic 17) pkg/front_end/lib/src/kernel/forwarding_node.dart:494— ForwardingNode._createNoSuchMethodForwarder 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.
ClassHierarchyBuilder._getLegacyLeastUpperBoundInternal (cyclomatic 17) pkg/front_end/lib/src/kernel/hierarchy/hierarchy_builder.dart:150— ClassHierarchyBuilder._getLegacyLeastUpperBoundInternal 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.
_DeclarationBuilderRegistry.registerBuilder (cyclomatic 17) pkg/front_end/lib/src/source/name_space_builder.dart:258— _DeclarationBuilderRegistry.registerBuilder 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.
SourceLoader.computeLibraryScopes (cyclomatic 17) pkg/front_end/lib/src/source/source_loader.dart:1700— SourceLoader.computeLibraryScopes 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.
SuccessfulInferenceResult.applyResult (cyclomatic 17) pkg/front_end/lib/src/type_inference/inference_results.dart:245— SuccessfulInferenceResult.applyResult 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.
InferenceVisitorImpl.visitDotShorthandPropertyGet (cyclomatic 17) pkg/front_end/lib/src/type_inference/inference_visitor.dart:14092— InferenceVisitorImpl.visitDotShorthandPropertyGet 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
MatchingExpressionVisitor.visitObjectPattern (cyclomatic 17) pkg/front_end/lib/src/type_inference/matching_expressions.dart:487— MatchingExpressionVisitor.visitObjectPattern 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.
_Visitor.visitMethodDeclaration (cyclomatic 17) pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart:54— _Visitor.visitMethodDeclaration 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.
_Visitor._processExpression (cyclomatic 17) pkg/linter/lib/src/rules/switch_on_type.dart:68— _Visitor._processExpression 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.
_Visitor.visitLexeme (cyclomatic 17) pkg/linter/lib/src/rules/unnecessary_string_escapes.dart:55— _Visitor.visitLexeme 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.
_Visitor._findAssignedField (cyclomatic 17) pkg/linter/lib/src/rules/use_declaring_parameters.dart:96— _Visitor._findAssignedField 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.
_Visitor.visitIfElement (cyclomatic 17) pkg/linter/lib/src/rules/use_null_aware_elements.dart:42— _Visitor.visitIfElement 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.
DwarfStackTraceDecoder.bind (cyclomatic 17) pkg/native_stack_traces/lib/src/convert.dart:544— DwarfStackTraceDecoder.bind 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.
Isolate._update (cyclomatic 17) pkg/observatory/lib/src/service/object.dart:1708— Isolate._update has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: ServiceObject._fromMap (cyclomatic 50) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Histogram.printCounts (cyclomatic 17) pkg/scrape/lib/src/histogram.dart:42— Histogram.printCounts 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.
Module.printAsWat (cyclomatic 17) pkg/wasm_builder/lib/src/ir/module.dart:371— Module.printAsWat 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.
Printer.visitExtensionTypeDeclaration (cyclomatic 17) pkg/kernel/lib/text/ast_to_text.dart:1576— Printer.visitExtensionTypeDeclaration has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_DeduplicateMixinKey.== (cyclomatic 17) pkg/vm/lib/transformations/mixin_deduplication.dart:117— _DeduplicateMixinKey.== 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.
_SelectorApproximation.observeArgs (cyclomatic 17) pkg/vm/lib/transformations/type_flow/analysis.dart:1076— _SelectorApproximation.observeArgs 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.
_TFClassImpl._initDispatchTargets (cyclomatic 17) pkg/vm/lib/transformations/type_flow/analysis.dart:1543— _TFClassImpl._initDispatchTargets 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.
SummaryCollector._makeNarrow (cyclomatic 17) pkg/vm/lib/transformations/type_flow/summary_collector.dart:1379— SummaryCollector._makeNarrow 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.
UnboxingInfoManager._updateUnboxingInfoOfMember (cyclomatic 17) pkg/vm/lib/transformations/type_flow/unboxing_info.dart:135— UnboxingInfoManager._updateUnboxingInfoOfMember 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.
IDLType.__init__ (cyclomatic 17) tools/dom/scripts/idlnode.py:661— IDLType.__init__ 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.
Dart2JSBackend._AddDirectNativeOperation (cyclomatic 17) tools/dom/scripts/systemhtml.py:1943— Dart2JSBackend._AddDirectNativeOperation 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.
TemplateLoader._Preprocess (cyclomatic 17) tools/dom/scripts/templateloader.py:62— TemplateLoader._Preprocess 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.
sandbox.onRcpMessage (cyclomatic 17) REDACTED:58— sandbox.onRcpMessage 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.
D3SymbolTreeMap.D3SymbolTreeMap._clone (cyclomatic 17) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:286— D3SymbolTreeMap.D3SymbolTreeMap._clone has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
RelevanceDataCollector._argumentListContext (cyclomatic 16) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2170— RelevanceDataCollector._argumentListContext has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ExpectedCompletionsVisitor.safelyRecordEntity (cyclomatic 16) pkg/analysis_server/tool/code_completion/visitors.dart:180— ExpectedCompletionsVisitor.safelyRecordEntity has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AstNodeImplGenerator._buildImplClass (cyclomatic 16) pkg/analyzer/tool/generators/ast_generator.dart:64— AstNodeImplGenerator._buildImplClass 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.
_CodeGenerator.checkIdl (cyclomatic 16) pkg/analyzer/tool/summary/generate.dart:534— _CodeGenerator.checkIdl 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.
_CodeGenerator._addFieldForGetter (cyclomatic 16) pkg/analyzer/tool/summary/generate.dart:739— _CodeGenerator._addFieldForGetter 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.
BytecodeGenerator._genConstructorInitializers (cyclomatic 16) pkg/dart2bytecode/lib/bytecode_generator.dart:1276— BytecodeGenerator._genConstructorInitializers 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. This is NOT this file's highest cyclomatic complexity: BytecodeGenerator._genMethodInvocationUsingSpecializedBytecode (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
BytecodeGenerator._checkArguments (cyclomatic 16) pkg/dart2bytecode/lib/bytecode_generator.dart:2444— BytecodeGenerator._checkArguments 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. This is NOT this file's highest cyclomatic complexity: BytecodeGenerator._genMethodInvocationUsingSpecializedBytecode (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
BytecodeDisassembler._decodeOperands (cyclomatic 16) pkg/dart2bytecode/lib/disassembler.dart:88— BytecodeDisassembler._decodeOperands 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.
DynamicForwarderCodeGenerator._generateDynamicMethodForwarder (cyclomatic 16) pkg/dart2wasm/lib/code_generator.dart:3902— DynamicForwarderCodeGenerator._generateDynamicMethodForwarder 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.
Translator.convertType (cyclomatic 16) pkg/dart2wasm/lib/translator.dart:1580— Translator.convertType 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. This is NOT this file's highest cyclomatic complexity: Translator.toMostSpecificInterfaceType (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Translator._filterInferredType (cyclomatic 16) pkg/dart2wasm/lib/translator.dart:2163— Translator._filterInferredType has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: Translator.toMostSpecificInterfaceType (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_ClosureArgumentsToVtableEntryDispatcherGenerator._handleOptionalNamedCase (cyclomatic 16) pkg/dart2wasm/lib/translator.dart:3271— _ClosureArgumentsToVtableEntryDispatcherGenerator._handleOptionalNamedCase 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. This is NOT this file's highest cyclomatic complexity: Translator.toMostSpecificInterfaceType (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_AstIndexerAndIgnoreCollectorBody._recordIfIsCallToNotExpectedCoverage (cyclomatic 16) pkg/front_end/tool/coverage_merger.dart:1300— _AstIndexerAndIgnoreCollectorBody._recordIfIsCallToNotExpectedCoverage has cyclomatic complexity 16 (threshold 15). 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.
NaiveTypeChecker.checkOverride (cyclomatic 16) pkg/kernel/lib/naive_type_checker.dart:50— NaiveTypeChecker.checkOverride 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.
_VerifyingVisitor.visitFunctionNode (cyclomatic 16) pkg/kernel/lib/verifier.dart:1061— _VerifyingVisitor.visitFunctionNode 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.
DartFuzz._emitMinimizedLiteralHelper (cyclomatic 16) runtime/tools/dartfuzz/dartfuzz.dart:802— DartFuzz._emitMinimizedLiteralHelper 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. This is NOT this file's highest cyclomatic complexity: DartFuzz.emitSingleStatement (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_HttpOutgoing.close (cyclomatic 16) sdk/lib/_http/http_impl.dart:1934— _HttpOutgoing.close 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. This is NOT this file's highest cyclomatic complexity: _HttpResponse._findReasonPhrase (cyclomatic 42) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_HttpParser._onDone (cyclomatic 16) sdk/lib/_http/http_parser.dart:970— _HttpParser._onDone has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_WebSocketImpl.connect (cyclomatic 16) sdk/lib/_http/websocket_impl.dart:1356— _WebSocketImpl.connect has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_GrowableList.addAll (cyclomatic 16) sdk/lib/_internal/vm/lib/growable_array.dart:294— _GrowableList.addAll 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.
_ChunkedJsonParser.parseStringEscape (cyclomatic 16) sdk/lib/_internal/wasm/common/convert_patch.dart:1377— _ChunkedJsonParser.parseStringEscape 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.
_WasmInstructionLowerer.visitBinaryIntOp (cyclomatic 16) pkg/dart2wasm/lib/cfg/to_wasm.dart:361— _WasmInstructionLowerer.visitBinaryIntOp 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. This is NOT this file's highest cyclomatic complexity: _WasmInstructionLowerer.canHandle (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
_SplayTree._splay (cyclomatic 16) sdk/lib/collection/splay_tree.dart:67— _SplayTree._splay 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.
_Uri._normalize (cyclomatic 16) sdk/lib/core/uri.dart:2885— _Uri._normalize 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.
_Uri._uriDecode (cyclomatic 16) sdk/lib/core/uri.dart:3619— _Uri._uriDecode 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.
DebugInfo.== (cyclomatic 16) pkg/dwds/lib/data/debug_info.dart:83— DebugInfo.== has cyclomatic complexity 16 (threshold 15). 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.
AstToIr._enterScope (cyclomatic 16) pkg/cfg/lib/front_end/ast_to_ir.dart:934— AstToIr._enterScope 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.
_FfiDefinitionTransformer._checkFieldAnnotations (cyclomatic 16) pkg/vm/lib/modular/transformations/ffi/definitions.dart:462— _FfiDefinitionTransformer._checkFieldAnnotations 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.
_FfiUseSiteTransformer._replaceNativeCall (cyclomatic 16) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:2106— _FfiUseSiteTransformer._replaceNativeCall has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ListPatternStaticType.witnessToDart (cyclomatic 16) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:159— ListPatternStaticType.witnessToDart 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.
Parser._isConstructor (cyclomatic 16) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5721— Parser._isConstructor has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: Parser.missingParameterMessage (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Utf8BytesScanner.scanUntilLineEnd (cyclomatic 16) pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart:249— Utf8BytesScanner.scanUntilLineEnd 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.
TypeAnalyzer.analyzeRecordPattern (cyclomatic 16) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:2079— TypeAnalyzer.analyzeRecordPattern has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DartUnitHighlightsComputer._addIdentifierRegion (cyclomatic 16) pkg/analysis_server/lib/src/computer/computer_highlights.dart:103— DartUnitHighlightsComputer._addIdentifierRegion has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ImportElementsComputer._computeUpdate (cyclomatic 16) pkg/analysis_server/lib/src/computer/import_elements_computer.dart:192— ImportElementsComputer._computeUpdate 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.
ResultMerger.mergeOutline (cyclomatic 16) pkg/analysis_server/lib/src/plugin/result_merger.dart:392— ResultMerger.mergeOutline 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.
DeclarationHelper._canAccessInstanceMember (cyclomatic 16) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1809— DeclarationHelper._canAccessInstanceMember 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.
DeclarationHelper._suggestClass (cyclomatic 16) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2036— DeclarationHelper._suggestClass 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.
InScopeCompletionPass.visitFieldDeclaration (cyclomatic 16) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1383— InScopeCompletionPass.visitFieldDeclaration 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.
InScopeCompletionPass.visitPropertyAccess (cyclomatic 16) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2703— InScopeCompletionPass.visitPropertyAccess 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.
InScopeCompletionPass._forPattern (cyclomatic 16) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:4096— InScopeCompletionPass._forPattern 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.
StatementCompletionProcessor._complete_controlFlowBlock (cyclomatic 16) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:411— StatementCompletionProcessor._complete_controlFlowBlock 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.
BulkFixProcessor._computeFixes (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:527— BulkFixProcessor._computeFixes 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.
_AddInvocation.compute (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart:213— _AddInvocation.compute 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.
ConvertToContains.compute (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/convert_to_contains.dart:27— ConvertToContains.compute 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.
ConvertToPrimaryConstructor.compute (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/convert_to_primary_constructor.dart:49— ConvertToPrimaryConstructor.compute has cyclomatic complexity 16 (threshold 15). 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.
CreateClass.producers (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:20— CreateClass.producers 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.
_CreateConstructor._computeWithSuperParameters (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart:186— _CreateConstructor._computeWithSuperParameters has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
EncapsulateField.compute (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart:43— EncapsulateField.compute has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_ReplacementEditBuilder.visitSimpleIdentifier (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:330— _ReplacementEditBuilder.visitSimpleIdentifier 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.
FlutterParentAndChild.swapParentAndChild (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_child.dart:21— FlutterParentAndChild.swapParentAndChild has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
RenameToCamelCase.compute (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart:35— RenameToCamelCase.compute 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.
ReplaceIfElseWithConditional.compute (cyclomatic 16) pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart:25— ReplaceIfElseWithConditional.compute 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.
PropertyDescription._changeCode (cyclomatic 16) pkg/analysis_server/lib/src/services/flutter/property.dart:177— PropertyDescription._changeCode 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.
RenameRefactoring.create (cyclomatic 16) pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart:457— RenameRefactoring.create has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
PluginServer._getResponse (cyclomatic 16) pkg/analysis_server_plugin/lib/src/plugin_server.dart:737— PluginServer._getResponse 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.
_ParsedPluginsData.parse (cyclomatic 16) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1526— _ParsedPluginsData.parse 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.
AnalysisDriver.performWork (cyclomatic 16) pkg/analyzer/lib/src/dart/analysis/driver.dart:1182— AnalysisDriver.performWork has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
LibraryAnalyzer._resolvePartDirective (cyclomatic 16) pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart:984— LibraryAnalyzer._resolvePartDirective 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.
_FindDeclarations.compute (cyclomatic 16) pkg/analyzer/lib/src/dart/analysis/search.dart:1417— _FindDeclarations.compute 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.
StringLexemeHelper.StringLexemeHelper (cyclomatic 16) pkg/analyzer/lib/src/dart/ast/ast.dart:52415— StringLexemeHelper.StringLexemeHelper 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. This is NOT this file's highest cyclomatic complexity: V1Projection._sourceOf (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ToSourceVisitor._visitParsedExpression (cyclomatic 16) pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart:1934— ToSourceVisitor._visitParsedExpression 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.
_Collector._typedLiteral (cyclomatic 16) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:522— _Collector._typedLiteral 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.
LibraryFragmentImpl.shouldIgnoreUndefined (cyclomatic 16) pkg/analyzer/lib/src/dart/element/element.dart:8123— LibraryFragmentImpl.shouldIgnoreUndefined 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.
InheritanceManager3._inheritCovariance (cyclomatic 16) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:1059— InheritanceManager3._inheritCovariance 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.
NormalizeHelper._normalize (cyclomatic 16) pkg/analyzer/lib/src/dart/element/normalize.dart:106— NormalizeHelper._normalize has cyclomatic complexity 16 (threshold 15). 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.
TopMergeHelper._functionTypes (cyclomatic 16) pkg/analyzer/lib/src/dart/element/top_merge.dart:133— TopMergeHelper._functionTypes 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.
ElementBindingVisitor.visitCompilationUnit (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:115— ElementBindingVisitor.visitCompilationUnit 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.
ExitDetector.visitForElement (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:203— ExitDetector.visitForElement 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.
ExitDetector.visitForStatement (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:256— ExitDetector.visitForStatement 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.
FlowAnalysisHelper.getLabelTarget (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart:481— FlowAnalysisHelper.getLabelTarget 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.
ForResolver._forEachParts (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/for_resolver.dart:156— ForResolver._forEachParts has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
CallInvocationResolver.resolve (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart:39— CallInvocationResolver.resolve 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.
IncrementOrDecrementResolver.resolve (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/increment_or_decrement_resolver.dart:41— IncrementOrDecrementResolver.resolve 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.
MethodInvocationResolver._resolveQualifiedInvocation (cyclomatic 16) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:1227— MethodInvocationResolver._resolveQualifiedInvocation has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
AnnotationVerifier._checkInternal (cyclomatic 16) pkg/analyzer/lib/src/error/annotation_verifier.dart:326— AnnotationVerifier._checkInternal 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.
IgnoreValidator._reportUnnecessaryOrRemovedOrDeprecatedIgnores (cyclomatic 16) pkg/analyzer/lib/src/error/ignore_validator.dart:198— IgnoreValidator._reportUnnecessaryOrRemovedOrDeprecatedIgnores 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.
_ClassVerifier._reportConcreteClassWithAbstractMember (cyclomatic 16) pkg/analyzer/lib/src/error/inheritance_override.dart:897— _ClassVerifier._reportConcreteClassWithAbstractMember 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.
MustCallSuperVerifier._findOverriddenMemberWithMustCallSuper (cyclomatic 16) pkg/analyzer/lib/src/error/must_call_super_verifier.dart:77— MustCallSuperVerifier._findOverriddenMemberWithMustCallSuper 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.
_CharacterSequenceFromMultiLineComment.next (cyclomatic 16) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:997— _CharacterSequenceFromMultiLineComment.next has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: DocCommentBuilder._parseDocDirectiveTag (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ErrorVerifier.visitFieldDeclaration (cyclomatic 16) pkg/analyzer/lib/src/generated/error_verifier.dart:1208— ErrorVerifier.visitFieldDeclaration 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. This is NOT this file's highest cyclomatic complexity: ErrorVerifier._checkForInvalidInstanceMemberAccess2 (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ErrorVerifier._checkForNotInitializedFieldDeclaration (cyclomatic 16) pkg/analyzer/lib/src/generated/error_verifier.dart:7248— ErrorVerifier._checkForNotInitializedFieldDeclaration 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. This is NOT this file's highest cyclomatic complexity: ErrorVerifier._checkForInvalidInstanceMemberAccess2 (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
FfiVerifier._validateAddressReceiver (cyclomatic 16) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1403— FfiVerifier._validateAddressReceiver 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.
FfiVerifier._validateFfiMethodInvocation (cyclomatic 16) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1780— FfiVerifier._validateFfiMethodInvocation 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.
IgnoreInfo.isIgnoreComment (cyclomatic 16) pkg/analyzer/lib/src/ignore_comments/ignore_info.dart:214— IgnoreInfo.isIgnoreComment has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
DefaultTypesBuilder._findRawTypePathsToDeclaration (cyclomatic 16) pkg/analyzer/lib/src/summary2/default_types_builder.dart:205— DefaultTypesBuilder._findRawTypePathsToDeclaration 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.
ElementBuilder._buildTopFragments (cyclomatic 16) pkg/analyzer/lib/src/summary2/element_builder.dart:172— ElementBuilder._buildTopFragments 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.
CommandLineOptions._parse (cyclomatic 16) pkg/analyzer_cli/lib/src/options.dart:350— CommandLineOptions._parse 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.
CompletionTarget._computeDroppedToken (cyclomatic 16) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:651— CompletionTarget._computeDroppedToken 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.
DumpInfoTask.buildDumpInfoDataNew (cyclomatic 16) pkg/compiler/lib/src/dump_info.dart:1913— DumpInfoTask.buildDumpInfoDataNew 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.
TypeSystem.joinTypeMasks (cyclomatic 16) pkg/compiler/lib/src/inferrer/type_system.dart:824— TypeSystem.joinTypeMasks 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.
FlatTypeMask._intersection (cyclomatic 16) pkg/compiler/lib/src/inferrer/typemasks/flat_type_mask.dart:567— FlatTypeMask._intersection 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.
TypeMask.getNotNormalizedReason (cyclomatic 16) pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart:526— TypeMask.getNotNormalizedReason 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.
_RecipeGenerator.visitFunctionType (cyclomatic 16) pkg/compiler/lib/src/js_backend/runtime_types_new.dart:340— _RecipeGenerator.visitFunctionType 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.
_RecipeToIdentifier.visitFunctionType (cyclomatic 16) pkg/compiler/lib/src/js_backend/type_reference.dart:712— _RecipeToIdentifier.visitFunctionType 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.
FieldVisitor.visitFields (cyclomatic 16) pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart:36— FieldVisitor.visitFields has cyclomatic complexity 16 (threshold 15). 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.
KernelAnnotationProcessor.extractJsInteropAnnotations (cyclomatic 16) pkg/compiler/lib/src/kernel/native_basic_data.dart:75— KernelAnnotationProcessor.extractJsInteropAnnotations 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.
KernelSsaGraphBuilder.visitStaticInvocation (cyclomatic 16) pkg/compiler/lib/src/ssa/builder.dart:5079— KernelSsaGraphBuilder.visitStaticInvocation 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.
KernelSsaGraphBuilder._handleInvokeFactoryConstructor (cyclomatic 16) pkg/compiler/lib/src/ssa/builder.dart:5196— KernelSsaGraphBuilder._handleInvokeFactoryConstructor 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.
KernelSsaGraphBuilder._setupStateForInlining (cyclomatic 16) pkg/compiler/lib/src/ssa/builder.dart:8333— KernelSsaGraphBuilder._setupStateForInlining 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.
InlineData.toString (cyclomatic 16) pkg/compiler/lib/src/ssa/builder.dart:9089— InlineData.toString has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
SsaInstructionSimplifier.visitInvokeDynamicMethod (cyclomatic 16) pkg/compiler/lib/src/ssa/optimize.dart:1028— SsaInstructionSimplifier.visitInvokeDynamicMethod 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.
SsaInstructionSimplifier.visitInvokeDynamicSetter (cyclomatic 16) pkg/compiler/lib/src/ssa/optimize.dart:2136— SsaInstructionSimplifier.visitInvokeDynamicSetter 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.
SsaInstructionSimplifier.visitStringify (cyclomatic 16) pkg/compiler/lib/src/ssa/optimize.dart:2407— SsaInstructionSimplifier.visitStringify 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.
SsaInstructionSimplifier.visitBitOr (cyclomatic 16) pkg/compiler/lib/src/ssa/optimize.dart:2862— SsaInstructionSimplifier.visitBitOr 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.
SsaInstructionSimplifier.visitArrayFlagsCheck (cyclomatic 16) pkg/compiler/lib/src/ssa/optimize.dart:3030— SsaInstructionSimplifier.visitArrayFlagsCheck 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.
SsaValueRangeAnalyzer.visitBoundsCheck (cyclomatic 16) pkg/compiler/lib/src/ssa/value_range_analyzer.dart:908— SsaValueRangeAnalyzer.visitBoundsCheck has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
JsBuilder._irregularEscape (cyclomatic 16) pkg/dev_compiler/lib/src/js_ast/builder.dart:354— JsBuilder._irregularEscape 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. This is NOT this file's highest cyclomatic complexity: MiniJsParser.categoryToString (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ProgramCompiler._directCastMethod (cyclomatic 16) pkg/dev_compiler/lib/src/kernel/compiler.dart:7827— ProgramCompiler._directCastMethod 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.
LibraryCompiler._emitJSInteropClassNonExternalMembers (cyclomatic 16) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1601— LibraryCompiler._emitJSInteropClassNonExternalMembers 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.
LibraryCompiler._directCastMethod (cyclomatic 16) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8695— LibraryCompiler._directCastMethod 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.
AppInspector._populateScriptCaches (cyclomatic 16) pkg/dwds/lib/src/debugging/inspector.dart:131— AppInspector._populateScriptCaches 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.
DevHandler._handleMessage (cyclomatic 16) pkg/dwds/lib/src/handlers/dev_handler.dart:477— DevHandler._handleMessage has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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. This is NOT this file's highest cyclomatic complexity: DevHandler._deserializeMessage (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ProcessedOptions.validateOptions (cyclomatic 16) pkg/front_end/lib/src/base/processed_options.dart:395— ProcessedOptions.validateOptions 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.
FactoryEncoding.checkRedirectingFactory (cyclomatic 16) pkg/front_end/lib/src/fragment/factory/encoding.dart:567— FactoryEncoding.checkRedirectingFactory has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
FactoryEncoding._computeRedirecteeType (cyclomatic 16) pkg/front_end/lib/src/fragment/factory/encoding.dart:684— FactoryEncoding._computeRedirecteeType 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.
BodyBuilderImpl.pushQualifiedReference (cyclomatic 16) pkg/front_end/lib/src/kernel/body_builder.dart:9772— BodyBuilderImpl.pushQualifiedReference 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.
ConstantEvaluator.visitLogicalExpression (cyclomatic 16) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4610— ConstantEvaluator.visitLogicalExpression 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.
ConstantEvaluator._handleFromEnvironment (cyclomatic 16) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5109— ConstantEvaluator._handleFromEnvironment 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.
DelayedAssignment.handleAssignment (cyclomatic 16) pkg/front_end/lib/src/kernel/expression_generator.dart:6080— DelayedAssignment.handleAssignment has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Overrides.collectOverrides (cyclomatic 16) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:2935— _Overrides.collectOverrides 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.
BuilderFactory._createMethodBuilder (cyclomatic 16) pkg/front_end/lib/src/source/builder_factory.dart:966— BuilderFactory._createMethodBuilder 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. This is NOT this file's highest cyclomatic complexity: BuilderFactory._createBuilder (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
SourceClassBuilder.build (cyclomatic 16) pkg/front_end/lib/src/source/source_class_builder.dart:485— SourceClassBuilder.build 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.
SourceLibraryBuilder.addImportsToScope (cyclomatic 16) pkg/front_end/lib/src/source/source_library_builder.dart:631— SourceLibraryBuilder.addImportsToScope 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. This is NOT this file's highest cyclomatic complexity: SourceLibraryBuilder.checkPendingBoundsChecks (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
SourceLibraryBuilder.checkTypesInOutline (cyclomatic 16) pkg/front_end/lib/src/source/source_library_builder.dart:1389— SourceLibraryBuilder.checkTypesInOutline 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. This is NOT this file's highest cyclomatic complexity: SourceLibraryBuilder.checkPendingBoundsChecks (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
SourceLoader.tokenize (cyclomatic 16) pkg/front_end/lib/src/source/source_loader.dart:1119— SourceLoader.tokenize 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.
_AsyncContext._checkValidReturn (cyclomatic 16) pkg/front_end/lib/src/type_inference/body_inference_context.dart:534— _AsyncContext._checkValidReturn 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.
InferenceVisitorImpl.visitAnonymousMethodBlock (cyclomatic 16) pkg/front_end/lib/src/type_inference/inference_visitor.dart:9366— InferenceVisitorImpl.visitAnonymousMethodBlock 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. This is NOT this file's highest cyclomatic complexity: InferenceVisitorImpl.visitRelationalPattern (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ReferenceName.fromNamedNode (cyclomatic 16) pkg/kernel/lib/src/equivalence_helpers.dart:253— ReferenceName.fromNamedNode 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.
_Visitor.visitCompilationUnit (cyclomatic 16) pkg/linter/lib/src/rules/dangling_library_doc_comments.dart:38— _Visitor.visitCompilationUnit 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.
_Visitor.visitSwitchStatement (cyclomatic 16) pkg/linter/lib/src/rules/exhaustive_cases.dart:37— _Visitor.visitSwitchStatement 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.
_Visitor.visitDeclaredVariablePattern (cyclomatic 16) pkg/linter/lib/src/rules/prefer_final_locals.dart:78— _Visitor.visitDeclaredVariablePattern 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.
_ConstructorChecker._checkInitializer (cyclomatic 16) pkg/linter/lib/src/rules/prefer_initializing_formals.dart:142— _ConstructorChecker._checkInitializer has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Visitor._checkBody (cyclomatic 16) pkg/linter/lib/src/rules/unnecessary_async.dart:130— _Visitor._checkBody has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
_Visitor._checkConstructor (cyclomatic 16) pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart:82— _Visitor._checkConstructor has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ScriptInsetElement._refreshSourceReport (cyclomatic 16) pkg/observatory/lib/src/elements/script_inset.dart:225— ScriptInsetElement._refreshSourceReport 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.
Printer.writeFunction (cyclomatic 16) pkg/kernel/lib/text/ast_to_text.dart:825— Printer.writeFunction has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
WidgetCreatorTracker._getPragmaName (cyclomatic 16) pkg/kernel/lib/transformations/track_widget_constructor_locations.dart:666— WidgetCreatorTracker._getPragmaName 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.
TypesBuilder.fromStaticType (cyclomatic 16) pkg/vm/lib/transformations/type_flow/types.dart:232— TypesBuilder.fromStaticType has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. 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.
ConcreteType.isSubtypeOfRuntimeType (cyclomatic 16) pkg/vm/lib/transformations/type_flow/types.dart:1249— ConcreteType.isSubtypeOfRuntimeType 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.
SimpleUnreachableCodeElimination.visitSwitchStatement (cyclomatic 16) pkg/vm/lib/transformations/unreachable_code_elimination.dart:192— SimpleUnreachableCodeElimination.visitSwitchStatement 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.
IDLExtAttrs.__init__ (cyclomatic 16) tools/dom/scripts/idlnode.py:570— IDLExtAttrs.__init__ 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.
DartiumBackend._GenerateNativeBinding (cyclomatic 16) tools/dom/scripts/systemnative.py:1009— DartiumBackend._GenerateNativeBinding 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.
D3SymbolTreeMap.D3SymbolTreeMap._showInfoBox (cyclomatic 16) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:774— D3SymbolTreeMap.D3SymbolTreeMap._showInfoBox has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
TodoComment repeated across 19 files pkg/_fe_analyzer_shared/test/exhaustiveness/data/variable_pattern.dart:207— The identical TodoComment appears in 19 files (19 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 19 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(johnniwinther): Should we avoid the unreachable error here?". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 114 files pkg/analysis_server/lib/src/services/correction/dart/wrap_in_text.dart:20— The identical TodoComment appears in 114 files (120 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 120 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(applicability): comment on why.". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 33 files pkg/analysis_server/test/analysis/notification_navigation_test.dart:493— The identical TodoComment appears in 33 files (69 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 69 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(scheglov): implement augmentation". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 155 files pkg/test_runner/tool/convert_multitest.dart:145— The identical TodoComment appears in 155 files (155 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 155 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(multitest): This was automatically migrated from a multitest and may". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 12 files runtime/tests/vm/dart/generated/megamorphic_is_via_instance_generator.dart:7— The identical TodoComment appears in 12 files (12 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 12 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(https://github.com/dart-lang/sdk/issues/61310): n = 1 << 16". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 16 files tests/language/regress/regress34488_runtime_test.dart:8— The identical TodoComment appears in 16 files (16 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 16 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// TODO(51557): Decide if the mixins being applied in this test should be". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
AstWriter._computeProperties (cognitive 690) pkg/analysis_server/lib/src/status/utilities/ast_writer.dart:30— AstWriter._computeProperties has cognitive complexity 690 (threshold 15). Drivers by points: if/else 75 (690 pts) (nesting depth added 615). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RequirementsManifest.isSatisfied (cognitive 305) pkg/analyzer/lib/src/fine/requirements.dart:956— RequirementsManifest.isSatisfied has cognitive complexity 305 (threshold 15). Drivers by points: if/else 84 (246 pts), loops 25 (59 pts) (nesting depth added 196). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Processor.calculate (cognitive 271) pkg/front_end/lib/src/util/outline_extractor.dart:309— _Processor.calculate has cognitive complexity 271 (threshold 15). Drivers by points: if/else 46 (191 pts), loops 19 (68 pts), boolean chains 12 (nesting depth added 194). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TypeUseGenerator.buildSelectorAccess (cognitive 248) pkg/front_end/lib/src/kernel/expression_generator.dart:4698— TypeUseGenerator.buildSelectorAccess has cognitive complexity 248 (threshold 15). Drivers by points: if/else 48 (157 pts), ternaries 8 (33 pts), loops 4 (31 pts), match/switch 4 (16 pts), boolean chains 11 (nesting depth added 173). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_HttpParser._doParse (cognitive 242) sdk/lib/_http/http_parser.dart:486— _HttpParser._doParse has cognitive complexity 242 (threshold 15). Drivers by points: if/else 90 (203 pts), boolean chains 27, loops 3 (10 pts), match/switch 1 (2 pts) (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.
ConstantsTransformer.visitPatternSwitchStatement (cognitive 203) pkg/front_end/lib/src/kernel/constant_evaluator.dart:750— ConstantsTransformer.visitPatternSwitchStatement has cognitive complexity 203 (threshold 15). Drivers by points: if/else 40 (108 pts), loops 27 (86 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 129). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartTypes._subtypeHelper (cognitive 196) pkg/compiler/lib/src/elements/types.dart:1949— DartTypes._subtypeHelper has cognitive complexity 196 (threshold 15). Drivers by points: if/else 51 (140 pts), loops 9 (34 pts), boolean chains 15, match/switch 1 (4 pts), ternaries 1 (3 pts) (nesting depth added 119). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_BigIntImpl._binaryGcd (cognitive 180) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2112— _BigIntImpl._binaryGcd has cognitive complexity 180 (threshold 15). Drivers by points: if/else 62 (142 pts), boolean chains 24, loops 8 (14 pts) (nesting depth added 86). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BodyBuilderImpl.resolveAndBuildConstructorInvocation (cognitive 164) pkg/front_end/lib/src/kernel/body_builder.dart:9979— BodyBuilderImpl.resolveAndBuildConstructorInvocation has cognitive complexity 164 (threshold 15). Drivers by points: if/else 44 (108 pts), ternaries 4 (18 pts), boolean chains 16, loops 2 (11 pts), match/switch 4 (11 pts) (nesting depth added 94). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartFileEditBuilderImpl._addLibraryImports (cognitive 160) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:2482— DartFileEditBuilderImpl._addLibraryImports has cognitive complexity 160 (threshold 15). Drivers by points: if/else 47 (111 pts), loops 12 (28 pts), boolean chains 12, ternaries 2 (9 pts) (nesting depth added 87). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BodyBuilderImpl.processLookupResult (cognitive 152) pkg/front_end/lib/src/kernel/body_builder.dart:9208— BodyBuilderImpl.processLookupResult has cognitive complexity 152 (threshold 15). Drivers by points: if/else 45 (100 pts), boolean chains 39, ternaries 4 (13 pts) (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LibraryCompiler.visitStaticInvocation (cognitive 151) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7398— LibraryCompiler.visitStaticInvocation has cognitive complexity 151 (threshold 15). Drivers by points: if/else 54 (114 pts), loops 6 (17 pts), boolean chains 13, match/switch 2 (6 pts), ternaries 1 (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parseClassOrMixinOrExtensionOrEnumMemberImpl (cognitive 150) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5273— Parser.parseClassOrMixinOrExtensionOrEnumMemberImpl has cognitive complexity 150 (threshold 15). Drivers by points: if/else 50 (110 pts), boolean chains 40 (nesting depth added 60). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProgramCompiler.visitStaticInvocation (cognitive 149) pkg/dev_compiler/lib/src/kernel/compiler.dart:6709— ProgramCompiler.visitStaticInvocation has cognitive complexity 149 (threshold 15). Drivers by points: if/else 53 (114 pts), loops 6 (17 pts), boolean chains 13, match/switch 1 (4 pts), ternaries 1 (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OutlineBuilder.endFormalParameters (cognitive 148) pkg/front_end/lib/src/source/outline_builder.dart:3249— OutlineBuilder.endFormalParameters has cognitive complexity 148 (threshold 15). Drivers by points: if/else 44 (122 pts), loops 4 (15 pts), boolean chains 11 (nesting depth added 89). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceClassBuilder.checkSupertypes (cognitive 148) pkg/front_end/lib/src/source/source_class_builder.dart:740— SourceClassBuilder.checkSupertypes has cognitive complexity 148 (threshold 15). Drivers by points: if/else 39 (89 pts), boolean chains 37, loops 8 (22 pts) (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_MixinInferenceSolution._solveForEquality (cognitive 145) pkg/front_end/lib/src/kernel/hierarchy/mixin_inferrer.dart:270— _MixinInferenceSolution._solveForEquality has cognitive complexity 145 (threshold 15). Drivers by points: if/else 44 (99 pts), loops 10 (30 pts), boolean chains 15, match/switch 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.
SourceLoader._checkSupertypeClassModifiers (cognitive 145) pkg/front_end/lib/src/source/source_loader.dart:2210— SourceLoader._checkSupertypeClassModifiers has cognitive complexity 145 (threshold 15). Drivers by points: if/else 39 (90 pts), boolean chains 29, ternaries 4 (20 pts), loops 2 (6 pts) (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClassMembersNodeBuilder.build (cognitive 144) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:617— ClassMembersNodeBuilder.build has cognitive complexity 144 (threshold 15). Drivers by points: if/else 48 (101 pts), loops 10 (23 pts), boolean chains 13, ternaries 4 (7 pts) (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TokensWriter.astToBinaryTokenType (cognitive 143) pkg/analyzer/lib/src/summary2/tokens_writer.dart:9— TokensWriter.astToBinaryTokenType has cognitive complexity 143 (threshold 15). Drivers by points: if/else 143. 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.
LinearScanRegisterAllocator.resolveDataFlow (cognitive 141) pkg/native_compiler/lib/back_end/register_allocator.dart:921— LinearScanRegisterAllocator.resolveDataFlow has cognitive complexity 141 (threshold 15). Drivers by points: if/else 26 (99 pts), loops 9 (23 pts), ternaries 3 (11 pts), boolean chains 8 (nesting depth added 95). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parseFormalParameter (cognitive 141) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:2030— Parser.parseFormalParameter has cognitive complexity 141 (threshold 15). Drivers by points: if/else 59 (122 pts), boolean chains 15, match/switch 1 (4 pts) (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Types.performSubtypeCheck (cognitive 141) pkg/kernel/lib/src/types.dart:65— Types.performSubtypeCheck has cognitive complexity 141 (threshold 15). Drivers by points: if/else 42 (102 pts), loops 9 (25 pts), boolean chains 9, ternaries 2 (4 pts), match/switch 1 (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.
JFieldAnalysis.from (cognitive 140) pkg/compiler/lib/src/js_backend/field_analysis.dart:289— JFieldAnalysis.from has cognitive complexity 140 (threshold 15). Drivers by points: if/else 43 (113 pts), boolean chains 10, loops 2 (8 pts), match/switch 1 (5 pts), ternaries 1 (4 pts) (nesting depth added 83). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_FfiUseSiteTransformer._visitStaticInvocation (cognitive 139) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:352— _FfiUseSiteTransformer._visitStaticInvocation has cognitive complexity 139 (threshold 15). Drivers by points: if/else 49 (100 pts), boolean chains 29, ternaries 3 (9 pts), error handling 1 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantEvaluator._handleInvocation (cognitive 137) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4297— ConstantEvaluator._handleInvocation has cognitive complexity 137 (threshold 15). Drivers by points: if/else 37 (87 pts), boolean chains 23, match/switch 6 (19 pts), loops 2 (8 pts) (nesting depth added 69). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.visitClassDeclaration (cognitive 133) pkg/linter/lib/src/rules/analyzer_element_model_tracking.dart:54— _Visitor.visitClassDeclaration has cognitive complexity 133 (threshold 15). Drivers by points: if/else 19 (85 pts), loops 5 (24 pts), boolean chains 17, match/switch 2 (7 pts) (nesting depth added 90). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser._parsePrecedenceExpressionLoop (cognitive 129) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7203— Parser._parsePrecedenceExpressionLoop has cognitive complexity 129 (threshold 15). Drivers by points: if/else 51 (119 pts), boolean chains 9, loops 1 (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Type.generate (cognitive 127) pkg/vm_service/tool/dart/generate_dart_common.dart:571— Type.generate has cognitive complexity 127 (threshold 15). Drivers by points: if/else 57 (90 pts), boolean chains 23, loops 4 (7 pts), ternaries 3 (7 pts) (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.
RuntimeTypesNeedBuilderImpl.computeRuntimeTypesNeed (cognitive 127) pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart:1075— RuntimeTypesNeedBuilderImpl.computeRuntimeTypesNeed has cognitive complexity 127 (threshold 15). Drivers by points: if/else 50 (85 pts), loops 16 (31 pts), match/switch 2 (7 pts), boolean chains 4 (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.
ResolvedCorrectionProducer.inferUndefinedExpressionType (cognitive 126) pkg/analysis_server_plugin/lib/edit/dart/correction_producer.dart:520— ResolvedCorrectionProducer.inferUndefinedExpressionType has cognitive complexity 126 (threshold 15). Drivers by points: if/else 60 (110 pts), boolean chains 8, match/switch 1 (4 pts), ternaries 1 (4 pts) (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.
Sort._dualPivotQuicksort (cognitive 125) sdk/lib/internal/sort.dart:85— Sort._dualPivotQuicksort has cognitive complexity 125 (threshold 15). Drivers by points: if/else 39 (100 pts), loops 8 (24 pts), boolean chains 1 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SubtypeHelper._isSubtypeOf (cognitive 125) pkg/analyzer/lib/src/dart/element/subtype.dart:262— SubtypeHelper._isSubtypeOf has cognitive complexity 125 (threshold 15). Drivers by points: if/else 47 (82 pts), boolean chains 40, loops 1 (3 pts) (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.
_Visitor.visitParenthesizedExpression (cognitive 124) pkg/linter/lib/src/rules/unnecessary_parenthesis.dart:56— _Visitor.visitParenthesizedExpression has cognitive complexity 124 (threshold 15). Drivers by points: if/else 43 (74 pts), boolean chains 50 (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.
ConstantEvaluator.visitBinaryExpression (cognitive 123) pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:114— ConstantEvaluator.visitBinaryExpression has cognitive complexity 123 (threshold 15). Drivers by points: if/else 48 (91 pts), boolean chains 27, ternaries 1 (4 pts), loops 1 (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.
ImpactData.apply (cognitive 122) pkg/compiler/lib/src/ir/impact_data.dart:1438— ImpactData.apply has cognitive complexity 122 (threshold 15). Drivers by points: loops 37 (74 pts), if/else 40 (42 pts), match/switch 2 (6 pts) (nesting depth added 43). 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.
InvokeDynamicSpecializer.lookupSpecializer (cognitive 121) pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart:71— InvokeDynamicSpecializer.lookupSpecializer has cognitive complexity 121 (threshold 15). Drivers by points: if/else 45 (121 pts) (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
IncrementalCompiler._initializeExperimentalInvalidation (cognitive 121) pkg/front_end/lib/src/base/incremental_compiler.dart:1260— IncrementalCompiler._initializeExperimentalInvalidation has cognitive complexity 121 (threshold 15). Drivers by points: if/else 26 (77 pts), loops 15 (40 pts), boolean chains 4 (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ModifyParameters.apply (cognitive 118) pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart:81— ModifyParameters.apply has cognitive complexity 118 (threshold 15). Drivers by points: if/else 29 (67 pts), loops 8 (17 pts), ternaries 4 (16 pts), boolean chains 9, match/switch 3 (9 pts) (nesting depth added 65). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_SanitizedMember.computeMembers (cognitive 118) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1982— _SanitizedMember.computeMembers has cognitive complexity 118 (threshold 15). Drivers by points: if/else 46 (105 pts), boolean chains 13 (nesting depth added 59). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
KernelTarget._finishConstruction (cognitive 114) pkg/front_end/lib/src/kernel/kernel_target.dart:1542— KernelTarget._finishConstruction has cognitive complexity 114 (threshold 15). Drivers by points: if/else 30 (76 pts), boolean chains 19, loops 8 (16 pts), ternaries 1 (3 pts) (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartLanguageServerBenchmark._listenToStdout (cognitive 113) pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart:347— DartLanguageServerBenchmark._listenToStdout has cognitive complexity 113 (threshold 15). Drivers by points: if/else 26 (88 pts), boolean chains 16, ternaries 1 (5 pts), loops 2 (4 pts) (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
V1Projection._toV1Expression (cognitive 112) pkg/analyzer/lib/src/dart/ast/ast.dart:57854— V1Projection._toV1Expression has cognitive complexity 112 (threshold 15). Drivers by points: ternaries 35 (70 pts), if/else 36, boolean chains 6 (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.
ConstantEvaluator2.visitBinaryOperatorInvocation (cognitive 110) pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:436— ConstantEvaluator2.visitBinaryOperatorInvocation has cognitive complexity 110 (threshold 15). Drivers by points: if/else 43 (82 pts), boolean chains 23, ternaries 1 (4 pts), loops 1 (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.
_WebSocketProtocolTransformer.add (cognitive 109) sdk/lib/_http/websocket_impl.dart:295— _WebSocketProtocolTransformer.add has cognitive complexity 109 (threshold 15). Drivers by points: if/else 32 (97 pts), boolean chains 10, loops 1, ternaries 1 (nesting depth added 65). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TypeSystemImpl.canBeSubtypeOf (cognitive 109) pkg/analyzer/lib/src/dart/element/type_system.dart:140— TypeSystemImpl.canBeSubtypeOf has cognitive complexity 109 (threshold 15). Drivers by points: if/else 33 (77 pts), loops 6 (17 pts), boolean chains 14, ternaries 1 (nesting depth added 55). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
HttpDate._parseCookieDate (cognitive 108) sdk/lib/_http/http_date.dart:280— HttpDate._parseCookieDate has cognitive complexity 108 (threshold 15). Drivers by points: if/else 31 (74 pts), boolean chains 21, loops 4 (11 pts), ternaries 1 (2 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Tuple.sanitize (cognitive 106) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:549— _Tuple.sanitize has cognitive complexity 106 (threshold 15). Drivers by points: if/else 46 (81 pts), boolean chains 15, loops 4 (8 pts), ternaries 2 (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.
ProgramBuilder._addJsInteropStubs (cognitive 105) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:455— ProgramBuilder._addJsInteropStubs has cognitive complexity 105 (threshold 15). Drivers by points: if/else 19 (71 pts), ternaries 2 (13 pts), loops 3 (11 pts), boolean chains 10 (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Tuple.sanitize (cognitive 103) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1503— _Tuple.sanitize has cognitive complexity 103 (threshold 15). Drivers by points: if/else 44 (73 pts), boolean chains 24, loops 2 (4 pts), ternaries 2 (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.
SummaryCollector.createSummary (cognitive 103) pkg/vm/lib/transformations/type_flow/summary_collector.dart:643— SummaryCollector.createSummary has cognitive complexity 103 (threshold 15). Drivers by points: if/else 31 (55 pts), ternaries 8 (21 pts), loops 7 (15 pts), boolean chains 10, match/switch 1 (2 pts) (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.
_Uri.resolveUri (cognitive 102) sdk/lib/core/uri.dart:3220— _Uri.resolveUri has cognitive complexity 102 (threshold 15). Drivers by points: if/else 36 (90 pts), ternaries 3 (7 pts), boolean chains 5 (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parseMethod (cognitive 102) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5799— Parser.parseMethod has cognitive complexity 102 (threshold 15). Drivers by points: if/else 48 (73 pts), boolean chains 20, ternaries 3 (6 pts), match/switch 2 (3 pts) (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.
SourceTypeAliasBuilder._checkCyclicTypedefDependency (cognitive 102) pkg/front_end/lib/src/source/source_type_alias_builder.dart:158— SourceTypeAliasBuilder._checkCyclicTypedefDependency has cognitive complexity 102 (threshold 15). Drivers by points: if/else 21 (68 pts), loops 8 (29 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 70). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
Parser.parseTopLevelMemberImpl (cognitive 97) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4181— Parser.parseTopLevelMemberImpl has cognitive complexity 97 (threshold 15). Drivers by points: if/else 38 (73 pts), boolean chains 24 (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.
InScopeCompletionPass.visitVariableDeclaration (cognitive 97) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:3419— InScopeCompletionPass.visitVariableDeclaration has cognitive complexity 97 (threshold 15). Drivers by points: if/else 34 (84 pts), boolean chains 9, match/switch 1 (4 pts) (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DuplicateDefinitionVerifier.checkUnit (cognitive 95) pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart:115— DuplicateDefinitionVerifier.checkUnit has cognitive complexity 95 (threshold 15). Drivers by points: if/else 27 (78 pts), loops 13 (15 pts), match/switch 1 (2 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SourceExtensionTypeDeclarationBuilder._checkRepresentationDependency (cognitive 95) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:524— SourceExtensionTypeDeclarationBuilder._checkRepresentationDependency has cognitive complexity 95 (threshold 15). Drivers by points: if/else 21 (62 pts), loops 8 (27 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 62). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SwitchInfo.SwitchInfo (cognitive 94) pkg/dart2wasm/lib/code_generator.dart:5298— SwitchInfo.SwitchInfo has cognitive complexity 94 (threshold 15). Drivers by points: if/else 26 (57 pts), boolean chains 23, loops 4 (10 pts), ternaries 1 (4 pts) (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.
Uri.parse (cognitive 94) sdk/lib/core/uri.dart:841— Uri.parse has cognitive complexity 94 (threshold 15). Drivers by points: if/else 34 (75 pts), boolean chains 19 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ImportElementsComputer.createEdits (cognitive 94) pkg/analysis_server/lib/src/computer/import_elements_computer.dart:31— ImportElementsComputer.createEdits has cognitive complexity 94 (threshold 15). Drivers by points: if/else 16 (62 pts), loops 9 (30 pts), boolean chains 2 (nesting depth added 67). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PubspecFixGenerator._addMissingDependency (cognitive 93) pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart:147— PubspecFixGenerator._addMissingDependency has cognitive complexity 93 (threshold 15). Drivers by points: if/else 19 (63 pts), loops 4 (16 pts), ternaries 2 (10 pts), boolean chains 4 (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BodyBuilderImpl.beginSwitchCase (cognitive 93) pkg/front_end/lib/src/kernel/body_builder.dart:957— BodyBuilderImpl.beginSwitchCase has cognitive complexity 93 (threshold 15). Drivers by points: if/else 24 (62 pts), loops 8 (30 pts), ternaries 1 (nesting depth added 60). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InScopeCompletionPass.visitArgumentList (cognitive 91) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:293— InScopeCompletionPass.visitArgumentList has cognitive complexity 91 (threshold 15). Drivers by points: if/else 27 (71 pts), boolean chains 10, loops 3 (10 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DeclarationByElementLocator.visitNode (cognitive 91) pkg/analyzer/lib/src/dart/analysis/results.dart:67— DeclarationByElementLocator.visitNode has cognitive complexity 91 (threshold 15). Drivers by points: if/else 46 (82 pts), boolean chains 7, match/switch 1 (2 pts) (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.
_Future._propagateToListeners (cognitive 90) sdk/lib/async/future_impl.dart:848— _Future._propagateToListeners has cognitive complexity 90 (threshold 15). Drivers by points: if/else 26 (70 pts), error handling 3 (9 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DelayedDefaultValueCloner.cloneDefaultValues (cognitive 90) pkg/front_end/lib/src/kernel/kernel_helper.dart:116— DelayedDefaultValueCloner.cloneDefaultValues has cognitive complexity 90 (threshold 15). Drivers by points: if/else 24 (72 pts), loops 6 (14 pts), boolean chains 4 (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FrontendCompiler.compile (cognitive 88) pkg/frontend_server/lib/frontend_server.dart:689— FrontendCompiler.compile has cognitive complexity 88 (threshold 15). Drivers by points: if/else 38 (64 pts), loops 4 (9 pts), ternaries 5 (8 pts), boolean chains 7 (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.
InstrumentationLog._parseLogContent (cognitive 86) pkg/analysis_server/tool/instrumentation/log/log.dart:285— InstrumentationLog._parseLogContent has cognitive complexity 86 (threshold 15). Drivers by points: if/else 28 (85 pts), loops 1 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FeaturesDataInterpreter.isAsExpected (cognitive 86) pkg/_fe_analyzer_shared/lib/src/testing/features.dart:252— FeaturesDataInterpreter.isAsExpected has cognitive complexity 86 (threshold 15). Drivers by points: if/else 23 (57 pts), loops 4 (22 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MixinFullResolution.transformClass (cognitive 85) pkg/vm/lib/modular/transformations/mixin_full_resolution.dart:78— MixinFullResolution.transformClass has cognitive complexity 85 (threshold 15). Drivers by points: if/else 27 (56 pts), loops 7 (16 pts), boolean chains 5, match/switch 1 (5 pts), ternaries 1 (3 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent 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.parseExpressionStatementOrDeclarationAfterModifiers (cognitive 85) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9864— Parser.parseExpressionStatementOrDeclarationAfterModifiers has cognitive complexity 85 (threshold 15). Drivers by points: if/else 35 (68 pts), boolean chains 17 (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.
_Collector.collect (cognitive 85) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:59— _Collector.collect has cognitive complexity 85 (threshold 15). Drivers by points: if/else 54 (72 pts), boolean chains 7, loops 2 (4 pts), match/switch 1 (2 pts) (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.
TypeEnvironment.computeTypeShapeCheckSufficiency (cognitive 84) pkg/kernel/lib/type_environment.dart:306— TypeEnvironment.computeTypeShapeCheckSufficiency has cognitive complexity 84 (threshold 15). Drivers by points: if/else 29 (59 pts), loops 6 (15 pts), boolean chains 6, ternaries 1 (4 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaCodeGenerator.visitLoopInfo (cognitive 84) pkg/compiler/lib/src/ssa/codegen.dart:1046— SsaCodeGenerator.visitLoopInfo has cognitive complexity 84 (threshold 15). Drivers by points: if/else 27 (67 pts), boolean chains 10, loops 1 (6 pts), match/switch 1 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MiniJsParser.getToken (cognitive 84) pkg/dev_compiler/lib/src/js_ast/builder.dart:701— MiniJsParser.getToken has cognitive complexity 84 (threshold 15). Drivers by points: if/else 29 (62 pts), boolean chains 14, loops 3 (5 pts), ternaries 1 (3 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConvertToDeclaringParameter.compute (cognitive 83) pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart:41— ConvertToDeclaringParameter.compute has cognitive complexity 83 (threshold 15). Drivers by points: if/else 43 (69 pts), boolean chains 7, ternaries 2 (5 pts), loops 1 (2 pts) (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.
ExtensionTypeMembersNodeBuilder.build (cognitive 83) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:35— ExtensionTypeMembersNodeBuilder.build has cognitive complexity 83 (threshold 15). Drivers by points: if/else 33 (62 pts), loops 7 (11 pts), boolean chains 6, ternaries 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.
MiniJsParser.getToken (cognitive 83) pkg/js_ast/lib/src/builder.dart:619— MiniJsParser.getToken has cognitive complexity 83 (threshold 15). Drivers by points: if/else 27 (58 pts), boolean chains 17, loops 3 (5 pts), ternaries 1 (3 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.visitClassDeclaration (cognitive 83) pkg/linter/lib/src/rules/use_enums.dart:139— _Visitor.visitClassDeclaration has cognitive complexity 83 (threshold 15). Drivers by points: if/else 28 (68 pts), boolean chains 8, loops 3 (6 pts), error handling 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.
Intrinsifier.generateStaticIntrinsic (cognitive 82) pkg/dart2wasm/lib/intrinsics.dart:1362— Intrinsifier.generateStaticIntrinsic has cognitive complexity 82 (threshold 15). Drivers by points: if/else 31 (51 pts), boolean chains 12, loops 5 (10 pts), match/switch 5 (9 pts) (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.
_EnumDescription._validateFields (cognitive 82) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:653— _EnumDescription._validateFields has cognitive complexity 82 (threshold 15). Drivers by points: if/else 19 (65 pts), loops 5 (10 pts), boolean chains 7 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LeastUpperBoundHelper._computeLeastUpperBound (cognitive 82) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:391— LeastUpperBoundHelper._computeLeastUpperBound has cognitive complexity 82 (threshold 15). Drivers by points: if/else 55 (71 pts), boolean chains 11 (nesting depth added 16). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Driver._analyzeAll (cognitive 82) pkg/analyzer_cli/lib/src/driver.dart:152— Driver._analyzeAll has cognitive complexity 82 (threshold 15). Drivers by points: if/else 20 (46 pts), loops 8 (22 pts), error handling 2 (8 pts), ternaries 1 (4 pts), boolean chains 2 (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.
_ClassVerifier.verify (cognitive 81) pkg/analyzer/lib/src/error/inheritance_override.dart:309— _ClassVerifier.verify has cognitive complexity 81 (threshold 15). Drivers by points: if/else 24 (60 pts), boolean chains 11, loops 4 (7 pts), ternaries 1 (3 pts) (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.
Analysis.reverseTransitiveGraph (cognitive 80) pkg/heap_snapshot/lib/analysis.dart:335— Analysis.reverseTransitiveGraph has cognitive complexity 80 (threshold 15). Drivers by points: if/else 14 (66 pts), loops 4 (13 pts), boolean chains 1 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImportLibrary._importLibraryForElement (cognitive 79) pkg/analysis_server/lib/src/services/correction/dart/import_library.dart:293— ImportLibrary._importLibraryForElement has cognitive complexity 79 (threshold 15). Drivers by points: if/else 22 (44 pts), ternaries 10 (30 pts), boolean chains 3, loops 2 (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.
ExtractMethodRefactoringImpl.buildChange (cognitive 79) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:191— ExtractMethodRefactoringImpl.buildChange has cognitive complexity 79 (threshold 15). Drivers by points: if/else 26 (66 pts), loops 3 (6 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExpressionCompiler.compileExpressionToJs (cognitive 79) pkg/dev_compiler/lib/src/kernel/expression_compiler.dart:68— ExpressionCompiler.compileExpressionToJs has cognitive complexity 79 (threshold 15). Drivers by points: if/else 16 (58 pts), loops 4 (14 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InferenceVisitorBase._inferInvocation (cognitive 79) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:1734— InferenceVisitorBase._inferInvocation has cognitive complexity 79 (threshold 15). Drivers by points: if/else 33 (51 pts), loops 7 (12 pts), boolean chains 10, match/switch 2 (4 pts), ternaries 1 (2 pts) (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.
DispatchTable.build (cognitive 78) pkg/dart2wasm/lib/dispatch_table.dart:505— DispatchTable.build has cognitive complexity 78 (threshold 15). Drivers by points: if/else 31 (56 pts), loops 11 (16 pts), boolean chains 6 (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.
CompletionHandler._getServerDartItems (cognitive 78) pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart:390— CompletionHandler._getServerDartItems has cognitive complexity 78 (threshold 15). Drivers by points: if/else 22 (46 pts), ternaries 4 (12 pts), boolean chains 10, error handling 4 (8 pts), loops 1 (2 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConvertToSuperParameters.compute (cognitive 78) pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart:36— ConvertToSuperParameters.compute has cognitive complexity 78 (threshold 15). Drivers by points: if/else 34 (66 pts), boolean chains 8, loops 3 (4 pts) (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.
MessageScheduler.add (cognitive 77) pkg/analysis_server/lib/src/scheduler/message_scheduler.dart:69— MessageScheduler.add has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (60 pts), loops 3 (11 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConvertToSwitchExpression._getSupportedSwitchType (cognitive 77) pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:386— ConvertToSwitchExpression._getSupportedSwitchType has cognitive complexity 77 (threshold 15). Drivers by points: if/else 29 (67 pts), boolean chains 9, loops 1 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExpressionEvaluationHelperImpl.overwriteFindInterfaceMember (cognitive 77) pkg/front_end/lib/src/base/incremental_compiler.dart:2980— ExpressionEvaluationHelperImpl.overwriteFindInterfaceMember has cognitive complexity 77 (threshold 15). Drivers by points: if/else 13 (54 pts), loops 4 (17 pts), boolean chains 6 (nesting depth added 54). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NamedTypeBuilderImpl.findRawTypesWithInboundReferences (cognitive 77) pkg/front_end/lib/src/builder/named_type_builder.dart:1169— NamedTypeBuilderImpl.findRawTypesWithInboundReferences has cognitive complexity 77 (threshold 15). Drivers by points: if/else 18 (63 pts), loops 3 (10 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartScopeBuilder2._filter (cognitive 77) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:605— DartScopeBuilder2._filter has cognitive complexity 77 (threshold 15). Drivers by points: boolean chains 39, if/else 30 (37 pts), loops 1 (nesting depth added 7). 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.
MemberDuplicateDefinitionVerifier._checkClassMembers (cognitive 76) pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:48— MemberDuplicateDefinitionVerifier._checkClassMembers has cognitive complexity 76 (threshold 15). Drivers by points: if/else 17 (53 pts), ternaries 3 (12 pts), loops 3 (6 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DillExtensionTypeDeclarationBuilder.DillExtensionTypeDeclarationBuilder (cognitive 76) pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:38— DillExtensionTypeDeclarationBuilder.DillExtensionTypeDeclarationBuilder has cognitive complexity 76 (threshold 15). Drivers by points: if/else 24 (64 pts), boolean chains 6, match/switch 2 (4 pts), loops 2 (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.
OutlineBuilder.endPrimaryConstructor (cognitive 76) pkg/front_end/lib/src/source/outline_builder.dart:1794— OutlineBuilder.endPrimaryConstructor has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (66 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceExtensionTypeDeclarationBuilder.build (cognitive 76) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:252— SourceExtensionTypeDeclarationBuilder.build has cognitive complexity 76 (threshold 15). Drivers by points: if/else 23 (66 pts), loops 2 (6 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_RecGroupBuilder._assignBrandTypes (cognitive 76) pkg/wasm_builder/lib/src/builder/types.dart:124— _RecGroupBuilder._assignBrandTypes has cognitive complexity 76 (threshold 15). Drivers by points: if/else 9 (42 pts), loops 9 (28 pts), ternaries 2 (5 pts), boolean chains 1 (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.
Scrape._processPath (cognitive 75) pkg/scrape/lib/scrape.dart:233— Scrape._processPath has cognitive complexity 75 (threshold 15). Drivers by points: if/else 28 (73 pts), boolean chains 1, loops 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LinearScanRegisterAllocator.buildLiveRanges (cognitive 75) pkg/native_compiler/lib/back_end/register_allocator.dart:182— LinearScanRegisterAllocator.buildLiveRanges has cognitive complexity 75 (threshold 15). Drivers by points: if/else 16 (51 pts), loops 6 (16 pts), ternaries 2 (5 pts), boolean chains 3 (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.
ReplaceWithVar.compute (cognitive 75) pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart:33— ReplaceWithVar.compute has cognitive complexity 75 (threshold 15). Drivers by points: if/else 27 (60 pts), boolean chains 15 (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FuzzyMatcher.computeScore (cognitive 75) pkg/analyzer/lib/src/utilities/fuzzy_matcher.dart:161— FuzzyMatcher.computeScore has cognitive complexity 75 (threshold 15). Drivers by points: if/else 14 (43 pts), boolean chains 15, ternaries 3 (9 pts), loops 5 (8 pts) (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.
ErrorVerifier._checkForAugmentationFormalParameters (cognitive 73) pkg/analyzer/lib/src/generated/error_verifier.dart:3274— ErrorVerifier._checkForAugmentationFormalParameters has cognitive complexity 73 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 13, loops 6 (9 pts), ternaries 1 (3 pts) (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.
Parser.parseTopLevelKeywordDeclaration (cognitive 72) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:682— Parser.parseTopLevelKeywordDeclaration has cognitive complexity 72 (threshold 15). Drivers by points: if/else 30 (66 pts), boolean chains 6 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FlutterConvertToStatefulWidget.compute (cognitive 72) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart:30— FlutterConvertToStatefulWidget.compute has cognitive complexity 72 (threshold 15). Drivers by points: if/else 28 (55 pts), loops 6 (9 pts), boolean chains 7, ternaries 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.
TypePropertyResolver.resolve (cognitive 72) pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart:56— TypePropertyResolver.resolve has cognitive complexity 72 (threshold 15). Drivers by points: if/else 32 (60 pts), boolean chains 12 (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.
GreatestLowerBoundHelper.getGreatestLowerBound (cognitive 71) pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart:23— GreatestLowerBoundHelper.getGreatestLowerBound has cognitive complexity 71 (threshold 15). Drivers by points: if/else 42 (56 pts), boolean chains 15 (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.
FfiVerifier._validateNativeAddressOf (cognitive 71) pkg/analyzer/lib/src/generated/ffi_verifier.dart:2059— FfiVerifier._validateNativeAddressOf has cognitive complexity 71 (threshold 15). Drivers by points: if/else 17 (65 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_InitializationFromUri._initializeFromDill (cognitive 71) pkg/front_end/lib/src/base/incremental_compiler.dart:3481— _InitializationFromUri._initializeFromDill has cognitive complexity 71 (threshold 15). Drivers by points: if/else 14 (61 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GraphIsomorphizer.generateRootImport (cognitive 70) pkg/compiler/tool/graph_isomorphizer.dart:189— GraphIsomorphizer.generateRootImport has cognitive complexity 70 (threshold 15). Drivers by points: if/else 9 (41 pts), loops 9 (29 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImportOrganizer._organizeDirectives (cognitive 70) pkg/analysis_server/lib/src/services/correction/organize_imports.dart:85— ImportOrganizer._organizeDirectives has cognitive complexity 70 (threshold 15). Drivers by points: if/else 17 (47 pts), ternaries 3 (10 pts), boolean chains 5, loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BuildCliSubcommand.doBuild (cognitive 70) pkg/dartdev/lib/src/commands/build.dart:325— BuildCliSubcommand.doBuild has cognitive complexity 70 (threshold 15). Drivers by points: if/else 21 (49 pts), ternaries 4 (13 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ConstructorDeclarationMixin._finalizeSuperInitializingFormals (cognitive 70) pkg/front_end/lib/src/fragment/constructor/declaration.dart:299— _ConstructorDeclarationMixin._finalizeSuperInitializingFormals has cognitive complexity 70 (threshold 15). Drivers by points: if/else 25 (59 pts), boolean chains 7, loops 2, ternaries 1 (2 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartSnippetRequest._getContext (cognitive 69) pkg/analysis_server/lib/src/services/snippets/dart_snippet_request.dart:98— DartSnippetRequest._getContext has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (42 pts), boolean chains 14, ternaries 3 (9 pts), match/switch 1 (3 pts), loops 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.
ConstantEvaluationEngine.computeDependencies (cognitive 69) pkg/analyzer/lib/src/dart/constant/evaluation.dart:234— ConstantEvaluationEngine.computeDependencies has cognitive complexity 69 (threshold 15). Drivers by points: if/else 24 (54 pts), loops 3 (9 pts), boolean chains 6 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InstanceMemberInferrer._inferAccessorOrField (cognitive 69) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:88— InstanceMemberInferrer._inferAccessorOrField has cognitive complexity 69 (threshold 15). Drivers by points: if/else 33 (60 pts), boolean chains 9 (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.
KernelSsaGraphBuilder._doTryInlineMethod (cognitive 69) pkg/compiler/lib/src/ssa/builder.dart:7879— KernelSsaGraphBuilder._doTryInlineMethod has cognitive complexity 69 (threshold 15). Drivers by points: if/else 42 (50 pts), boolean chains 17, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_PropertyPreBuilder.absorbFragment (cognitive 69) pkg/front_end/lib/src/source/builder_factory.dart:2179— _PropertyPreBuilder.absorbFragment has cognitive complexity 69 (threshold 15). Drivers by points: if/else 33 (64 pts), boolean chains 4, 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.
LogPlayer.play (cognitive 68) pkg/analysis_server/tool/log_player/log_player.dart:63— LogPlayer.play has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (54 pts), boolean chains 8, match/switch 1 (4 pts), loops 1 (2 pts) (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.
Intrinsifier.generateInstanceIntrinsic (cognitive 68) pkg/dart2wasm/lib/intrinsics.dart:761— Intrinsifier.generateInstanceIntrinsic has cognitive complexity 68 (threshold 15). Drivers by points: if/else 24 (39 pts), match/switch 7 (20 pts), boolean chains 6, ternaries 1 (3 pts) (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.
ParserCreatorListener.endMethod (cognitive 68) pkg/front_end/tool/parser_ast_helper_creator.dart:259— ParserCreatorListener.endMethod has cognitive complexity 68 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 5 (14 pts), boolean chains 10, ternaries 1 (4 pts) (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.
ConvertToInitializingFormal._computeChange (cognitive 68) pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart:186— ConvertToInitializingFormal._computeChange has cognitive complexity 68 (threshold 15). Drivers by points: if/else 25 (48 pts), ternaries 2 (8 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FragmentEmitter.emitInstallTearOffs (cognitive 68) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:1422— FragmentEmitter.emitInstallTearOffs has cognitive complexity 68 (threshold 15). Drivers by points: if/else 20 (45 pts), loops 5 (9 pts), boolean chains 7, ternaries 3 (7 pts) (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.
(anonymous) (cognitive 68) sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js:13— (anonymous) has cognitive complexity 68 (threshold 15). Drivers by points: if/else 31 (45 pts), loops 11 (15 pts), boolean chains 3, error handling 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 20). Most of this is not in the body itself: 7 of the 68 points are its own statements and the rest belongs to 26 function items inside it that branch (bubbleDown, computeCurrentScript, nextEvent, …). 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.
AddFieldFormalParameters._computeFromPieces (cognitive 67) pkg/analysis_server/lib/src/services/correction/dart/add_field_formal_parameters.dart:87— AddFieldFormalParameters._computeFromPieces has cognitive complexity 67 (threshold 15). Drivers by points: if/else 26 (42 pts), boolean chains 10, ternaries 5 (8 pts), loops 4 (6 pts), 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.
_ConstructorInvocationEvaluator._checkInitializers (cognitive 67) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3256— _ConstructorInvocationEvaluator._checkInitializers has cognitive complexity 67 (threshold 15). Drivers by points: if/else 15 (51 pts), match/switch 2 (6 pts), ternaries 1 (6 pts), boolean chains 3, loops 1 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
KFieldAnalysis.registerInstantiatedClass (cognitive 67) pkg/compiler/lib/src/js_backend/field_analysis.dart:47— KFieldAnalysis.registerInstantiatedClass has cognitive complexity 67 (threshold 15). Drivers by points: if/else 13 (53 pts), boolean chains 5, match/switch 1 (5 pts), loops 3 (4 pts) (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor._findAssignedField (cognitive 67) pkg/linter/lib/src/rules/use_declaring_parameters.dart:96— _Visitor._findAssignedField has cognitive complexity 67 (threshold 15). Drivers by points: if/else 14 (64 pts), loops 2 (3 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartDocTest.compileAndRun (cognitive 66) pkg/front_end/tool/dart_doctest_impl.dart:123— DartDocTest.compileAndRun has cognitive complexity 66 (threshold 15). Drivers by points: if/else 26 (44 pts), loops 7 (16 pts), boolean chains 3, match/switch 1 (3 pts) (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.
NoSuchMethodError.toString (cognitive 66) sdk/lib/_internal/vm/lib/errors_patch.dart:233— NoSuchMethodError.toString has cognitive complexity 66 (threshold 15). Drivers by points: if/else 24 (50 pts), loops 2 (6 pts), ternaries 2 (5 pts), boolean chains 3, match/switch 1 (2 pts) (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.
NamedTypeResolver.resolveConstructorTypeReference (cognitive 66) pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart:133— NamedTypeResolver.resolveConstructorTypeReference has cognitive complexity 66 (threshold 15). Drivers by points: if/else 24 (38 pts), ternaries 4 (11 pts), match/switch 3 (9 pts), boolean chains 8 (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.
InterceptorStubGenerator.generateGetInterceptorMethod (cognitive 66) pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart:50— InterceptorStubGenerator.generateGetInterceptorMethod has cognitive complexity 66 (threshold 15). Drivers by points: if/else 42 (53 pts), boolean chains 9, ternaries 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_RawSecureSocket._tryFilter (cognitive 65) sdk/lib/io/secure_socket.dart:1069— _RawSecureSocket._tryFilter has cognitive complexity 65 (threshold 15). Drivers by points: if/else 16 (57 pts), boolean chains 5, loops 1 (2 pts), error handling 1 (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.
AnalyzeCommand.run (cognitive 65) pkg/dartdev/lib/src/commands/analyze.dart:172— AnalyzeCommand.run has cognitive complexity 65 (threshold 15). Drivers by points: if/else 29 (41 pts), ternaries 5 (9 pts), boolean chains 8, loops 5 (7 pts) (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.
(anonymous) (cognitive 65) sdk/lib/_internal/js_runtime/lib/preambles/d8.js:13— (anonymous) has cognitive complexity 65 (threshold 15). Drivers by points: if/else 29 (42 pts), loops 11 (15 pts), error handling 3 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 19). Most of this is not in the body itself: 3 of the 65 points are its own statements and the rest belongs to 27 function items inside it that branch (bubbleDown, computeCurrentScript, nextEvent, …). 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.
Parser.parsePrimary (cognitive 64) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8094— Parser.parsePrimary has cognitive complexity 64 (threshold 15). Drivers by points: if/else 41 (57 pts), boolean chains 7 (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.parseTryStatement (cognitive 64) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:10709— Parser.parseTryStatement has cognitive complexity 64 (threshold 15). Drivers by points: if/else 19 (62 pts), boolean chains 1, loops 1 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RuntimeTypesSubstitutionsMixin._computeChecks (cognitive 64) pkg/compiler/lib/src/js_backend/runtime_types.dart:120— RuntimeTypesSubstitutionsMixin._computeChecks has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (35 pts), loops 5 (12 pts), boolean chains 10, ternaries 2 (7 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RunCommand._runLocal (cognitive 64) pkg/dartdev/lib/src/commands/run.dart:540— RunCommand._runLocal has cognitive complexity 64 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 8, ternaries 2 (5 pts), match/switch 1 (4 pts), error handling 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.
ProgramCompiler._emitClassSignature (cognitive 64) pkg/dev_compiler/lib/src/kernel/compiler.dart:1816— ProgramCompiler._emitClassSignature has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (39 pts), ternaries 6 (12 pts), loops 3 (7 pts), boolean chains 6 (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.
LibraryCompiler._emitClassSignature (cognitive 64) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2113— LibraryCompiler._emitClassSignature has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (39 pts), ternaries 6 (12 pts), loops 3 (7 pts), boolean chains 6 (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.
ClassMembersNodeBuilder.inferMethodType (cognitive 64) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:133— ClassMembersNodeBuilder.inferMethodType has cognitive complexity 64 (threshold 15). Drivers by points: if/else 18 (44 pts), loops 4 (15 pts), boolean chains 5 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
StandardBounds._getFunctionStandardUpperBound (cognitive 64) pkg/kernel/lib/src/standard_bounds.dart:1332— StandardBounds._getFunctionStandardUpperBound has cognitive complexity 64 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 7 (14 pts), boolean chains 8, ternaries 3 (6 pts) (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.
BytecodeGenerator.getFunctionDeclaration (cognitive 63) pkg/dart2bytecode/lib/bytecode_generator.dart:615— BytecodeGenerator.getFunctionDeclaration has cognitive complexity 63 (threshold 15). Drivers by points: if/else 33 (51 pts), boolean chains 9, loops 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.
_ChunkedJsonParser.parse (cognitive 63) sdk/lib/_internal/wasm/common/convert_patch.dart:897— _ChunkedJsonParser.parse has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (56 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (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.
AnalysisOptionsImpl.signature (cognitive 63) pkg/analyzer/lib/src/analysis_options/analysis_options.dart:299— AnalysisOptionsImpl.signature has cognitive complexity 63 (threshold 15). Drivers by points: if/else 9 (38 pts), loops 7 (17 pts), match/switch 2 (8 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisDriver._produceErrors (cognitive 63) pkg/analyzer/lib/src/dart/analysis/driver.dart:2132— AnalysisDriver._produceErrors has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (43 pts), loops 6 (20 pts) (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.
_ClassVerifier._verifyMustBeOverridden (cognitive 63) pkg/analyzer/lib/src/error/inheritance_override.dart:1050— _ClassVerifier._verifyMustBeOverridden has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (44 pts), boolean chains 11, loops 4 (7 pts), 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.
ErrorVerifier._checkUseOfDefaultValuesInParameters (cognitive 63) pkg/analyzer/lib/src/generated/error_verifier.dart:8632— ErrorVerifier._checkUseOfDefaultValuesInParameters has cognitive complexity 63 (threshold 15). Drivers by points: if/else 27 (53 pts), ternaries 1 (7 pts), boolean chains 2, loops 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_InitializerBuilder._createImplicitSuperInitializer (cognitive 63) pkg/front_end/lib/src/kernel/resolver_helpers.dart:579— _InitializerBuilder._createImplicitSuperInitializer has cognitive complexity 63 (threshold 15). Drivers by points: if/else 20 (42 pts), loops 3 (10 pts), match/switch 1 (5 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.visitClassDeclaration (cognitive 63) pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart:75— _Visitor.visitClassDeclaration has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (55 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
bin_to_assembly.Main (cognitive 63) runtime/tools/bin_to_assembly.py:15— bin_to_assembly.Main has cognitive complexity 63 (threshold 15). Drivers by points: if/else 38 (54 pts), loops 2 (6 pts), ternaries 1 (2 pts), boolean chains 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.
(anonymous) (cognitive 63) sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js:7— (anonymous) has cognitive complexity 63 (threshold 15). Drivers by points: if/else 28 (41 pts), loops 11 (15 pts), error handling 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 19). Most of this is not in the body itself: 1 of the 63 points is its own statement and the rest belongs to 27 function items inside it that branch (bubbleDown, computeCurrentScript, nextEvent, …). 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.
StackChecker.checkStackStateForAssert (cognitive 62) pkg/_fe_analyzer_shared/lib/src/util/stack_checker.dart:92— StackChecker.checkStackStateForAssert has cognitive complexity 62 (threshold 15). Drivers by points: if/else 27 (52 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts) (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.
ConstantVerifier._validateSwitchExhaustiveness (cognitive 62) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1017— ConstantVerifier._validateSwitchExhaustiveness has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 5 (11 pts), ternaries 2 (10 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PatternConverter.dispatchPattern (cognitive 62) pkg/analyzer/lib/src/generated/exhaustiveness.dart:540— PatternConverter.dispatchPattern has cognitive complexity 62 (threshold 15). Drivers by points: if/else 29 (48 pts), loops 4 (8 pts), boolean chains 6 (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.
ClosureDataBuilder._updateScopeBasedOnRtiNeed (cognitive 62) pkg/compiler/lib/src/js_model/closure.dart:256— ClosureDataBuilder._updateScopeBasedOnRtiNeed has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (58 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (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.
SsaInstructionSimplifier.visitInvokeStatic (cognitive 62) pkg/compiler/lib/src/ssa/optimize.dart:2242— SsaInstructionSimplifier.visitInvokeStatic has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (61 pts), boolean chains 1 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ResolutionWorldBuilder._getMemberUsage (cognitive 62) pkg/compiler/lib/src/universe/resolution_world_builder.dart:799— ResolutionWorldBuilder._getMemberUsage has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (52 pts), boolean chains 6, loops 1 (4 pts) (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SessionLogAnalyzer.processFile (cognitive 61) pkg/analysis_server/.agents/skills/improve-performance-with-session-log/scripts/analyze_session_log.dart:217— SessionLogAnalyzer.processFile has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (38 pts), boolean chains 20, error handling 1 (2 pts), loops 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Cookie._parseSetCookieValue (cognitive 61) sdk/lib/_http/http_headers.dart:1092— _Cookie._parseSetCookieValue has cognitive complexity 61 (threshold 15). Drivers by points: if/else 24 (43 pts), ternaries 2 (6 pts), boolean chains 5, loops 3 (4 pts), match/switch 1 (3 pts) (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.
NullSafetyDeadCodeVerifier.flowEnd (cognitive 61) pkg/analyzer/lib/src/error/dead_code_verifier.dart:214— NullSafetyDeadCodeVerifier.flowEnd has cognitive complexity 61 (threshold 15). Drivers by points: if/else 30 (53 pts), boolean chains 8 (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.
ErrorVerifier._checkForMixinWithConflictingPrivateMember (cognitive 61) pkg/analyzer/lib/src/generated/error_verifier.dart:6801— ErrorVerifier._checkForMixinWithConflictingPrivateMember has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (48 pts), loops 4 (13 pts) (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.
ConditionTargets._step (cognitive 61) pkg/compiler/lib/src/ssa/optimize.dart:4268— ConditionTargets._step has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (52 pts), boolean chains 4, ternaries 1 (4 pts), loops 1 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LibrariesSpecification.parse (cognitive 60) pkg/_fe_analyzer_shared/lib/src/util/libraries_specification.dart:200— LibrariesSpecification.parse has cognitive complexity 60 (threshold 15). Drivers by points: if/else 28 (48 pts), loops 3 (7 pts), boolean chains 3, error handling 1, ternaries 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.
InheritanceManager3._getInterfaceClass (cognitive 60) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:547— InheritanceManager3._getInterfaceClass has cognitive complexity 60 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 8 (15 pts), ternaries 2 (10 pts), boolean chains 4 (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.
CompletionTarget.forOffset (cognitive 60) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:140— CompletionTarget.forOffset has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (53 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
HValidator.visitBasicBlock (cognitive 60) pkg/compiler/lib/src/ssa/validate.dart:23— HValidator.visitBasicBlock has cognitive complexity 60 (threshold 15). Drivers by points: if/else 25 (38 pts), boolean chains 16, loops 5 (6 pts) (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.
IncrementalCompiler._computeReusedLibraries (cognitive 60) pkg/front_end/lib/src/base/incremental_compiler.dart:2660— IncrementalCompiler._computeReusedLibraries has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 9 (14 pts), boolean chains 6 (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.
ClassIdNumbering._number (cognitive 59) pkg/dart2wasm/lib/class_info.dart:819— ClassIdNumbering._number has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (42 pts), loops 5 (10 pts), ternaries 2 (6 pts), 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.
InferrerEngine._runOverAllElements (cognitive 59) pkg/compiler/lib/src/inferrer/engine.dart:358— InferrerEngine._runOverAllElements has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (47 pts), loops 6 (8 pts), boolean chains 3, ternaries 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.
InterceptorStubGenerator._fastPathForOneShotInterceptor (cognitive 59) pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart:317— InterceptorStubGenerator._fastPathForOneShotInterceptor has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (44 pts), boolean chains 13, ternaries 1 (2 pts) (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.
ProgramBuilder._buildClass (cognitive 59) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:657— ProgramBuilder._buildClass has cognitive complexity 59 (threshold 15). Drivers by points: if/else 27 (43 pts), boolean chains 10, loops 3 (4 pts), ternaries 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.
ProgramCompiler._defineClass (cognitive 59) pkg/dev_compiler/lib/src/kernel/compiler.dart:1462— ProgramCompiler._defineClass has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (32 pts), ternaries 6 (12 pts), boolean chains 8, loops 5 (7 pts) (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.
ForwardingNode.finalize (cognitive 59) pkg/front_end/lib/src/kernel/forwarding_node.dart:71— ForwardingNode.finalize has cognitive complexity 59 (threshold 15). Drivers by points: if/else 21 (35 pts), boolean chains 19, match/switch 1 (5 pts) (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.
idlsync.copy_files (cognitive 59) tools/dom/scripts/idlsync.py:157— idlsync.copy_files has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (53 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ChunkedJsonParser.parse (cognitive 58) sdk/lib/_internal/vm/lib/convert_patch.dart:819— _ChunkedJsonParser.parse has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (52 pts), loops 2 (3 pts), match/switch 1 (2 pts), 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.
Evaluator._visitElements (cognitive 58) pkg/_fe_analyzer_shared/lib/src/metadata/evaluate.dart:442— Evaluator._visitElements has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 7 (25 pts), ternaries 1 (4 pts), loops 1 (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.
StatementCompletionProcessor._complete_tryStatement (cognitive 58) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:1029— StatementCompletionProcessor._complete_tryStatement has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (56 pts), boolean chains 2 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AddLate.compute (cognitive 58) pkg/analysis_server/lib/src/services/correction/dart/add_late.dart:35— AddLate.compute has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (49 pts), boolean chains 9 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RemoveUnusedField.compute (cognitive 58) pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart:120— RemoveUnusedField.compute has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 9, match/switch 2 (8 pts), loops 3 (6 pts) (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.
_SignatureUpdater.updateDeclaration (cognitive 58) pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart:782— _SignatureUpdater.updateDeclaration has cognitive complexity 58 (threshold 15). Drivers by points: if/else 29 (46 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (3 pts), match/switch 1 (2 pts) (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.
InheritanceManager3._getInterfaceExtensionType (cognitive 58) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:746— InheritanceManager3._getInterfaceExtensionType has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (42 pts), loops 9 (11 pts), boolean chains 3, match/switch 1 (2 pts) (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.
SubtypeHelper._isFunctionSubtypeOf (cognitive 58) pkg/analyzer/lib/src/dart/element/subtype.dart:85— SubtypeHelper._isFunctionSubtypeOf has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (49 pts), match/switch 1 (4 pts), boolean chains 3, loops 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.
UseResultVerifier._isUsed (cognitive 58) pkg/analyzer/lib/src/error/use_result_verifier.dart:214— UseResultVerifier._isUsed has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 49, if/else 8 (9 pts) (nesting depth added 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.
SsaSimplifyInterceptors.visitInterceptor (cognitive 58) pkg/compiler/lib/src/ssa/interceptor_simplifier.dart:235— SsaSimplifyInterceptors.visitInterceptor has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (40 pts), boolean chains 13, loops 2 (5 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantsTransformer.visitSwitchExpression (cognitive 58) pkg/front_end/lib/src/kernel/constant_evaluator.dart:2001— ConstantsTransformer.visitSwitchExpression has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 6 (11 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantEvaluator.handleConstructorInvocation (cognitive 58) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3732— ConstantEvaluator.handleConstructorInvocation has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (48 pts), loops 6, match/switch 1 (2 pts), ternaries 1 (2 pts) (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.
JsInteropChecks.visitProcedure (cognitive 57) pkg/_js_interop_checks/lib/js_interop_checks.dart:312— JsInteropChecks.visitProcedure has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 23 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FlutterConvertToStatelessWidget.compute (cognitive 57) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:31— FlutterConvertToStatelessWidget.compute has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (44 pts), boolean chains 7, loops 4 (6 pts) (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.
MethodInvocationResolver.resolveUnqualified (cognitive 57) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:380— MethodInvocationResolver.resolveUnqualified has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 18, ternaries 1 (3 pts) (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.
LibraryManifestBuilder._buildManifests (cognitive 57) pkg/analyzer/lib/src/fine/library_manifest.dart:888— LibraryManifestBuilder._buildManifests has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 13 (26 pts), 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.
SsaInstructionSelection._followingSameFaultInstruction (cognitive 57) pkg/compiler/lib/src/ssa/codegen_helpers.dart:106— SsaInstructionSelection._followingSameFaultInstruction has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (49 pts), ternaries 1 (5 pts), boolean chains 2, loops 1 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartDebugAdapter.variablesRequest (cognitive 57) pkg/dap_adapters/lib/src/adapters/dart.dart:2264— DartDebugAdapter.variablesRequest has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 8 (20 pts), boolean chains 7, error handling 2 (4 pts), match/switch 1 (2 pts) (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.
ConstantEvaluator.visitStaticInvocation (cognitive 57) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5181— ConstantEvaluator.visitStaticInvocation has cognitive complexity 57 (threshold 15). Drivers by points: if/else 29 (52 pts), boolean chains 5 (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.
CfeTypeOperations.getFieldTypes (cognitive 57) pkg/front_end/lib/src/kernel/exhaustiveness.dart:126— CfeTypeOperations.getFieldTypes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 7 (16 pts), match/switch 1 (3 pts), boolean chains 2 (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.
minimize.minimize (cognitive 57) runtime/tools/dartfuzz/minimize.py:198— minimize.minimize has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (46 pts), boolean chains 10, loops 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DatabaseBuilder._merge_nodes (cognitive 57) tools/dom/scripts/databasebuilder.py:361— DatabaseBuilder._merge_nodes has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (45 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Primitives._generalApplyFunction (cognitive 56) sdk/lib/_internal/js_runtime/lib/js_helper.dart:1097— Primitives._generalApplyFunction has cognitive complexity 56 (threshold 15). Drivers by points: if/else 24 (47 pts), loops 2 (6 pts), boolean chains 2, ternaries 1 (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.
_BigIntImpl.modPow (cognitive 56) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1939— _BigIntImpl.modPow has cognitive complexity 56 (threshold 15). Drivers by points: if/else 22 (33 pts), loops 8 (17 pts), boolean chains 4, ternaries 1 (2 pts) (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.
MemorySet.intersectionFor (cognitive 56) pkg/compiler/lib/src/ssa/optimize.dart:5097— MemorySet.intersectionFor has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (53 pts), loops 2 (3 pts) (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClassHierarchyNodeBuilder.build (cognitive 56) pkg/front_end/lib/src/kernel/hierarchy/hierarchy_node.dart:128— ClassHierarchyNodeBuilder.build has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 4 (18 pts), ternaries 1 (4 pts) (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Translator.translateStorageType (cognitive 55) pkg/dart2wasm/lib/translator.dart:1050— Translator.translateStorageType has cognitive complexity 55 (threshold 15). Drivers by points: if/else 22 (41 pts), ternaries 3 (6 pts), boolean chains 5, loops 1 (3 pts) (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.
Parser.parseArgumentOrIndexStar (cognitive 55) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7995— Parser.parseArgumentOrIndexStar has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (51 pts), boolean chains 3, 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.
_AddDigitSeparators.compute (cognitive 55) pkg/analysis_server/lib/src/services/correction/dart/add_digit_separators.dart:67— _AddDigitSeparators.compute has cognitive complexity 55 (threshold 15). Drivers by points: if/else 23 (46 pts), boolean chains 6, ternaries 1 (3 pts) (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.
ElementMatcher.matches (cognitive 55) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart:52— ElementMatcher.matches has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 6 (17 pts), boolean chains 3 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExtractLocalRefactoringImpl._checkSelection (cognitive 55) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart:269— ExtractLocalRefactoringImpl._checkSelection has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (40 pts), boolean chains 14, 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.
LeastUpperBoundHelper._functionType (cognitive 55) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:674— LeastUpperBoundHelper._functionType has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (44 pts), ternaries 1 (5 pts), boolean chains 3, loops 3 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErrorVerifier._checkForAllMixinErrorCodes (cognitive 55) pkg/analyzer/lib/src/generated/error_verifier.dart:2967— ErrorVerifier._checkForAllMixinErrorCodes has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (49 pts), boolean chains 5, loops 1 (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CompletionTarget.computeReplacementRange (cognitive 55) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:498— CompletionTarget.computeReplacementRange has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 8, loops 2 (8 pts), ternaries 2 (4 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NativeEmitter.prepareNativeClasses (cognitive 55) pkg/compiler/lib/src/js_emitter/native_emitter.dart:41— NativeEmitter.prepareNativeClasses has cognitive complexity 55 (threshold 15). Drivers by points: if/else 25 (38 pts), boolean chains 10, loops 4 (7 pts) (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.
_FlowAnalysisImpl._getNonPromotionReasons (cognitive 54) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:8681— _FlowAnalysisImpl._getNonPromotionReasons has cognitive complexity 54 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 5 (20 pts), ternaries 2 (9 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeFractionPart (cognitive 54) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1695— AbstractScanner.tokenizeFractionPart has cognitive complexity 54 (threshold 15). Drivers by points: if/else 13 (33 pts), boolean chains 7, loops 3 (7 pts), ternaries 2 (7 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InScopeCompletionPass.visitClassDeclaration (cognitive 54) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:652— InScopeCompletionPass.visitClassDeclaration has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (44 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InScopeCompletionPass.visitSwitchPatternCase (cognitive 54) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:3155— InScopeCompletionPass.visitSwitchPatternCase has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (48 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BulkFixProcessor._computeChangesToPubspec (cognitive 54) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:423— BulkFixProcessor._computeChangesToPubspec has cognitive complexity 54 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 6 (16 pts), ternaries 2 (7 pts), boolean chains 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.
AddNullCheck.compute (cognitive 54) pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart:78— AddNullCheck.compute has cognitive complexity 54 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 19, ternaries 1 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ResolverVisitor.resolveArgumentsToParameters (cognitive 54) pkg/analyzer/lib/src/generated/resolver.dart:6183— ResolverVisitor.resolveArgumentsToParameters has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (36 pts), ternaries 3 (10 pts), boolean chains 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.
CodegenWorldBuilder._getMemberUsage (cognitive 54) pkg/compiler/lib/src/universe/codegen_world_builder.dart:495— CodegenWorldBuilder._getMemberUsage has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (47 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BodyBuilderImpl.endSwitchCase (cognitive 54) pkg/front_end/lib/src/kernel/body_builder.dart:5435— BodyBuilderImpl.endSwitchCase has cognitive complexity 54 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 6 (14 pts), boolean chains 9 (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.
_Visitor._tryFixingMethodInvocation (cognitive 53) pkg/analyzer_utilities/tool/messages/use_literate_api_in_analyzer.dart:211— _Visitor._tryFixingMethodInvocation has cognitive complexity 53 (threshold 15). Drivers by points: if/else 25 (47 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (2 pts) (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.
int._parseRadix (cognitive 53) sdk/lib/_internal/vm_shared/lib/integers_patch.dart:153— int._parseRadix has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), ternaries 3 (8 pts), boolean chains 5, loops 4 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Utf8Decoder.decodeGeneral (cognitive 53) sdk/lib/convert/utf.dart:575— _Utf8Decoder.decodeGeneral has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 4 (10 pts), match/switch 1 (5 pts), ternaries 1 (3 pts), 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.
Parser.parseLiteralSetOrMapSuffix (cognitive 53) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8555— Parser.parseLiteralSetOrMapSuffix has cognitive complexity 53 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CompletionResolveHandler.resolveDartCompletion (cognitive 53) pkg/analysis_server/lib/src/lsp/handlers/handler_completion_resolve.dart:60— CompletionResolveHandler.resolveDartCompletion has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (33 pts), ternaries 2 (7 pts), boolean chains 6, loops 2 (5 pts), error handling 1 (2 pts) (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.
ResultMerger.mergeNavigation (cognitive 53) pkg/analysis_server/lib/src/plugin/result_merger.dart:198— ResultMerger.mergeNavigation has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (38 pts), loops 7 (13 pts), boolean chains 2 (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.
ConvertNullCheckToNullAwareElementOrEntry.compute (cognitive 53) pkg/analysis_server/lib/src/services/correction/dart/convert_null_check_to_null_aware_element_or_entry.dart:29— ConvertNullCheckToNullAwareElementOrEntry.compute has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (35 pts), ternaries 3 (12 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InlineTypedef.compute (cognitive 53) pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart:32— InlineTypedef.compute has cognitive complexity 53 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 3, loops 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.
DillLibraryBuilder.ensureLoaded (cognitive 53) pkg/front_end/lib/src/dill/dill_library_builder.dart:203— DillLibraryBuilder.ensureLoaded has cognitive complexity 53 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 8, loops 7, ternaries 1 (3 pts), match/switch 1 (2 pts) (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.
InferenceVisitorImpl.visitRecordLiteral (cognitive 53) pkg/front_end/lib/src/type_inference/inference_visitor.dart:11054— InferenceVisitorImpl.visitRecordLiteral has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 5 (10 pts), boolean chains 5, match/switch 2 (5 pts) (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.
InstanceViewElement._createMembers (cognitive 53) pkg/observatory/lib/src/elements/instance_view.dart:220— InstanceViewElement._createMembers has cognitive complexity 53 (threshold 15). Drivers by points: if/else 31 (39 pts), ternaries 4 (8 pts), boolean chains 6 (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.
Base64Codec.normalize (cognitive 52) sdk/lib/convert/base64.dart:85— Base64Codec.normalize has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (44 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 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.
AbstractScanner._spacesAtStartOfLogicalLineOf (cognitive 52) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:405— AbstractScanner._spacesAtStartOfLogicalLineOf has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 11, loops 2 (4 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Features.getText (cognitive 52) pkg/_fe_analyzer_shared/lib/src/testing/features.dart:80— Features.getText has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (48 pts), loops 2 (4 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Features.fromText (cognitive 52) pkg/_fe_analyzer_shared/lib/src/testing/features.dart:155— Features.fromText has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (44 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartUnitHoverComputer.compute (cognitive 52) pkg/analysis_server/lib/src/computer/computer_hover.dart:31— DartUnitHoverComputer.compute has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 25, if/else 11 (24 pts), loops 1 (3 pts) (nesting depth added 15). 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.
_MinimalEditComputer.computeMinimalEdits (cognitive 52) pkg/analysis_server/lib/src/lsp/source_edits.dart:297— _MinimalEditComputer.computeMinimalEdits has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (39 pts), loops 4 (7 pts), boolean chains 6 (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.
ConvertToNamedArguments.compute (cognitive 52) pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart:25— ConvertToNamedArguments.compute has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (40 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RemoveUnusedParameter.compute (cognitive 52) pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart:27— RemoveUnusedParameter.compute has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (44 pts), boolean chains 6, ternaries 1 (2 pts) (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.
ElementUsageDetector.checkUsage (cognitive 52) pkg/analyzer/lib/src/error/element_usage_detector.dart:73— ElementUsageDetector.checkUsage has cognitive complexity 52 (threshold 15). Drivers by points: if/else 30 (43 pts), boolean chains 5, loops 3 (4 pts) (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.
_Finder._visit (cognitive 52) pkg/analyzer/lib/src/summary2/type_alias.dart:83— _Finder._visit has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (50 pts), loops 1 (2 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaPhiConditioning.handlePhi (cognitive 52) pkg/compiler/lib/src/ssa/codegen_helpers.dart:1485— SsaPhiConditioning.handlePhi has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 6 (13 pts), boolean chains 3 (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.
ResolutionWorldBuilder._processMemberInUsedClass (cognitive 52) pkg/compiler/lib/src/universe/resolution_world_builder.dart:886— ResolutionWorldBuilder._processMemberInUsedClass has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (45 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.tokenizeFractionPart (cognitive 51) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:1095— AbstractScanner.tokenizeFractionPart has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 3 (7 pts), boolean chains 4, ternaries 1 (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.
_Utf8Decoder._convertChunkInternal (cognitive 51) sdk/lib/_internal/wasm/common/convert_patch.dart:2398— _Utf8Decoder._convertChunkInternal has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 4 (13 pts), boolean chains 4, match/switch 1 (2 pts), 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.
Stdin.readLineSync (cognitive 51) sdk/lib/io/stdio.dart:46— Stdin.readLineSync has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 4 (10 pts), boolean chains 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.
ColorComputer._getDartUiColor (cognitive 51) pkg/analysis_server/lib/src/computer/computer_color.dart:269— ColorComputer._getDartUiColor has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 15 (32 pts), boolean chains 9, if/else 5, match/switch 1 (3 pts), loops 1 (2 pts) (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.
FlutterOutlineComputer._createOutline (cognitive 51) pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart:137— FlutterOutlineComputer._createOutline has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (41 pts), loops 2 (7 pts), boolean chains 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.
ConvertToFunctionDeclaration.compute (cognitive 51) pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart:30— ConvertToFunctionDeclaration.compute has cognitive complexity 51 (threshold 15). Drivers by points: if/else 30 (47 pts), loops 1 (3 pts), 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.
IgnoreValidator._reportUnnecessaryOrRemovedOrDeprecatedIgnores (cognitive 51) pkg/analyzer/lib/src/error/ignore_validator.dart:198— IgnoreValidator._reportUnnecessaryOrRemovedOrDeprecatedIgnores has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (39 pts), ternaries 2 (8 pts), loops 2 (4 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ReturnTypeVerifier._checkReturnExpression (cognitive 51) pkg/analyzer/lib/src/error/return_type_verifier.dart:125— ReturnTypeVerifier._checkReturnExpression has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 4 (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.
ErrorVerifier._checkForConflictingInitializerErrorCodes (cognitive 51) pkg/analyzer/lib/src/generated/error_verifier.dart:4420— ErrorVerifier._checkForConflictingInitializerErrorCodes has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (45 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Linker._computeRedirectingConstructorCycles (cognitive 51) pkg/analyzer/lib/src/summary2/link.dart:343— Linker._computeRedirectingConstructorCycles has cognitive complexity 51 (threshold 15). Drivers by points: if/else 6 (32 pts), loops 5 (18 pts), boolean chains 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.
ClassHierarchyImpl.commonSubclasses (cognitive 51) pkg/compiler/lib/src/universe/class_hierarchy.dart:449— ClassHierarchyImpl.commonSubclasses has cognitive complexity 51 (threshold 15). Drivers by points: if/else 27 (47 pts), boolean chains 4 (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.
SourceLibraryBuilder.computeFieldPromotability (cognitive 51) pkg/front_end/lib/src/source/source_library_builder.dart:829— SourceLibraryBuilder.computeFieldPromotability has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 6 (9 pts), ternaries 2 (8 pts), 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.
SourceTypeAliasBuilder.buildTypedefTearOffs (cognitive 51) pkg/front_end/lib/src/source/source_type_alias_builder.dart:462— SourceTypeAliasBuilder.buildTypedefTearOffs has cognitive complexity 51 (threshold 15). Drivers by points: if/else 9 (37 pts), boolean chains 7, loops 2 (6 pts), match/switch 1 (nesting depth added 32). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
InferenceVisitorBase.inferLocalFunction (cognitive 51) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2225— InferenceVisitorBase.inferLocalFunction has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 10 (14 pts), boolean chains 7 (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.
_Visitor.getInvalidJsInteropTypeTest (cognitive 51) pkg/linter/lib/src/rules/invalid_runtime_check_with_js_interop_types.dart:278— _Visitor.getInvalidJsInteropTypeTest has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 13 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_FfiDefinitionTransformer._findFields (cognitive 50) pkg/vm/lib/modular/transformations/ffi/definitions.dart:691— _FfiDefinitionTransformer._findFields has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (41 pts), boolean chains 6, loops 2, ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parseTypedef (cognitive 50) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:1449— Parser.parseTypedef has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 8 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ComplexTypeInfo.computeRecordType (cognitive 50) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:756— ComplexTypeInfo.computeRecordType has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 28, if/else 12 (22 pts) (nesting depth added 10). 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.
TypeConstraintGenerator._handleNonGenericFunctionTypes (cognitive 50) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:2574— TypeConstraintGenerator._handleNonGenericFunctionTypes has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 8, loops 3 (6 pts) (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.
ErrorVerifier._checkForFinalSupertypeOutsideOfLibrary (cognitive 50) pkg/analyzer/lib/src/generated/error_verifier.dart:5758— ErrorVerifier._checkForFinalSupertypeOutsideOfLibrary has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (29 pts), boolean chains 13, loops 3 (8 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProtocolConverter.convertVmInstanceToVariablesList (cognitive 50) pkg/dap_adapters/lib/src/protocol_converter.dart:128— ProtocolConverter.convertVmInstanceToVariablesList has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 7 (16 pts), boolean chains 15, error handling 1 (3 pts) (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.
LibraryCompiler._defineClass (cognitive 50) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1792— LibraryCompiler._defineClass has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 5 (11 pts), loops 5 (7 pts), boolean chains 5 (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.
RecordTypeBuilderImpl.buildAliased (cognitive 50) pkg/front_end/lib/src/builder/record_type_builder.dart:159— RecordTypeBuilderImpl.buildAliased has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (42 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
InferenceVisitorBase._findExtensionMember (cognitive 50) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:1180— InferenceVisitorBase._findExtensionMember has cognitive complexity 50 (threshold 15). Drivers by points: if/else 24 (41 pts), loops 2 (5 pts), boolean chains 4 (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.
_DirectInvocation._processFunction (cognitive 50) pkg/vm/lib/transformations/type_flow/analysis.dart:384— _DirectInvocation._processFunction has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (33 pts), boolean chains 9, loops 1 (5 pts), ternaries 1 (3 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Transform.transformMemberSignature (cognitive 50) pkg/vm/lib/transformations/type_flow/signature_shaking.dart:405— _Transform.transformMemberSignature has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (44 pts), loops 4, boolean chains 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.
HtmlDartInterfaceGenerator.GenerateInterface (cognitive 50) tools/dom/scripts/systemhtml.py:659— HtmlDartInterfaceGenerator.GenerateInterface has cognitive complexity 50 (threshold 15). Drivers by points: if/else 28 (35 pts), boolean chains 12, loops 2, ternaries 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Configuration.parse (cognitive 49) pkg/smith/lib/configuration.dart:107— Configuration.parse has cognitive complexity 49 (threshold 15). Drivers by points: if/else 34 (42 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_WebSocketOutgoingTransformer.createFrame (cognitive 49) sdk/lib/_http/websocket_impl.dart:1089— _WebSocketOutgoingTransformer.createFrame has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 5 (17 pts), ternaries 3, 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.
Future.wait (cognitive 49) sdk/lib/async/future.dart:472— Future.wait has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 3 (10 pts), boolean chains 5, error handling 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.
_Algorithm._filterUserConstraints (cognitive 49) pkg/dart2wasm/lib/deferred_load/partition.dart:318— _Algorithm._filterUserConstraints has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 6 (9 pts), boolean chains 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.
Parser.parseArgumentsRest (cognitive 49) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9511— Parser.parseArgumentsRest has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (44 pts), boolean chains 4, loops 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.bigSwitch (cognitive 49) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1093— AbstractScanner.bigSwitch has cognitive complexity 49 (threshold 15). Drivers by points: if/else 39 (41 pts), boolean chains 8 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
InScopeCompletionPass.visitExpressionStatement (cognitive 49) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1168— InScopeCompletionPass.visitExpressionStatement has cognitive complexity 49 (threshold 15). Drivers by points: if/else 30 (43 pts), boolean chains 3, match/switch 1 (3 pts) (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.
PropertyElementResolver._resolveTargetInterfaceElement (cognitive 49) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:2243— PropertyElementResolver._resolveTargetInterfaceElement has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (43 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_IRInterpreter.run (cognitive 49) pkg/analyzer/lib/src/wolf/ir/interpreter.dart:261— _IRInterpreter.run has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 4 (10 pts), match/switch 2 (6 pts), 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.
SsaAssignmentChaining.tryChainAssignment (cognitive 49) pkg/compiler/lib/src/ssa/codegen_helpers.dart:687— SsaAssignmentChaining.tryChainAssignment has cognitive complexity 49 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 10, 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.
ProgramCompiler._emitBinaryOperator (cognitive 49) pkg/dev_compiler/lib/src/kernel/compiler.dart:6341— ProgramCompiler._emitBinaryOperator has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (29 pts), ternaries 3 (12 pts), boolean chains 5, match/switch 1 (3 pts) (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.
LibraryCompiler._emitBinaryOperator (cognitive 49) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7030— LibraryCompiler._emitBinaryOperator has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (29 pts), ternaries 3 (12 pts), boolean chains 5, match/switch 1 (3 pts) (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.
_LibraryVirtualFieldModel.build (cognitive 49) pkg/dev_compiler/lib/src/kernel/property_model.dart:61— _LibraryVirtualFieldModel.build has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (32 pts), boolean chains 10, loops 5 (7 pts) (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.
_CodeGenerator.extractIdl (cognitive 48) pkg/analyzer/tool/summary/generate.dart:590— _CodeGenerator.extractIdl has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 4 (10 pts), boolean chains 7 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BytecodeGenerator._genPrologue (cognitive 48) pkg/dart2bytecode/lib/bytecode_generator.dart:2152— BytecodeGenerator._genPrologue has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 4 (10 pts), boolean chains 5, ternaries 2 (4 pts) (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.
_Utf8Decoder._decodeGeneral (cognitive 48) sdk/lib/_internal/wasm/common/convert_patch.dart:2725— _Utf8Decoder._decodeGeneral has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 4 (9 pts), match/switch 1 (5 pts), ternaries 1 (3 pts), 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.
Uri.parseIPv6Address (cognitive 48) sdk/lib/core/uri.dart:1611— Uri.parseIPv6Address has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (45 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parseStatementX (cognitive 48) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6720— Parser.parseStatementX has cognitive complexity 48 (threshold 15). Drivers by points: if/else 31 (42 pts), boolean chains 4, match/switch 1 (2 pts) (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.
StatementCompletionProcessor.compute (cognitive 48) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:169— StatementCompletionProcessor.compute has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 17, ternaries 1 (2 pts), 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.
KernelSsaGraphBuilder.build (cognitive 48) pkg/compiler/lib/src/ssa/builder.dart:461— KernelSsaGraphBuilder.build has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 5, 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.
SsaConditionMerger.visitBasicBlock (cognitive 48) pkg/compiler/lib/src/ssa/codegen_helpers.dart:1303— SsaConditionMerger.visitBasicBlock has cognitive complexity 48 (threshold 15). Drivers by points: if/else 24 (42 pts), boolean chains 4, 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.
IncrementalCompiler.updateNeededDillLibrariesWithHierarchy (cognitive 48) pkg/front_end/lib/src/base/incremental_compiler.dart:1605— IncrementalCompiler.updateNeededDillLibrariesWithHierarchy has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 5 (12 pts), boolean chains 4 (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.
NameSection.deserialize (cognitive 48) pkg/wasm_builder/lib/src/serialize/sections.dart:1043— NameSection.deserialize has cognitive complexity 48 (threshold 15). Drivers by points: loops 9 (31 pts), if/else 6 (15 pts), match/switch 1 (2 pts) (nesting depth added 32). 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.
WidgetCreatorTracker._resolveWellKnownClasses (cognitive 48) pkg/kernel/lib/transformations/track_widget_constructor_locations.dart:389— WidgetCreatorTracker._resolveWellKnownClasses has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 4 (13 pts), boolean chains 5 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SharedInteropTransformer._createIsACheck (cognitive 47) pkg/_js_interop_checks/lib/src/transformations/shared_interop_transformer.dart:713— SharedInteropTransformer._createIsACheck has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 11 (18 pts), loops 1 (2 pts), 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.
ResolverVisitor.visitAnonymousMethodInvocation (cognitive 47) pkg/analyzer/lib/src/generated/resolver.dart:2123— ResolverVisitor.visitAnonymousMethodInvocation has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (32 pts), ternaries 3 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NativeBehavior.processSpecString (cognitive 47) pkg/compiler/lib/src/native/behavior.dart:221— NativeBehavior.processSpecString has cognitive complexity 47 (threshold 15). Drivers by points: if/else 30 (41 pts), boolean chains 4, 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.
CompileWasmCommand.run (cognitive 47) pkg/dartdev/lib/src/commands/compile.dart:942— CompileWasmCommand.run has cognitive complexity 47 (threshold 15). Drivers by points: if/else 30 (37 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IncrementalCompiler._computeTransitiveClosure (cognitive 47) pkg/front_end/lib/src/base/incremental_compiler.dart:1773— IncrementalCompiler._computeTransitiveClosure has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 8 (15 pts), boolean chains 2 (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.
_InitializationFromExperimentalCache.loadLibrariesFromCache (cognitive 47) pkg/front_end/lib/src/base/incremental_compiler.dart:3663— _InitializationFromExperimentalCache.loadLibrariesFromCache has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 7 (16 pts), error handling 1 (2 pts), boolean chains 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.
_DispatchableInvocation.process (cognitive 47) pkg/vm/lib/transformations/type_flow/analysis.dart:538— _DispatchableInvocation.process has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (45 pts), boolean chains 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.
(anonymous) (cognitive 47) REDACTED:792— (anonymous) has cognitive complexity 47 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 7, loops 4, ternaries 3 (nesting depth added 6). Most of this is not in the body itself: 4 of the 47 points are its own statements and the rest belongs to 28 function items inside it that branch (addScriptsToQueue, processAfterLoadOrErrorEvent, getScriptUrl, …). 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.
JSNumber._binaryGcd (cognitive 46) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:534— JSNumber._binaryGcd has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 4 (7 pts), boolean chains 3 (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.
JSInt._binaryGcd (cognitive 46) sdk/lib/_internal/js_runtime/lib/js_number.dart:625— JSInt._binaryGcd has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 4 (7 pts), boolean chains 3 (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.
_IntegerImplementation._binaryGcd (cognitive 46) sdk/lib/_internal/vm/lib/integers.dart:444— _IntegerImplementation._binaryGcd has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 4 (7 pts), boolean chains 3 (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.
BoxedInt._binaryGcd (cognitive 46) sdk/lib/_internal/wasm/common/boxed_int.dart:337— BoxedInt._binaryGcd has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 4 (7 pts), boolean chains 3 (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.
_ChunkedJsonParser.parse (cognitive 46) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:772— _ChunkedJsonParser.parse has cognitive complexity 46 (threshold 15). Drivers by points: if/else 20 (43 pts), match/switch 1 (2 pts), 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.
AstToIr._translateConstructorInitializers (cognitive 46) pkg/cfg/lib/front_end/ast_to_ir.dart:341— AstToIr._translateConstructorInitializers has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (43 pts), loops 2 (3 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DeclarationHelper._addStaticMembers (cognitive 46) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1633— DeclarationHelper._addStaticMembers has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 18, loops 5 (7 pts) (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.
AddAsync.compute (cognitive 46) pkg/analysis_server/lib/src/services/correction/dart/add_async.dart:35— AddAsync.compute has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (40 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
AddMissingRequiredArgument.compute (cognitive 46) pkg/analysis_server/lib/src/services/correction/dart/add_missing_required_argument.dart:48— AddMissingRequiredArgument.compute has cognitive complexity 46 (threshold 15). Drivers by points: if/else 25 (39 pts), boolean chains 6, 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.
_ConstLiteralVerifier.verify (cognitive 46) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1243— _ConstLiteralVerifier.verify has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (42 pts), 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.
BaseOrFinalTypeVerifier._reportRestrictionError (cognitive 46) pkg/analyzer/lib/src/error/base_or_final_type_verifier.dart:175— BaseOrFinalTypeVerifier._reportRestrictionError has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 5 (15 pts), boolean chains 11 (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.
DefaultTypesBuilder._findRawTypePathsToDeclaration (cognitive 46) pkg/analyzer/lib/src/summary2/default_types_builder.dart:205— DefaultTypesBuilder._findRawTypePathsToDeclaration has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 5 (18 pts) (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DillClassBuilder.DillClassBuilder (cognitive 46) pkg/front_end/lib/src/dill/dill_class_builder.dart:39— DillClassBuilder.DillClassBuilder has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 4, loops 4, match/switch 1 (2 pts) (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.
DartScopeBuilder2._looksLikeLateLoweredField (cognitive 46) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:889— DartScopeBuilder2._looksLikeLateLoweredField has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 23, if/else 7 (15 pts), loops 3 (8 pts) (nesting depth added 13). 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.
_Overrides.collectOverrides (cognitive 46) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:2935— _Overrides.collectOverrides has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 2 (10 pts), boolean chains 3 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OutlineBuilder.endMethod (cognitive 46) pkg/front_end/lib/src/source/outline_builder.dart:2373— OutlineBuilder.endMethod has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 4, loops 1 (4 pts), match/switch 1 (3 pts) (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.
_Visitor._visitVariableDeclarationList (cognitive 46) pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart:59— _Visitor._visitVariableDeclarationList has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 3 (9 pts), match/switch 1 (4 pts), boolean chains 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.
VarianceChecker.check (cognitive 46) pkg/linter/lib/src/util/variance_checker.dart:37— VarianceChecker.check has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 5 (15 pts), match/switch 2 (5 pts), boolean chains 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.
OperationInfo.ParametersAsListOfVariables (cognitive 46) tools/dom/scripts/generator.py:873— OperationInfo.ParametersAsListOfVariables has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (36 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Class.test (cognitive 45) pkg/front_end/testcases/general/for_in.dart:295— Class.test has cognitive complexity 45 (threshold 15). Drivers by points: loops 45. 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.
DeeplyImmutableValidator._validateDeeplyImmutable (cognitive 45) pkg/vm/lib/modular/transformations/deeply_immutable.dart:129— DeeplyImmutableValidator._validateDeeplyImmutable has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 12, loops 4 (7 pts) (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.
CheckNameResponse.computeRenameRanges2 (cognitive 45) pkg/analysis_server/lib/src/cider/rename.dart:125— CheckNameResponse.computeRenameRanges2 has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 5 (12 pts), ternaries 1 (4 pts), 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.
DeclarationHelper._addExtensionMembers (cognitive 45) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:857— DeclarationHelper._addExtensionMembers has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 4 (9 pts), boolean chains 3, ternaries 1 (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.
RemoveAsync.compute (cognitive 45) pkg/analysis_server/lib/src/services/correction/dart/remove_async.dart:38— RemoveAsync.compute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 6, match/switch 1 (2 pts), ternaries 1 (2 pts) (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.
_ReferenceProcessor._process (cognitive 45) pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart:958— _ReferenceProcessor._process has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (45 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantEvaluationEngine.computeConstantValue (cognitive 45) pkg/analyzer/lib/src/dart/constant/evaluation.dart:84— ConstantEvaluationEngine.computeConstantValue has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (43 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GreatestLowerBoundHelper._functionType (cognitive 45) pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart:251— GreatestLowerBoundHelper._functionType has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 2 (9 pts), boolean chains 4, loops 3 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnnotationResolver._resolve (cognitive 45) pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart:222— AnnotationResolver._resolve has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (42 pts), 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.
FullInvocationInferrer.resolveInvocation (cognitive 45) pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart:274— FullInvocationInferrer.resolveInvocation has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 2 (6 pts), boolean chains 5, ternaries 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.
MethodInvocationResolver._resolveInstanceInvocation (cognitive 45) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:975— MethodInvocationResolver._resolveInstanceInvocation has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 15, ternaries 1 (3 pts) (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.
DynamicCallSiteTypeInformation.handleIntrinsifiedSelector (cognitive 45) pkg/compiler/lib/src/inferrer/type_graph_nodes.dart:1321— DynamicCallSiteTypeInformation.handleIntrinsifiedSelector has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (35 pts), boolean chains 6, ternaries 2 (3 pts), 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.
DynamicCallSiteTypeInformation.computeType (cognitive 45) pkg/compiler/lib/src/inferrer/type_graph_nodes.dart:1431— DynamicCallSiteTypeInformation.computeType has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (40 pts), boolean chains 5 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DillLibraryBuilder.finalizeExports (cognitive 45) pkg/front_end/lib/src/dill/dill_library_builder.dart:460— DillLibraryBuilder.finalizeExports has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 11, 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.
Resolver._finishFunction (cognitive 45) pkg/front_end/lib/src/kernel/resolver.dart:1413— Resolver._finishFunction has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (35 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (2 pts) (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.
SourceClassBuilder.checkOverride (cognitive 45) pkg/front_end/lib/src/source/source_class_builder.dart:1493— SourceClassBuilder.checkOverride has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 18 (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.
StandardBounds._getLegacyLeastUpperBound (cognitive 45) pkg/kernel/lib/src/standard_bounds.dart:978— StandardBounds._getLegacyLeastUpperBound has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 4 (9 pts), boolean chains 6 (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.
_Visitor._check (cognitive 45) pkg/linter/lib/src/rules/prefer_is_empty.dart:66— _Visitor._check has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (34 pts), boolean chains 11 (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.
NameSection.serializeContents (cognitive 45) pkg/wasm_builder/lib/src/serialize/sections.dart:910— NameSection.serializeContents has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 7 (16 pts), 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.
AnnotateKernel._convertType (cognitive 45) pkg/vm/lib/transformations/type_flow/transformer.dart:497— AnnotateKernel._convertType has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 10, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractScanner.bigSwitch (cognitive 44) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:429— AbstractScanner.bigSwitch has cognitive complexity 44 (threshold 15). Drivers by points: if/else 38 (39 pts), boolean chains 5 (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.
RelevanceMetricsComputer._computeInContext (cognitive 44) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2420— RelevanceMetricsComputer._computeInContext has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (12 pts), error handling 1 (3 pts) (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.
MutationRunner._runChain (cognitive 44) pkg/analyzer/tool/fine/ab_mutate.dart:250— MutationRunner._runChain has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 8 (11 pts), ternaries 3 (9 pts), boolean chains 2 (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.
AstCodeGenerator.visitSwitchStatement (cognitive 44) pkg/dart2wasm/lib/code_generator.dart:1443— AstCodeGenerator.visitSwitchStatement has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 9 (16 pts), loops 5 (9 pts), 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.
ConstantCreator._makeWasmArrayLiteral (cognitive 44) pkg/dart2wasm/lib/constants.dart:1009— ConstantCreator._makeWasmArrayLiteral has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 8 (20 pts), 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.
Analysis.transitiveGraph (cognitive 44) pkg/heap_snapshot/lib/analysis.dart:259— Analysis.transitiveGraph has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (32 pts), boolean chains 6, loops 3 (6 pts) (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.
StatusFile._parse (cognitive 44) pkg/status_file/lib/canonical_status_file.dart:93— StatusFile._parse has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 7, error handling 2 (6 pts), 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.
MultiBinaryLoader.load (cognitive 44) pkg/kernel/lib/binary/multi_binary_loader.dart:53— MultiBinaryLoader.load has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (29 pts), loops 8 (13 pts), boolean chains 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.
Parser.parseDeclarationHeaderRecoveryInternal (cognitive 44) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3172— Parser.parseDeclarationHeaderRecoveryInternal has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (34 pts), match/switch 3 (7 pts), boolean chains 2, 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.
Parser.parseExtensionDeclaration (cognitive 44) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3641— Parser.parseExtensionDeclaration has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 7, loops 1 (3 pts) (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.
StaticInteropMockValidator.validateCreateStaticInteropMock (cognitive 44) pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart:100— StaticInteropMockValidator.validateCreateStaticInteropMock has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (21 pts), ternaries 3 (15 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ResultMerger.mergeRefactoringFeedbacks (cognitive 44) pkg/analysis_server/lib/src/plugin/result_merger.dart:547— ResultMerger.mergeRefactoringFeedbacks has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 5 (12 pts), ternaries 2 (4 pts), boolean chains 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.
DeclarationHelper._visitStatements (cognitive 44) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:3124— DeclarationHelper._visitStatements has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (39 pts), loops 2 (5 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_EnumDescription.applyChanges (cognitive 44) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:193— _EnumDescription.applyChanges has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (37 pts), loops 3 (4 pts), ternaries 1 (2 pts), 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.
_ParsedPluginsData.parse (cognitive 44) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1526— _ParsedPluginsData.parse has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 2 (5 pts), match/switch 1 (2 pts) (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.
ErrorVerifier._checkForMissingEnumConstantInSwitch (cognitive 44) pkg/analyzer/lib/src/generated/error_verifier.dart:6469— ErrorVerifier._checkForMissingEnumConstantInSwitch has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (37 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FfiVerifier._checkFfiNativeFunction (cognitive 44) pkg/analyzer/lib/src/generated/ffi_verifier.dart:839— FfiVerifier._checkFfiNativeFunction has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 9, match/switch 2 (5 pts), 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.
ListTracerVisitor.visitDynamicCallSiteTypeInformation (cognitive 44) pkg/compiler/lib/src/inferrer/list_tracer.dart:175— ListTracerVisitor.visitDynamicCallSiteTypeInformation has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 5 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceFile.getLocationMessage (cognitive 44) pkg/compiler/lib/src/io/source_file.dart:97— SourceFile.getLocationMessage has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (12 pts), boolean chains 2, error handling 1 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExecutableCompiler._compileToSnapshot (cognitive 44) pkg/dartdev/lib/src/executable_compiler.dart:321— ExecutableCompiler._compileToSnapshot has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (22 pts), error handling 5 (11 pts), loops 2 (5 pts), boolean chains 4, ternaries 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.
MiniJsParser.parseStatement (cognitive 44) pkg/dev_compiler/lib/src/js_ast/builder.dart:1421— MiniJsParser.parseStatement has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (43 pts), 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.
CompilerOptions.equivalent (cognitive 44) pkg/front_end/lib/src/api_prototype/compiler_options.dart:257— CompilerOptions.equivalent has cognitive complexity 44 (threshold 15). Drivers by points: if/else 35 (44 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ChainContext.run (cognitive 44) pkg/testing/lib/src/chain.dart:149— ChainContext.run has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 9, loops 3 (5 pts), error handling 1 (3 pts) (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.
Instructions.printTo (cognitive 44) pkg/wasm_builder/lib/src/ir/instructions.dart:129— Instructions.printTo has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 20, loops 1, ternaries 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.
HtmlDartGenerator._GenerateOverloadDispatcher (cognitive 44) tools/dom/scripts/htmldartgenerator.py:359— HtmlDartGenerator._GenerateOverloadDispatcher has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (28 pts), loops 6 (16 pts) (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.
IDLNode._find_all (cognitive 44) tools/dom/scripts/idlnode.py:191— IDLNode._find_all has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 3 (12 pts), boolean chains 5 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
IDLFile.__init__ (cognitive 44) tools/dom/scripts/idlnode.py:418— IDLFile.__init__ has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 7 (18 pts), 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.
VmServiceInterfaceApi.generate (cognitive 43) pkg/vm_service/tool/dart/generate_dart_interface.dart:29— VmServiceInterfaceApi.generate has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 3 (7 pts), ternaries 1 (4 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Uri._makeHttpUri (cognitive 43) sdk/lib/core/uri.dart:2053— _Uri._makeHttpUri has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (7 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Evaluator._visitElement (cognitive 43) pkg/_fe_analyzer_shared/lib/src/metadata/evaluate.dart:551— Evaluator._visitElement has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 7 (18 pts), ternaries 1 (3 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
Parser.parseUnaryExpression (cognitive 43) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7872— Parser.parseUnaryExpression has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DeclarationHelper._suggestStaticField (cognitive 43) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2729— DeclarationHelper._suggestStaticField has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (35 pts), boolean chains 8 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PropertyDescription._changeCode (cognitive 43) pkg/analysis_server/lib/src/services/flutter/property.dart:177— PropertyDescription._changeCode has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (37 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TypeSystemImpl._refineNumericInvocationTypeNullSafe (cognitive 43) pkg/analyzer/lib/src/dart/element/type_system.dart:2056— TypeSystemImpl._refineNumericInvocationTypeNullSafe has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (33 pts), boolean chains 10 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_TodoFinder.moveNext (cognitive 43) pkg/analyzer/lib/src/error/todo_finder.dart:163— _TodoFinder.moveNext has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 18, 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.
UnusedLocalElementsVerifier._isUsedElement (cognitive 43) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:1186— UnusedLocalElementsVerifier._isUsedElement has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 6 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErrorVerifier._checkForConflictingClassMembers (cognitive 43) pkg/analyzer/lib/src/generated/error_verifier.dart:4015— ErrorVerifier._checkForConflictingClassMembers has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 4 (5 pts), match/switch 1 (3 pts), 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.
ErrorVerifier._checkForMixinClassErrorCodes (cognitive 43) pkg/analyzer/lib/src/generated/error_verifier.dart:6566— ErrorVerifier._checkForMixinClassErrorCodes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_OpTypeAstVisitor.visitArgumentList (cognitive 43) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:214— _OpTypeAstVisitor.visitArgumentList has cognitive complexity 43 (threshold 15). Drivers by points: if/else 25 (41 pts), 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.
DillExtensionBuilder.DillExtensionBuilder (cognitive 43) pkg/front_end/lib/src/dill/dill_extension_builder.dart:34— DillExtensionBuilder.DillExtensionBuilder has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (36 pts), boolean chains 4, match/switch 1 (2 pts), 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.
AsyncStateVisitor.visitBinaryExpression (cognitive 43) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:186— AsyncStateVisitor.visitBinaryExpression has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 6, match/switch 3 (6 pts) (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.
SessionLogAnalyzer.printReport (cognitive 42) pkg/analysis_server/.agents/skills/improve-performance-with-session-log/scripts/analyze_session_log.dart:116— SessionLogAnalyzer.printReport has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 6 (15 pts), boolean chains 7, loops 2 (4 pts) (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.
_ClosureArgumentsToVtableEntryDispatcherGenerator._handleOptionalNamedCase (cognitive 42) pkg/dart2wasm/lib/translator.dart:3271— _ClosureArgumentsToVtableEntryDispatcherGenerator._handleOptionalNamedCase has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (7 pts), boolean chains 1, ternaries 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClosedWorldClassHierarchy._getLegacyLeastUpperBoundInternal (cognitive 42) pkg/kernel/lib/class_hierarchy.dart:961— ClosedWorldClassHierarchy._getLegacyLeastUpperBoundInternal has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (31 pts), ternaries 2 (8 pts), boolean chains 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.
FormatException.toString (cognitive 42) sdk/lib/core/exceptions.dart:75— FormatException.toString has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 5, loops 2 (4 pts) (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.
AstToIr._buildPrologue (cognitive 42) pkg/cfg/lib/front_end/ast_to_ir.dart:143— AstToIr._buildPrologue has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (2 pts) (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.
FfiTransformer.convertNativeTypeToDartType (cognitive 42) pkg/vm/lib/modular/transformations/ffi/common.dart:1088— FfiTransformer.convertNativeTypeToDartType has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (27 pts), match/switch 3 (8 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ReorderBlocks.run (cognitive 42) pkg/native_compiler/lib/passes/reorder_blocks.dart:21— ReorderBlocks.run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 3 (10 pts), match/switch 1 (3 pts), 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.
ComplexTypeParamOrArgInfo.compute (cognitive 42) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1345— ComplexTypeParamOrArgInfo.compute has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (33 pts), boolean chains 5, loops 2 (4 pts) (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.
InScopeCompletionPass.visitForStatement (cognitive 42) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1602— InScopeCompletionPass.visitForStatement has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (31 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UriHelper._addFileSuggestions (cognitive 42) pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart:82— UriHelper._addFileSuggestions has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 4, loops 1 (3 pts), error handling 1 (2 pts), ternaries 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.
YamlCompletionGenerator._siblingsOnPath (cognitive 42) pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart:220— YamlCompletionGenerator._siblingsOnPath has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AddSuperParameter._addToConstructor (cognitive 42) pkg/analysis_server/lib/src/services/correction/dart/add_super_parameter.dart:62— AddSuperParameter._addToConstructor has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (32 pts), ternaries 2 (5 pts), boolean chains 3, 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.
ConvertToCascade.compute (cognitive 42) pkg/analysis_server/lib/src/services/correction/dart/convert_to_cascade.dart:26— ConvertToCascade.compute has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 2, ternaries 1 (2 pts), 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.
_EdgeInsetsProperty.changeValue (cognitive 42) pkg/analysis_server/lib/src/services/flutter/property.dart:514— _EdgeInsetsProperty.changeValue has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 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.
ExtractWidgetRefactoringImpl._initializeParameters (cognitive 42) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:276— ExtractWidgetRefactoringImpl._initializeParameters has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 6 (12 pts), ternaries 1 (5 pts), 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.
RenameRefactoring.getElementToRename (cognitive 42) pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart:574— RenameRefactoring.getElementToRename has cognitive complexity 42 (threshold 15). Drivers by points: if/else 39 (42 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FixProcessor._addFromProducers (cognitive 42) pkg/analysis_server_plugin/lib/src/correction/fix_processor.dart:115— FixProcessor._addFromProducers has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 4 (13 pts), loops 4 (9 pts), boolean chains 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.
ConstantVerifier._reportError (cognitive 42) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:714— ConstantVerifier._reportError has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 39, if/else 3. 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.
ConstantVisitor._buildListConstant (cognitive 42) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1499— ConstantVisitor._buildListConstant has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (26 pts), match/switch 5 (14 pts), boolean chains 1, loops 1 (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. This shape REPEATS in the file: one other method here (ConstantVisitor._buildSetConstant) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ConstantVisitor._buildSetConstant (cognitive 42) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1741— ConstantVisitor._buildSetConstant has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (26 pts), match/switch 5 (14 pts), boolean chains 1, loops 1 (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. This shape REPEATS in the file: one other method here (ConstantVisitor._buildListConstant) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
PropertyElementResolver.resolveCascadeIndex (cognitive 42) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:48— PropertyElementResolver.resolveCascadeIndex has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 11 (17 pts), boolean chains 6, 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.
LanguageVersionOverrideVerifier._findLanguageVersionOverrideComment (cognitive 42) pkg/analyzer/lib/src/error/language_version_override_verifier.dart:37— LanguageVersionOverrideVerifier._findLanguageVersionOverrideComment has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 14, loops 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_TodoFinder._check (cognitive 42) pkg/analyzer/lib/src/error/todo_finder.dart:224— _TodoFinder._check has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 16, loops 3 (5 pts) (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.
InferrerEngine.analyze (cognitive 42) pkg/compiler/lib/src/inferrer/engine.dart:676— InferrerEngine.analyze has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 5 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaInstructionSimplifier.visitParameterValue (cognitive 42) pkg/compiler/lib/src/ssa/optimize.dart:676— SsaInstructionSimplifier.visitParameterValue has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InferenceVisitorBase.createPropertyGet (cognitive 42) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:5357— InferenceVisitorBase.createPropertyGet has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (31 pts), match/switch 3 (5 pts), boolean chains 4, ternaries 1 (2 pts) (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.
ModulePrinter.enqueueElementSegment (cognitive 42) pkg/wasm_builder/lib/src/serialize/printer.dart:157— ModulePrinter.enqueueElementSegment has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (16 pts), ternaries 1 (6 pts), match/switch 1 (2 pts) (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.
_Transform.transformCall (cognitive 42) pkg/vm/lib/transformations/type_flow/signature_shaking.dart:608— _Transform.transformCall has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 11, 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.
(anonymous) (cognitive 42) REDACTED:1344— (anonymous) has cognitive complexity 42 (threshold 15). Drivers by points: if/else 28 (33 pts), loops 6, boolean chains 2, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 53 function items inside it that branch (defineLibrary, hotReloadEnd, _runMain::runMainAndHandleErrors, …). 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.
_ErrorCodeDocumentationParser.processCodeBlock (cognitive 41) pkg/analyzer/tool/messages/error_code_documentation_info.dart:173— _ErrorCodeDocumentationParser.processCodeBlock has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (39 pts), boolean chains 1, 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.
Intrinsifier.generateMemberIntrinsic (cognitive 41) pkg/dart2wasm/lib/intrinsics.dart:3594— Intrinsifier.generateMemberIntrinsic has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 2 (4 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MixinApplicationCloner._findSuperMember (cognitive 41) pkg/kernel/lib/clone.dart:1764— MixinApplicationCloner._findSuperMember has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 3 (5 pts), boolean chains 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.
_HttpClientResponse._authenticate (cognitive 41) sdk/lib/_http/http_impl.dart:775— _HttpClientResponse._authenticate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 4, ternaries 2, error handling 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.
_Uri._makeWindowsFileUrl (cognitive 41) sdk/lib/core/uri.dart:2208— _Uri._makeWindowsFileUrl has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 9, ternaries 2 (6 pts) (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.
_Uri._normalizeRegName (cognitive 41) sdk/lib/core/uri.dart:2550— _Uri._normalizeRegName has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 4, 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.
StatementCompletionProcessor._complete_forStatement (cognitive 41) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:626— StatementCompletionProcessor._complete_forStatement has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (38 pts), 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.
ElementDescriptor._matchesMethod (cognitive 41) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart:124— ElementDescriptor._matchesMethod has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (35 pts), loops 1 (5 pts), boolean chains 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnalysisDriver._analyzeFileImpl (cognitive 41) pkg/analyzer/lib/src/dart/analysis/driver.dart:1340— AnalysisDriver._analyzeFileImpl has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 5 (12 pts), ternaries 1 (3 pts), boolean chains 1, error handling 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.
TopMergeHelper.topMerge (cognitive 41) pkg/analyzer/lib/src/dart/element/top_merge.dart:22— TopMergeHelper.topMerge has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 23, if/else 17 (18 pts) (nesting depth added 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.
ErrorVerifier._checkForExtensionTypeRepresentationErrorCodes (cognitive 41) pkg/analyzer/lib/src/generated/error_verifier.dart:5511— ErrorVerifier._checkForExtensionTypeRepresentationErrorCodes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (40 pts), 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.
DartEditBuilderImpl._writeType (cognitive 41) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1540— DartEditBuilderImpl._writeType has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 2 (5 pts), boolean chains 4, 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.
KernelSsaGraphBuilder._pushDynamicInvocation (cognitive 41) pkg/compiler/lib/src/ssa/builder.dart:6830— KernelSsaGraphBuilder._pushDynamicInvocation has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 13, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SsaInstructionSimplifier.handleInterceptedCall (cognitive 41) pkg/compiler/lib/src/ssa/optimize.dart:851— SsaInstructionSimplifier.handleInterceptedCall has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 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.
PatternConverter.dispatchPattern (cognitive 41) pkg/front_end/lib/src/kernel/exhaustiveness.dart:616— PatternConverter.dispatchPattern has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (27 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ExtensionTypeHierarchyNodeBuilder.build (cognitive 41) pkg/front_end/lib/src/kernel/hierarchy/hierarchy_node.dart:435— ExtensionTypeHierarchyNodeBuilder.build has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 5 (20 pts) (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.
Covariance.== (cognitive 41) pkg/front_end/lib/src/kernel/member_covariance.dart:366— Covariance.== has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 3 (9 pts), 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.
Covariance.toString (cognitive 41) pkg/front_end/lib/src/kernel/member_covariance.dart:419— Covariance.toString has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 2 (10 pts), loops 3 (9 pts) (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.
_ObjectAccessDescriptor._findNonExtensionTargetInternal (cognitive 41) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:6343— _ObjectAccessDescriptor._findNonExtensionTargetInternal has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 4 (11 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (2 pts) (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.
PragmaEntryPointsVisitor.visitProcedure (cognitive 41) pkg/vm/lib/transformations/type_flow/native_code.dart:143— PragmaEntryPointsVisitor.visitProcedure has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 1 (2 pts), loops 1, ternaries 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.
SummaryCollector._visitCondition (cognitive 41) pkg/vm/lib/transformations/type_flow/summary_collector.dart:1619— SummaryCollector._visitCondition has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 13, match/switch 3 (6 pts), ternaries 1 (2 pts) (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.
UnboxingInfoManager.analyzeComponent (cognitive 41) pkg/vm/lib/transformations/type_flow/unboxing_info.dart:51— UnboxingInfoManager.analyzeComponent has cognitive complexity 41 (threshold 15). Drivers by points: loops 9 (19 pts), if/else 5 (11 pts), boolean chains 6, ternaries 4 (5 pts) (nesting depth added 17). 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.
IDLExtAttrs.__init__ (cognitive 41) tools/dom/scripts/idlnode.py:570— IDLExtAttrs.__init__ has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 3 (8 pts), boolean chains 2 (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.
JsInteropChecks.visitClass (cognitive 40) pkg/_js_interop_checks/lib/js_interop_checks.dart:174— JsInteropChecks.visitClass has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 6, loops 2 (4 pts) (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.
BytecodeGenerator._genConstructorInitializers (cognitive 40) pkg/dart2bytecode/lib/bytecode_generator.dart:1276— BytecodeGenerator._genConstructorInitializers has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SelectorInfo._computeSignature (cognitive 40) pkg/dart2wasm/lib/dispatch_table.dart:111— SelectorInfo._computeSignature has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 6 (15 pts), ternaries 2 (5 pts), 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.
DartdevRunner.runCommand (cognitive 40) pkg/dartdev/lib/dartdev.dart:199— DartdevRunner.runCommand has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 11, error handling 5 (8 pts), ternaries 1 (3 pts), 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.
HttpDate._parse (cognitive 40) sdk/lib/_http/http_date.dart:129— HttpDate._parse has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 6, 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.
Parser.parsePrimaryConstructorOpt (cognitive 40) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3782— Parser.parsePrimaryConstructorOpt has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (28 pts), match/switch 3 (9 pts), 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.
Parser.parseSwitchBlock (cognitive 40) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:10893— Parser.parseSwitchBlock has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 5 (15 pts), boolean chains 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.
Parser.parseSwitchExpression (cognitive 40) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:12411— Parser.parseSwitchExpression has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ComplexTypeParamOrArgInfo.parseUnexpectedEnd (cognitive 40) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1607— ComplexTypeParamOrArgInfo.parseUnexpectedEnd has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 8, loops 1 (2 pts), ternaries 1 (2 pts) (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.
DartCodeActionsProducer.getRefactorActions (cognitive 40) pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart:306— DartCodeActionsProducer.getRefactorActions has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 3, ternaries 1 (3 pts), error handling 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.
BulkFixProcessor._fixSingleDiagnostic (cognitive 40) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:843— BulkFixProcessor._fixSingleDiagnostic has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 4 (18 pts), error handling 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.
ConvertToDeclaringParameter._getRefactorData (cognitive 40) pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart:388— ConvertToDeclaringParameter._getRefactorData has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConvertToInBodyConstructor._convertPrimaryConstructorInBlockBody (cognitive 40) pkg/analysis_server/lib/src/services/correction/dart/convert_to_in_body_constructor.dart:101— ConvertToInBodyConstructor._convertPrimaryConstructorInBlockBody has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (32 pts), ternaries 2 (5 pts), 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.
ReplacedBy._rangeWithTarget (cognitive 40) pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart:183— ReplacedBy._rangeWithTarget has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 9, ternaries 1 (2 pts) (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.
GenericInferrer.tryChooseFinalTypes (cognitive 40) pkg/analyzer/lib/src/dart/element/generic_inferrer.dart:298— GenericInferrer.tryChooseFinalTypes has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 4, loops 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.
ConstructorTearOffResolver.resolve (cognitive 40) pkg/analyzer/lib/src/dart/resolver/constructor_tear_off_resolver.dart:22— ConstructorTearOffResolver.resolve has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 4 (12 pts), match/switch 2 (8 pts), boolean chains 4 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ClassVerifier._reportConcreteClassWithAbstractMember (cognitive 40) pkg/analyzer/lib/src/error/inheritance_override.dart:897— _ClassVerifier._reportConcreteClassWithAbstractMember has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 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.
GatherUsedLocalElementsVisitor._useNamedReadResolution (cognitive 40) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:590— GatherUsedLocalElementsVisitor._useNamedReadResolution has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 5, loops 1 (5 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FfiVerifier._validateFieldsInCompound (cognitive 40) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1815— FfiVerifier._validateFieldsInCompound has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (38 pts), 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.
ManifestParser._parseAttribute (cognitive 40) pkg/analyzer/lib/src/manifest/manifest_validator.dart:145— ManifestParser._parseAttribute has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 3 (5 pts), boolean chains 3, ternaries 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.
_Builder.build (cognitive 40) pkg/compiler/lib/src/deferred_load/program_split_constraints/builder.dart:79— _Builder.build has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 9 (19 pts), 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.
DominatedUses._compute (cognitive 40) pkg/compiler/lib/src/ssa/nodes.dart:1655— DominatedUses._compute has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 5 (9 pts), 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.
ClassPropertyModel.build (cognitive 40) pkg/dev_compiler/lib/src/kernel/property_model.dart:224— ClassPropertyModel.build has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 11, loops 3 (4 pts), ternaries 1 (4 pts) (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.
BodyBuilderImpl._validateTypeParameterUseInternal (cognitive 40) pkg/front_end/lib/src/kernel/body_builder.dart:11415— BodyBuilderImpl._validateTypeParameterUseInternal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (15 pts), boolean chains 5, match/switch 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
InferenceVisitorImpl.visitPatternSwitchStatement (cognitive 40) pkg/front_end/lib/src/type_inference/inference_visitor.dart:10330— InferenceVisitorImpl.visitPatternSwitchStatement has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 6 (15 pts), boolean chains 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.
MiniJsParser.parseStatement (cognitive 40) pkg/js_ast/lib/src/builder.dart:1236— MiniJsParser.parseStatement has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (39 pts), 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.
AnnotateKernel._annotateMember (cognitive 40) pkg/vm/lib/transformations/type_flow/transformer.dart:714— AnnotateKernel._annotateMember has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 3 (9 pts), boolean chains 3, ternaries 1 (3 pts) (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.
Dart2JSBackend.EmitAttribute (cognitive 40) tools/dom/scripts/systemhtml.py:1509— Dart2JSBackend.EmitAttribute has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 7, ternaries 2 (6 pts) (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.
createTreemapTile (cognitive 40) runtime/tools/graphexplorer/graphexplorer.js:1279— createTreemapTile has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (32 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 15). Of this number, 34 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogPage._writeEntry (cognitive 39) pkg/analysis_server/tool/instrumentation/page/log_page.dart:115— LogPage._writeEntry has cognitive complexity 39 (threshold 15). Drivers by points: if/else 23 (38 pts), ternaries 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.
AstNodeImplGenerator._generateBeginToken (cognitive 39) pkg/analyzer/tool/generators/ast_generator.dart:306— AstNodeImplGenerator._generateBeginToken has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ScopeBuilder._visitFunction (cognitive 39) pkg/dart2bytecode/lib/local_vars.dart:317— _ScopeBuilder._visitFunction has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 7, loops 1 (3 pts) (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.
_Recorder.record (cognitive 39) pkg/perf_witness/lib/recorder.dart:117— _Recorder.record has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (12 pts), error handling 3 (9 pts), boolean chains 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.
_HttpClientConnection.send (cognitive 39) sdk/lib/_http/http_impl.dart:2274— _HttpClientConnection.send has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 10 (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.
_BigIntImpl._divRem (cognitive 39) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1477— _BigIntImpl._divRem has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (9 pts), boolean chains 5 (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.
Arm64CodeGenerator.visitBinaryIntOp (cognitive 39) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2536— Arm64CodeGenerator.visitBinaryIntOp has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (23 pts), match/switch 5 (12 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
_Uri._normalize (cognitive 39) sdk/lib/core/uri.dart:2885— _Uri._normalize has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 3, loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PromotionModel._tryPromoteToTypeOfInterest (cognitive 39) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:4911— PromotionModel._tryPromoteToTypeOfInterest has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (32 pts), loops 3 (6 pts), ternaries 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.parseTopLevelDeclarationImpl (cognitive 39) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:554— Parser.parseTopLevelDeclarationImpl has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 18, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TypeConstraintGenerator.performSubtypeConstraintGenerationInternal (cognitive 39) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:2173— TypeConstraintGenerator.performSubtypeConstraintGenerationInternal has cognitive complexity 39 (threshold 15). Drivers by points: if/else 28 (35 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AbstractNotificationManager.setSubscriptions (cognitive 39) pkg/analysis_server/lib/src/plugin/notification_manager.dart:302— AbstractNotificationManager.setSubscriptions has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 5 (17 pts), match/switch 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.
PluginWatcher._addPlugins (cognitive 39) pkg/analysis_server/lib/src/plugin/plugin_watcher.dart:126— PluginWatcher._addPlugins has cognitive complexity 39 (threshold 15). Drivers by points: loops 8 (20 pts), if/else 6 (13 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 21). 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.
KeywordHelper.addExpressionKeywords (cognitive 39) pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart:312— KeywordHelper.addExpressionKeywords has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 13 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ConvertToFlutterStyleTodo.compute (cognitive 39) pkg/analysis_server/lib/src/services/correction/dart/convert_to_flutter_style_todo.dart:26— ConvertToFlutterStyleTodo.compute has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 3 (6 pts), boolean chains 4, ternaries 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.
RemoveLeadingUnderscore.compute (cognitive 39) pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart:27— RemoveLeadingUnderscore.compute has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 3 (5 pts), 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.
ReplaceWithDecoratedBox.compute (cognitive 39) pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart:28— ReplaceWithDecoratedBox.compute has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (8 pts), boolean chains 6, ternaries 2 (5 pts) (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.
ReplaceWithIsEmpty._analyzeBinaryExpression (cognitive 39) pkg/analysis_server/lib/src/services/correction/dart/replace_with_is_empty.dart:94— ReplaceWithIsEmpty._analyzeBinaryExpression has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (35 pts), 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.
RefactoringManager._createRefactoringFromKind (cognitive 39) pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring_manager.dart:220— RefactoringManager._createRefactoringFromKind has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (38 pts), 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.
PluginsPage._emitIsolateInfo (cognitive 39) pkg/analysis_server/lib/src/status/pages/plugins_page.dart:145— PluginsPage._emitIsolateInfo has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 4 (7 pts), 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.
_ParsedLinterData._parseLocalRules (cognitive 39) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1219— _ParsedLinterData._parseLocalRules has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConstantVisitor._buildMapConstant (cognitive 39) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1621— ConstantVisitor._buildMapConstant has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 5 (15 pts), boolean chains 1, loops 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.
GetterSetterTypesVerifier.checkInterface (cognitive 39) pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart:60— GetterSetterTypesVerifier.checkInterface has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (36 pts), boolean chains 2, loops 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ResolutionEnqueuerListener._processClass (cognitive 39) pkg/compiler/lib/src/js_backend/resolution_listener.dart:387— ResolutionEnqueuerListener._processClass has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26, boolean chains 13. 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.
KernelSsaGraphBuilder._buildConstructor (cognitive 39) pkg/compiler/lib/src/ssa/builder.dart:788— KernelSsaGraphBuilder._buildConstructor has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 3 (6 pts), boolean chains 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.
Debugger._pauseHandler (cognitive 39) pkg/dwds/lib/src/debugging/debugger.dart:544— Debugger._pauseHandler has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BodyBuilderImpl.endFormalParameter (cognitive 39) pkg/front_end/lib/src/kernel/body_builder.dart:3745— BodyBuilderImpl.endFormalParameter has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 6, match/switch 1 (2 pts) (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.
ForwardingNode._createForwardingImplIfNeeded (cognitive 39) pkg/front_end/lib/src/kernel/forwarding_node.dart:299— ForwardingNode._createForwardingImplIfNeeded has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 2, match/switch 1, ternaries 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.
SourceLoader._checkMainMethods (cognitive 39) pkg/front_end/lib/src/source/source_loader.dart:3090— SourceLoader._checkMainMethods has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (39 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FunctionType.equals (cognitive 39) pkg/kernel/lib/src/ast/types.dart:1414— FunctionType.equals has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5 (13 pts), boolean chains 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.
_Visitor.visitCompilationUnit (cognitive 39) pkg/linter/lib/src/rules/unreachable_from_main.dart:503— _Visitor.visitCompilationUnit has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 6 (7 pts), 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.
TreeMap._createTreemapTile (cognitive 39) pkg/observatory/lib/src/elements/tree_map.dart:32— TreeMap._createTreemapTile has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 4 (6 pts), boolean chains 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.
Instance.toJson (cognitive 39) pkg/vm_service/lib/src/vm_service.dart:5751— Instance.toJson has cognitive complexity 39 (threshold 15). Drivers by points: if/else 39. 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.
gn.ProcessOptions (cognitive 39) tools/gn.py:329— gn.ProcessOptions has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 4, 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.
_SimpleUri._simpleMerge (cognitive 38) sdk/lib/core/uri.dart:4869— _SimpleUri._simpleMerge has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (28 pts), loops 4 (6 pts), boolean chains 4 (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.parseImportRecovery (cognitive 38) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:994— Parser.parseImportRecovery has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 3, 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.
Parser.parseFields (cognitive 38) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4438— Parser.parseFields has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 9, loops 1, match/switch 1, ternaries 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.
MakeFinal.compute (cognitive 38) pkg/analysis_server/lib/src/services/correction/dart/make_final.dart:26— MakeFinal.compute has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 4, match/switch 1 (2 pts) (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.
LibraryAnalyzer._checkForInconsistentLanguageVersionOverride (cognitive 38) pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart:248— LibraryAnalyzer._checkForInconsistentLanguageVersionOverride has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (35 pts), loops 2, boolean chains 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClassElementImpl.directSubtypesOfSealed (cognitive 38) pkg/analyzer/lib/src/dart/element/element.dart:217— ClassElementImpl.directSubtypesOfSealed has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 4 (11 pts), 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.
GatherUsedLocalElementsVisitor.visitSimpleIdentifier (cognitive 38) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:375— GatherUsedLocalElementsVisitor.visitSimpleIdentifier has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 7, loops 1 (3 pts) (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.
_LibraryMatch.compareStructures (cognitive 38) pkg/analyzer/lib/src/fine/library_manifest.dart:1760— _LibraryMatch.compareStructures has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (35 pts), match/switch 1 (2 pts), 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.
FormattingDiagnosticHandler.report (cognitive 38) pkg/compiler/lib/src/source_file_provider.dart:246— FormattingDiagnosticHandler.report has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 10, ternaries 1 (3 pts) (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.
CodegenWorldBuilder.generateParameterStubs (cognitive 38) pkg/compiler/lib/src/universe/codegen_world_builder.dart:674— CodegenWorldBuilder.generateParameterStubs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 4, loops 2, ternaries 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.
ProgramCompiler._directCastMethod (cognitive 38) pkg/dev_compiler/lib/src/kernel/compiler.dart:7827— ProgramCompiler._directCastMethod has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (37 pts), 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.
LibraryCompiler._directCastMethod (cognitive 38) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8695— LibraryCompiler._directCastMethod has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (37 pts), 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.
IncrementalCompiler._computeExpressionCompilationScopeData (cognitive 38) pkg/front_end/lib/src/base/incremental_compiler.dart:2476— IncrementalCompiler._computeExpressionCompilationScopeData has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 13, 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.
TypeAliasBuilderImpl.unaliasDeclaration (cognitive 38) pkg/front_end/lib/src/builder/type_alias_builder.dart:325— TypeAliasBuilderImpl.unaliasDeclaration has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 3 (10 pts) (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.
FactoryEncoding.resolveRedirectingFactory (cognitive 38) pkg/front_end/lib/src/fragment/factory/encoding.dart:368— FactoryEncoding.resolveRedirectingFactory has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 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.
SourceExtensionTypeDeclarationBuilder.checkSupertypes (cognitive 38) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:710— SourceExtensionTypeDeclarationBuilder.checkSupertypes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 2 (5 pts), match/switch 1 (5 pts), boolean chains 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceLibraryBuilder._buildOutlineNodes (cognitive 38) pkg/front_end/lib/src/source/source_library_builder.dart:1071— SourceLibraryBuilder._buildOutlineNodes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 2 (7 pts) (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.
StandardBounds._getFunctionStandardLowerBound (cognitive 38) pkg/kernel/lib/src/standard_bounds.dart:1098— StandardBounds._getFunctionStandardLowerBound has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 8 (12 pts), boolean chains 7, ternaries 2 (5 pts) (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.
_Visitor.visitSwitchStatement (cognitive 38) pkg/linter/lib/src/rules/exhaustive_cases.dart:37— _Visitor.visitSwitchStatement has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 2 (4 pts) (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.
_DeclarationGatherer._addMembers (cognitive 38) pkg/linter/lib/src/rules/unreachable_from_main.dart:97— _DeclarationGatherer._addMembers has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 10, loops 2 (4 pts), match/switch 1 (2 pts) (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.
_Visitor._checkForConvertiblePositionalParams (cognitive 38) pkg/linter/lib/src/rules/use_super_parameters.dart:157— _Visitor._checkForConvertiblePositionalParams has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (4 pts), boolean chains 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.
_KernelFromParsedType.visitNamedType (cognitive 38) pkg/kernel/lib/testing/type_parser_environment.dart:358— _KernelFromParsedType.visitNamedType has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (4 pts) (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.
DevToolsServer.serveDevTools (cognitive 37) pkg/dds/lib/devtools_server.dart:260— DevToolsServer.serveDevTools has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 4, error handling 2 (4 pts), 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.
Expect._deepEquals (cognitive 37) pkg/expect/lib/expect.dart:729— Expect._deepEquals has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (10 pts), ternaries 2 (5 pts), boolean chains 3 (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.
_SplayTree._splay (cognitive 37) sdk/lib/collection/splay_tree.dart:67— _SplayTree._splay has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (36 pts), 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.
TypeAnalyzer._finishJoinedPatternVariables (cognitive 37) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:3223— TypeAnalyzer._finishJoinedPatternVariables has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 5, loops 3 (4 pts), ternaries 1 (4 pts) (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.
ParsedOptions.parse (cognitive 37) pkg/_fe_analyzer_shared/lib/src/util/options.dart:39— ParsedOptions.parse has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 3 (4 pts), boolean chains 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.
StaticInteropMockValidator._computeImplementableExtensionMembers (cognitive 37) pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart:328— StaticInteropMockValidator._computeImplementableExtensionMembers has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (9 pts), ternaries 1 (5 pts), boolean chains 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.
DeclarationHelper._suggestMethod (cognitive 37) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2390— DeclarationHelper._suggestMethod has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 11 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ContextTypeVisitor.visitArgumentList (cognitive 37) pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart:520— _ContextTypeVisitor.visitArgumentList has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InScopeCompletionPass.visitRegularFormalParameter (cognitive 37) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2888— InScopeCompletionPass.visitRegularFormalParameter has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 9 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_EnumDescription._removeUnnamedConstructor (cognitive 37) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:369— _EnumDescription._removeUnnamedConstructor has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (31 pts), ternaries 2 (4 pts), 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.
_CreateClass.compute (cognitive 37) pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:170— _CreateClass.compute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 6, error handling 1 (5 pts), loops 1 (2 pts), ternaries 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.
RemoveTypeAnnotation._removeFromDeclarationList (cognitive 37) pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:72— RemoveTypeAnnotation._removeFromDeclarationList has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 5 (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.
TransformSetParser._translateElement (cognitive 37) pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart:856— TransformSetParser._translateElement has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (37 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantVisitor._getConstantValue (cognitive 37) pkg/analyzer/lib/src/dart/constant/evaluation.dart:2011— ConstantVisitor._getConstantValue has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 5, match/switch 1 (3 pts), ternaries 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.
LibraryFragmentImpl.shouldIgnoreUndefined (cognitive 37) pkg/analyzer/lib/src/dart/element/element.dart:8123— LibraryFragmentImpl.shouldIgnoreUndefined has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 4 (10 pts), boolean chains 5 (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.
AstRewriter.methodInvocation (cognitive 37) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:93— AstRewriter.methodInvocation has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (34 pts), 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.
ErrorVerifier.visitTopLevelVariableDeclaration (cognitive 37) pkg/analyzer/lib/src/generated/error_verifier.dart:2485— ErrorVerifier.visitTopLevelVariableDeclaration has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErrorVerifier._checkForUnnecessaryNullAware (cognitive 37) pkg/analyzer/lib/src/generated/error_verifier.dart:7919— ErrorVerifier._checkForUnnecessaryNullAware has cognitive complexity 37 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 3, ternaries 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.
AstBinaryFlags.encode (cognitive 37) pkg/analyzer/lib/src/summary2/ast_binary_flags.dart:154— AstBinaryFlags.encode has cognitive complexity 37 (threshold 15). Drivers by points: if/else 37. 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.
JsKernelToElementMap._ensureSupertypes (cognitive 37) pkg/compiler/lib/src/js_model/element_map_impl.dart:683— JsKernelToElementMap._ensureSupertypes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 3 (10 pts), boolean chains 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaLoadElimination.visitBasicBlock (cognitive 37) pkg/compiler/lib/src/ssa/optimize.dart:4439— SsaLoadElimination.visitBasicBlock has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 4 (7 pts), boolean chains 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.
SourceLoader.checkClassSupertypes (cognitive 37) pkg/front_end/lib/src/source/source_loader.dart:2061— SourceLoader.checkClassSupertypes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 3 (11 pts), boolean chains 4, match/switch 1 (2 pts), 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.
ResidentFrontendServer._generateCompilerOptions (cognitive 37) pkg/frontend_server/lib/src/resident_frontend_server.dart:732— ResidentFrontendServer._generateCompilerOptions has cognitive complexity 37 (threshold 15). Drivers by points: if/else 22 (25 pts), loops 6 (11 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DartTypeEquivalence.visitFunctionType (cognitive 37) pkg/kernel/lib/src/dart_type_equivalence.dart:43— DartTypeEquivalence.visitFunctionType has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 4 (8 pts), 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.
ScriptInsetElement._refreshSourceReport (cognitive 37) pkg/observatory/lib/src/elements/script_inset.dart:225— ScriptInsetElement._refreshSourceReport has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 4 (11 pts), boolean chains 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.
Module.printAsWat (cognitive 37) pkg/wasm_builder/lib/src/ir/module.dart:371— Module.printAsWat has cognitive complexity 37 (threshold 15). Drivers by points: loops 10 (24 pts), if/else 7 (13 pts) (nesting depth added 20). 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.
DatabaseBuilder._mark_usage (cognitive 37) tools/dom/scripts/databasebuilder.py:930— DatabaseBuilder._mark_usage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 3 (8 pts), boolean chains 2, ternaries 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DynamicForwarderCodeGenerator._generateDynamicMethodForwarder (cognitive 36) pkg/dart2wasm/lib/code_generator.dart:3902— DynamicForwarderCodeGenerator._generateDynamicMethodForwarder has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 5 (10 pts), ternaries 2 (6 pts) (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.
_ChunkedJsonParser.parseStringToBuffer (cognitive 36) sdk/lib/_internal/wasm/common/convert_patch.dart:1291— _ChunkedJsonParser.parseStringToBuffer has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 2 (3 pts), 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.
LinearScanRegisterAllocator.allocateBlockedRegister (cognitive 36) pkg/native_compiler/lib/back_end/register_allocator.dart:746— LinearScanRegisterAllocator.allocateBlockedRegister has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 2, boolean chains 1, ternaries 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.
_JsonStringifier.writeStringContent (cognitive 36) sdk/lib/convert/json.dart:714— _JsonStringifier.writeStringContent has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 6, match/switch 1 (3 pts), loops 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UriData._parse (cognitive 36) sdk/lib/core/uri.dart:4254— UriData._parse has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 6, loops 3 (4 pts) (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.
AstToIr._translateConditionForValue (cognitive 36) pkg/cfg/lib/front_end/ast_to_ir.dart:2043— AstToIr._translateConditionForValue has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 3 (9 pts), 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.
_ScopeBuilder.allocateContexts (cognitive 36) pkg/cfg/lib/front_end/computed_scopes.dart:194— _ScopeBuilder.allocateContexts has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 5 (11 pts), boolean chains 2 (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.
ConstantPragmaAnnotationParser.parsePragma (cognitive 36) pkg/vm/lib/modular/transformations/pragma.dart:159— ConstantPragmaAnnotationParser.parsePragma has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 4, ternaries 1 (2 pts), 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.
ColorComputer.getExpressionColorObject (cognitive 36) pkg/analysis_server/lib/src/computer/computer_color.dart:115— ColorComputer.getExpressionColorObject has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (22 pts), match/switch 3 (7 pts), boolean chains 4, ternaries 1 (2 pts), error handling 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.
RenameHandler.handle (cognitive 36) pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:120— RenameHandler.handle has cognitive complexity 36 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 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.
MessageScheduler._processDocumentChange (cognitive 36) pkg/analysis_server/lib/src/scheduler/message_scheduler.dart:440— MessageScheduler._processDocumentChange has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 4, loops 2, ternaries 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.
InScopeCompletionPass.visitMethodInvocation (cognitive 36) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2121— InScopeCompletionPass.visitMethodInvocation has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 10, ternaries 1 (2 pts) (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.
AddExplicitCast.compute (cognitive 36) pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:31— AddExplicitCast.compute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 9 (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.
RemoveIfNullOperator.compute (cognitive 36) pkg/analysis_server/lib/src/services/correction/dart/remove_if_null_operator.dart:26— RemoveIfNullOperator.compute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 3 (6 pts), boolean chains 4, ternaries 1 (3 pts) (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.
ExtractMethodRefactoringImpl._checkSelection (cognitive 36) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:489— ExtractMethodRefactoringImpl._checkSelection has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ElementWriter._computeProperties (cognitive 36) pkg/analysis_server/lib/src/status/utilities/element_writer.dart:35— ElementWriter._computeProperties has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (35 pts), 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.
GenericInferrer._reportInferenceFailure (cognitive 36) pkg/analyzer/lib/src/dart/element/generic_inferrer.dart:605— GenericInferrer._reportInferenceFailure has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 5, ternaries 1 (4 pts), match/switch 1 (2 pts) (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.
FfiVerifier.visitClassDeclaration (cognitive 36) pkg/analyzer/lib/src/generated/ffi_verifier.dart:270— FfiVerifier.visitClassDeclaration has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 4, loops 2 (4 pts) (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.
ResolverVisitor._reportNotEnoughPositionalArguments (cognitive 36) pkg/analyzer/lib/src/generated/resolver.dart:6339— ResolverVisitor._reportNotEnoughPositionalArguments has cognitive complexity 36 (threshold 15). Drivers by points: if/else 22 (30 pts), ternaries 3 (6 pts) (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.
KernelInfoCollector.visitFunction (cognitive 36) pkg/compiler/lib/src/dump_info.dart:1010— KernelInfoCollector.visitFunction has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 22, if/else 9 (10 pts), ternaries 3 (4 pts) (nesting depth added 2). 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.
SsaCodeGenerator._shouldRecordMethodUses (cognitive 36) pkg/compiler/lib/src/ssa/codegen.dart:2432— SsaCodeGenerator._shouldRecordMethodUses has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (33 pts), boolean chains 3 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaInstructionSelection.visitFieldSet (cognitive 36) pkg/compiler/lib/src/ssa/codegen_helpers.dart:351— SsaInstructionSelection.visitFieldSet has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 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.
SsaCodeMotion.visitBasicBlock (cognitive 36) pkg/compiler/lib/src/ssa/optimize.dart:3988— SsaCodeMotion.visitBasicBlock has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5 (12 pts), 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.
ProgramCompiler._emitClassMethods (cognitive 36) pkg/dev_compiler/lib/src/kernel/compiler.dart:2483— ProgramCompiler._emitClassMethods has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 5, loops 3, ternaries 1 (2 pts) (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.
CombinedMemberSignatureBase.CombinedMemberSignatureBase (cognitive 36) pkg/front_end/lib/src/kernel/combined_member_signature.dart:102— CombinedMemberSignatureBase.CombinedMemberSignatureBase has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 2 (5 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceClassBuilder._computeInterfaceSubstitution (cognitive 36) pkg/front_end/lib/src/source/source_class_builder.dart:1627— SourceClassBuilder._computeInterfaceSubstitution has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 3 (8 pts) (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.
VerifyingAnalysis.run (cognitive 36) pkg/front_end/lib/src/testing/verifying_analysis.dart:29— VerifyingAnalysis.run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 4 (11 pts), error handling 1 (3 pts), 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.
IncrementalJavaScriptBundler.compile (cognitive 36) pkg/frontend_server/lib/src/javascript_bundle.dart:252— IncrementalJavaScriptBundler.compile has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 8 (16 pts), 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.
_Visitor._visitInvocationExpression (cognitive 36) pkg/linter/lib/src/rules/unnecessary_lambdas.dart:228— _Visitor._visitInvocationExpression has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 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.
DwarfStackTraceDecoder.bind (cognitive 36) pkg/native_stack_traces/lib/src/convert.dart:544— DwarfStackTraceDecoder.bind has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (7 pts), boolean chains 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.
ChainContext.list (cognitive 36) pkg/testing/lib/src/chain.dart:352— ChainContext.list has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 2 (4 pts), boolean chains 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.
Summary.apply (cognitive 36) pkg/vm/lib/transformations/type_flow/summary.dart:1066— Summary.apply has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 4, boolean chains 3, ternaries 2 (3 pts) (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.
gn.ToGnArgs (cognitive 36) tools/gn.py:190— gn.ToGnArgs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 5, loops 1 (3 pts), ternaries 1 (3 pts) (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.
DevToolsServer.serveDevTools (cognitive 35) pkg/dart_runtime_service_dds/lib/devtools_server.dart:262— DevToolsServer.serveDevTools has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (22 pts), error handling 3 (8 pts), 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.
ClosedWorldClassHierarchy.applyTreeChanges (cognitive 35) pkg/kernel/lib/class_hierarchy.dart:1264— ClosedWorldClassHierarchy.applyTreeChanges has cognitive complexity 35 (threshold 15). Drivers by points: loops 12 (17 pts), if/else 11 (16 pts), boolean chains 2 (nesting depth added 10). 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.
double._tryParseDouble (cognitive 35) sdk/lib/_internal/vm/lib/double_patch.dart:16— double._tryParseDouble has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 4, 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.
_ChunkedJsonParser._parseStringInternal (cognitive 35) sdk/lib/_internal/wasm/common/convert_patch.dart:1155— _ChunkedJsonParser._parseStringInternal has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (2 pts) (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.
_TypeUniverse.isSubtype (cognitive 35) sdk/lib/_internal/wasm/common/type.dart:1351— _TypeUniverse.isSubtype has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 8 (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.
_FfiUseSiteTransformer._replaceNativeCallParameterAndArgument (cognitive 35) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:2195— _FfiUseSiteTransformer._replaceNativeCallParameterAndArgument has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 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.
PerformRefactorCommandHandler.execute (cognitive 35) pkg/analysis_server/lib/src/lsp/handlers/commands/perform_refactor.dart:37— PerformRefactorCommandHandler.execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), ternaries 1 (5 pts), boolean chains 2 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InScopeCompletionPass.visitNamedArgument (cognitive 35) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2237— InScopeCompletionPass.visitNamedArgument has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 2 (6 pts), match/switch 1 (2 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
StatementCompletionProcessor._complete_doStatement (cognitive 35) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:462— StatementCompletionProcessor._complete_doStatement has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (33 pts), 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.
AddDiagnosticPropertyReference.compute (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart:37— AddDiagnosticPropertyReference.compute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 26 (32 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AddExplicitCast._computeTargetAndTypes (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart:122— AddExplicitCast._computeTargetAndTypes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 11 (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.
AddKeyToConstructors._updateSuper (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart:247— AddKeyToConstructors._updateSuper has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 3, 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.
ConvertToDeclaringParameter._resolveParameterFromFieldNode (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/convert_to_declaring_parameter.dart:476— ConvertToDeclaringParameter._resolveParameterFromFieldNode has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 4, loops 2 (4 pts), 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.
ConvertToNullAware.compute (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/convert_to_null_aware.dart:32— ConvertToNullAware.compute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (28 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (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.
EncapsulateField._updateReferencesInConstructor (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart:298— EncapsulateField._updateReferencesInConstructor has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (25 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (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.
ExtractLocalVariable._rewriteProperty (cognitive 35) pkg/analysis_server/lib/src/services/correction/dart/extract_local_variable.dart:79— ExtractLocalVariable._rewriteProperty has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (8 pts), boolean chains 3 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MoveTopLevelToFile._membersToMove (cognitive 35) pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart:270— MoveTopLevelToFile._membersToMove has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 2 (4 pts), loops 2, boolean chains 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.
_FindDeclarations.compute (cognitive 35) pkg/analyzer/lib/src/dart/analysis/search.dart:1417— _FindDeclarations.compute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (29 pts), boolean chains 3, loops 1 (2 pts), error handling 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.
_ConstructorInvocationEvaluator.evaluate (cognitive 35) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3684— _ConstructorInvocationEvaluator.evaluate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (32 pts), 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.
_Collector._identifier (cognitive 35) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:307— _Collector._identifier has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 6 (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.
FlowAnalysisHelper.getLabelTarget (cognitive 35) pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart:481— FlowAnalysisHelper.getLabelTarget has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (5 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PropertyElementResolver._resolve (cognitive 35) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1857— PropertyElementResolver._resolve has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (29 pts), ternaries 1 (3 pts), match/switch 1 (2 pts), 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.
TypeArgumentsVerifier._checkForTypeArgumentNotMatchingBounds (cognitive 35) pkg/analyzer/lib/src/error/type_arguments_verifier.dart:356— TypeArgumentsVerifier._checkForTypeArgumentNotMatchingBounds has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (30 pts), loops 3 (4 pts), 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.
_OpTypeAstVisitor.visitExpressionFunctionBody (cognitive 35) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:664— _OpTypeAstVisitor.visitExpressionFunctionBody has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (33 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LocalDeclarationVisitor._addVariables (cognitive 35) pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:310— LocalDeclarationVisitor._addVariables has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (27 pts), loops 4 (8 pts) (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.
StreamManager.streamListen (cognitive 35) pkg/dds/lib/src/stream_manager.dart:189— StreamManager.streamListen has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (7 pts), boolean chains 3, error handling 1 (3 pts) (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.
AppInspector._populateScriptCaches (cognitive 35) pkg/dwds/lib/src/debugging/inspector.dart:131— AppInspector._populateScriptCaches has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 5 (12 pts), 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.
ConstantEvaluator._evaluateSubexpression (cognitive 35) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3110— ConstantEvaluator._evaluateSubexpression has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 8 (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.
SourceLoader.computeLibraryScopes (cognitive 35) pkg/front_end/lib/src/source/source_loader.dart:1700— SourceLoader.computeLibraryScopes has cognitive complexity 35 (threshold 15). Drivers by points: loops 11 (22 pts), if/else 5 (13 pts) (nesting depth added 19). 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.
InferenceVisitorImpl._checkElement (cognitive 35) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4153— InferenceVisitorImpl._checkElement has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 2 (8 pts), boolean chains 2, match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
InferenceVisitorImpl.visitSpreadElement (cognitive 35) pkg/front_end/lib/src/type_inference/inference_visitor.dart:4554— InferenceVisitorImpl.visitSpreadElement has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), match/switch 3 (6 pts), boolean chains 5, ternaries 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.
InferenceVisitorImpl.visitUnary (cognitive 35) pkg/front_end/lib/src/type_inference/inference_visitor.dart:10950— InferenceVisitorImpl.visitUnary has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (35 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InferenceVisitorImpl.visitDotShorthandInvocation (cognitive 35) pkg/front_end/lib/src/type_inference/inference_visitor.dart:13806— InferenceVisitorImpl.visitDotShorthandInvocation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 10, 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.
AsyncStateVisitor._visitIfLike (cognitive 35) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:812— AsyncStateVisitor._visitIfLike has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 4 (7 pts), boolean chains 6 (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.
VirtualCollectionElement.render (cognitive 35) pkg/observatory/lib/src/elements/containers/virtual_collection.dart:144— VirtualCollectionElement.render has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 4 (9 pts), boolean chains 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.
Emitter._ParseTemplate (cognitive 35) tools/dom/scripts/emitter.py:142— Emitter._ParseTemplate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 2 (4 pts), 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.
TypeRegistry._TypeInfo (cognitive 35) tools/dom/scripts/generator.py:2088— TypeRegistry._TypeInfo has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 5 (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.
StatsPage._processEntries (cognitive 34) pkg/analysis_server/tool/instrumentation/page/stats_page.dart:73— StatsPage._processEntries has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (32 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_BuilderGenerator._generateFinish (cognitive 34) pkg/analyzer/tool/summary/generate.dart:290— _BuilderGenerator._generateFinish has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (27 pts), 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.
ClassInfoCollector._createStructForClass (cognitive 34) pkg/dart2wasm/lib/class_info.dart:381— ClassInfoCollector._createStructForClass has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (9 pts), ternaries 4 (9 pts), boolean chains 5 (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.
ConstructorInitializerCodeGenerator.generateInitializerList (cognitive 34) pkg/dart2wasm/lib/code_generator.dart:4353— ConstructorInitializerCodeGenerator.generateInitializerList has cognitive complexity 34 (threshold 15). Drivers by points: loops 9 (19 pts), if/else 7 (12 pts), boolean chains 2, ternaries 1 (nesting depth added 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.
TypeCheckingVisitor.handleCall (cognitive 34) pkg/kernel/lib/type_checker.dart:388— TypeCheckingVisitor.handleCall has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (12 pts), 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.
_ProxyConfiguration._ProxyConfiguration (cognitive 34) sdk/lib/_http/http_impl.dart:3698— _ProxyConfiguration._ProxyConfiguration has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 5, error handling 1 (4 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RegisterAllocationChecker.verifyInstructions (cognitive 34) pkg/native_compiler/lib/back_end/regalloc_checker.dart:282— RegisterAllocationChecker.verifyInstructions has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 5 (15 pts) (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.
_Checker._unmatched (cognitive 34) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/exhaustive.dart:112— _Checker._unmatched has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4 (6 pts), boolean chains 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.
ExhaustivenessCache.getStaticType (cognitive 34) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/shared.dart:193— ExhaustivenessCache.getStaticType has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (33 pts), 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.
ComplexTypeInfo.parseType (cognitive 34) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:615— ComplexTypeInfo.parseType has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 7, 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.
_CodeFragmentScanner.scan (cognitive 34) pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart:387— _CodeFragmentScanner.scan has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 4 (10 pts), boolean chains 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.
_LinterRuleDiagnostics.reportIncompatibleIncluded (cognitive 34) pkg/analyzer/lib/src/analysis_options/linter_rule_options_validator.dart:99— _LinterRuleDiagnostics.reportIncompatibleIncluded has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 8 (17 pts) (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.
ConstantVerifier._checkForConstWithTypeParameters (cognitive 34) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:604— ConstantVerifier._checkForConstWithTypeParameters has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (10 pts), 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.
_ConstructorInvocationEvaluator._checkParameters (cognitive 34) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3459— _ConstructorInvocationEvaluator._checkParameters has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (29 pts), boolean chains 4, loops 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PropertyElementResolver.resolveReceiverPropertyExtraction (cognitive 34) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:989— PropertyElementResolver.resolveReceiverPropertyExtraction has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 4, ternaries 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
PropertyElementResolver.resolveReceiverPropertyReadWriteAssignmentTarget (cognitive 34) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:1193— PropertyElementResolver.resolveReceiverPropertyReadWriteAssignmentTarget has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
AnnotationVerifier._checkVisibility (cognitive 34) pkg/analyzer/lib/src/error/annotation_verifier.dart:536— AnnotationVerifier._checkVisibility has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 6, loops 2 (4 pts) (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.
ErrorHandlerVerifier._verifyInvocation (cognitive 34) pkg/analyzer/lib/src/error/error_handler_verifier.dart:300— ErrorHandlerVerifier._verifyInvocation has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 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.
MemberDuplicateDefinitionVerifier._checkClassStatic (cognitive 34) pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:178— MemberDuplicateDefinitionVerifier._checkClassStatic has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (29 pts), loops 2 (5 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DocCommentBuilder._parseReferences (cognitive 34) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:788— DocCommentBuilder._parseReferences has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 4, loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ManifestParser._parseNormalTag (cognitive 34) pkg/analyzer/lib/src/manifest/manifest_validator.dart:287— ManifestParser._parseNormalTag has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 3, loops 2 (3 pts) (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.
CommandLineOptions._parse (cognitive 34) pkg/analyzer_cli/lib/src/options.dart:350— CommandLineOptions._parse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 1 (4 pts), loops 1 (3 pts), boolean chains 1, error handling 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.
PubPackageResolutionTest.missingExpectedMessage (cognitive 34) pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart:410— PubPackageResolutionTest.missingExpectedMessage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 4 (12 pts) (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.
DeferredHolderExpressionFinalizerImpl.initializeHolders (cognitive 34) pkg/compiler/lib/src/js_backend/deferred_holder_expression.dart:742— DeferredHolderExpressionFinalizerImpl.initializeHolders has cognitive complexity 34 (threshold 15). Drivers by points: loops 8 (20 pts), if/else 5 (12 pts), ternaries 1 (2 pts) (nesting depth added 20). 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.
SpecializedChecks.findIsTestSpecialization (cognitive 34) pkg/compiler/lib/src/js_backend/specialized_checks.dart:32— SpecializedChecks.findIsTestSpecialization has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 11 (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.
SsaInstructionSimplifier.visitArrayFlagsCheck (cognitive 34) pkg/compiler/lib/src/ssa/optimize.dart:3030— SsaInstructionSimplifier.visitArrayFlagsCheck has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 3 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartDebugAdapter.evaluateRequest (cognitive 34) pkg/dap_adapters/lib/src/adapters/dart.dart:1050— DartDebugAdapter.evaluateRequest has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 14, ternaries 2 (3 pts), error handling 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.
ConstantEvaluator.visitInstanceGet (cognitive 34) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4727— ConstantEvaluator.visitInstanceGet has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (2 pts) (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.
Covariance.applyCovariance (cognitive 34) pkg/front_end/lib/src/kernel/member_covariance.dart:292— Covariance.applyCovariance has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 3 (9 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ParserASTListener.seen (cognitive 34) pkg/front_end/lib/src/util/parser_ast.dart:1755— ParserASTListener.seen has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 13, loops 2 (4 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
_Visitor.visitNamedType (cognitive 34) pkg/linter/lib/src/rules/prefer_void_to_null.dart:58— _Visitor.visitNamedType has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 8 (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.
InstructionsBuilder.forceBuild (cognitive 34) pkg/wasm_builder/lib/src/builder/instructions.dart:296— InstructionsBuilder.forceBuild has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (9 pts), ternaries 6 (7 pts), boolean chains 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.
WidgetCreatorTracker._getPragmaName (cognitive 34) pkg/kernel/lib/transformations/track_widget_constructor_locations.dart:666— WidgetCreatorTracker._getPragmaName has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MoveFieldInitializers.transformClass (cognitive 34) pkg/vm/lib/transformations/type_flow/transformer.dart:221— MoveFieldInitializers.transformClass has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 6 (8 pts), boolean chains 3, ternaries 1 (3 pts) (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.
ConcreteType.isSubtypeOfRuntimeType (cognitive 34) pkg/vm/lib/transformations/type_flow/types.dart:1249— ConcreteType.isSubtypeOfRuntimeType has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (28 pts), ternaries 1 (3 pts), loops 1 (2 pts), 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.
TemplateLoader._Preprocess (cognitive 34) tools/dom/scripts/templateloader.py:62— TemplateLoader._Preprocess has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (31 pts), boolean chains 2, 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.
gn.RunGnOnConfiguredConfigurations (cognitive 34) tools/gn.py:657— gn.RunGnOnConfiguredConfigurations has cognitive complexity 34 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 7 (14 pts), error handling 1 (2 pts), boolean chains 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.
RelevanceDataCollector._recordMemberDepth (cognitive 33) pkg/analysis_server/tool/code_completion/relevance_metrics.dart:1793— RelevanceDataCollector._recordMemberDepth has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (10 pts) (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.
DynamicDispatchTable._lookupTarget (cognitive 33) pkg/dart2wasm/lib/dynamic_dispatch_table.dart:141— DynamicDispatchTable._lookupTarget has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 8, ternaries 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.
DartFuzz.pickScalarVar (cognitive 33) runtime/tools/dartfuzz/dartfuzz.dart:2128— DartFuzz.pickScalarVar has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 4 (6 pts), ternaries 1 (2 pts), 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.
_SyncStarIterator.moveNext (cognitive 33) sdk/lib/_internal/vm/lib/async_patch.dart:566— _SyncStarIterator.moveNext has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (23 pts), error handling 3 (9 pts), 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.
_BigIntImpl._remDigits (cognitive 33) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1634— _BigIntImpl._remDigits has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (9 pts), 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.
_Base64Decoder.decodeChunk (cognitive 33) sdk/lib/convert/base64.dart:695— _Base64Decoder.decodeChunk has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 4, loops 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.
_Uri._normalizeZoneID (cognitive 33) sdk/lib/core/uri.dart:2468— _Uri._normalizeZoneID has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 4, 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.
SSAComputation.insertPhis (cognitive 33) pkg/cfg/lib/ir/ssa_computation.dart:41— SSAComputation.insertPhis has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 4 (8 pts), match/switch 1 (6 pts), 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.
FfiTransformer.ensureArraySizeAnnotation (cognitive 33) pkg/vm/lib/modular/transformations/ffi/common.dart:1480— FfiTransformer.ensureArraySizeAnnotation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parsePrimaryPattern (cognitive 33) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11653— Parser.parsePrimaryPattern has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 7, 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.
SharedInteropTransformer.visitStaticInvocation (cognitive 33) pkg/_js_interop_checks/lib/src/transformations/shared_interop_transformer.dart:203— SharedInteropTransformer.visitStaticInvocation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 9, ternaries 2 (6 pts) (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.
AnalysisServer.reportAnalysisAnalytics (cognitive 33) pkg/analysis_server/lib/src/analysis_server.dart:1172— AnalysisServer.reportAnalysisAnalytics has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 5 (9 pts), match/switch 1 (3 pts) (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.
DartUnitHighlightsComputer._addIdentifierRegion_field (cognitive 33) pkg/analysis_server/lib/src/computer/computer_highlights.dart:257— DartUnitHighlightsComputer._addIdentifierRegion_field has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (25 pts), ternaries 2 (5 pts), boolean chains 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.
_DartUnitHighlightsComputerVisitor._findEscapes (cognitive 33) pkg/analysis_server/lib/src/computer/computer_highlights.dart:2088— _DartUnitHighlightsComputerVisitor._findEscapes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 7, loops 2, ternaries 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.
DartCompletionRequest.targetPrefix (cognitive 33) pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart:451— DartCompletionRequest.targetPrefix has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 11, ternaries 1 (2 pts), 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.
DeclarationHelper._canAccessInstanceMember (cognitive 33) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1809— DeclarationHelper._canAccessInstanceMember has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (28 pts), match/switch 2 (5 pts) (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.
CreateSetter.compute (cognitive 33) pkg/analysis_server/lib/src/services/correction/dart/create_setter.dart:32— CreateSetter.compute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (31 pts), 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.
_RemoveConst.compute (cognitive 33) pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart:164— _RemoveConst.compute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (8 pts), loops 1 (3 pts) (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.
AnalysisOptionsFixGenerator._createScalarDeletionBuilder (cognitive 33) pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart:218— AnalysisOptionsFixGenerator._createScalarDeletionBuilder has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ElementMapper.visitIdentifier (cognitive 33) pkg/analyzer/lib/src/dart/ast/element_locator.dart:107— _ElementMapper.visitIdentifier has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 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.
AstRewriter.parsedExpression (cognitive 33) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:291— AstRewriter.parsedExpression has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 2 (5 pts), boolean chains 4, 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.
ExitDetector.visitForElement (cognitive 33) pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:203— ExitDetector.visitForElement has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 5 (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.
DartdocDirectiveInfo.extractTemplate (cognitive 33) pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart:48— DartdocDirectiveInfo.extractTemplate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 8, loops 3 (5 pts) (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.
BestPracticesVerifier.visitMethodDeclaration (cognitive 33) pkg/analyzer/lib/src/error/best_practices_verifier.dart:651— BestPracticesVerifier.visitMethodDeclaration has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 7, ternaries 1 (2 pts) (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.
_InvalidAccessVerifier._checkForOtherInvalidAccess (cognitive 33) pkg/analyzer/lib/src/error/best_practices_verifier.dart:2065— _InvalidAccessVerifier._checkForOtherInvalidAccess has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 11, match/switch 1 (2 pts) (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.
ErrorVerifier._checkForEachParts (cognitive 33) pkg/analyzer/lib/src/generated/error_verifier.dart:5041— ErrorVerifier._checkForEachParts has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (26 pts), ternaries 4 (5 pts), 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.
FfiVerifier._validateAbiSpecificIntegerMappingAnnotation (cognitive 33) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1281— FfiVerifier._validateAbiSpecificIntegerMappingAnnotation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 4 (7 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartEditBuilderImpl.writeOverride (cognitive 33) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:605— DartEditBuilderImpl.writeOverride has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 2, ternaries 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.
DeferredLoadTask.dump (cognitive 33) pkg/compiler/lib/src/deferred_load/deferred_load.dart:585— DeferredLoadTask.dump has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 5 (11 pts), ternaries 1 (2 pts), 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.
ProgramCompiler._emitImports (cognitive 33) pkg/dev_compiler/lib/src/kernel/compiler.dart:8916— ProgramCompiler._emitImports has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 6, loops 2 (3 pts), ternaries 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.
TypeLabeler.visitFunctionType (cognitive 33) pkg/front_end/lib/src/codes/type_labeler.dart:214— TypeLabeler.visitFunctionType has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 4 (7 pts), 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.
RegularFieldDeclaration.createFieldEncoding (cognitive 33) pkg/front_end/lib/src/fragment/field/declaration.dart:521— RegularFieldDeclaration.createFieldEncoding has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 10 (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.
DynamicInterfaceSpecification.findNodes (cognitive 33) pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:216— DynamicInterfaceSpecification.findNodes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 3 (9 pts), 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.
KernelTarget._finishClassConstruction (cognitive 33) pkg/front_end/lib/src/kernel/kernel_target.dart:1439— KernelTarget._finishClassConstruction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceLoader._createSourceCompilationUnit (cognitive 33) pkg/front_end/lib/src/source/source_loader.dart:486— SourceLoader._createSourceCompilationUnit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 5, match/switch 1 (2 pts) (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.
DebuggerLocation._completeFile (cognitive 33) pkg/observatory/lib/src/debugger/debugger_location.dart:374— DebuggerLocation._completeFile has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (8 pts) (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.
AstNodeImplGenerator._generateFields (cognitive 32) pkg/analyzer/tool/generators/ast_generator.dart:766— AstNodeImplGenerator._generateFields has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 4 (11 pts), match/switch 1 (2 pts), 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.
Types.emitIsTest (cognitive 32) pkg/dart2wasm/lib/types.dart:433— Types.emitIsTest has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (27 pts), loops 1 (3 pts), 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.
Analysis.parseTraverseFilter (cognitive 32) pkg/heap_snapshot/lib/analysis.dart:437— Analysis.parseTraverseFilter has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (8 pts), ternaries 2 (8 pts), 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.
NaiveTypeChecker.checkOverride (cognitive 32) pkg/kernel/lib/naive_type_checker.dart:50— NaiveTypeChecker.checkOverride has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 3, ternaries 1 (3 pts) (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.
MemberType.parse (cognitive 32) pkg/vm_service/tool/dart/generate_dart_common.dart:338— MemberType.parse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (10 pts), boolean chains 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.
_TraceReader.readTrace (cognitive 32) pkg/vm_snapshot_analysis/lib/precompiler_trace.dart:210— _TraceReader.readTrace has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 4 (5 pts), match/switch 1 (2 pts), 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.
DebugInfoWriter._flushPending (cognitive 32) pkg/wasm_builder/lib/debug_info.dart:371— DebugInfoWriter._flushPending has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 12, ternaries 2 (3 pts) (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.
_LibraryManager.findMatches (cognitive 32) tools/dom/src/native_DOMImplementation.dart:73— _LibraryManager.findMatches has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 6 (7 pts), boolean chains 3, ternaries 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.
_SyncStarIterator.moveNext (cognitive 32) sdk/lib/_internal/wasm/common/sync_star_patch.dart:111— _SyncStarIterator.moveNext has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (22 pts), error handling 3 (9 pts), 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.
_TypeUniverse.isFunctionSubtype (cognitive 32) sdk/lib/_internal/wasm/common/type.dart:1212— _TypeUniverse.isFunctionSubtype has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 5 (6 pts), 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.
Arm64CodeGenerator.visitTypeCast (cognitive 32) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1629— Arm64CodeGenerator.visitTypeCast has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 4, ternaries 1 (3 pts), 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.
_Utf8Encoder._fillBuffer (cognitive 32) sdk/lib/convert/utf.dart:188— _Utf8Encoder._fillBuffer has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (30 pts), 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.
Parser.parseLiteralListSuffix (cognitive 32) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8460— Parser.parseLiteralListSuffix has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 2 (3 pts), ternaries 1 (3 pts), 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.parseVariablePattern (cognitive 32) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11885— Parser.parseVariablePattern has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 4, ternaries 1 (3 pts), 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.
DeclarationHelper._addMembersOfEnclosingNode (cognitive 32) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1568— DeclarationHelper._addMembersOfEnclosingNode has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (31 pts), match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
DeclarationHelper._addTopLevelDeclarations (cognitive 32) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1710— DeclarationHelper._addTopLevelDeclarations has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 10 (15 pts) (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.
DeclarationHelper._suggestProperty (cognitive 32) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2551— DeclarationHelper._suggestProperty has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 9 (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.
InScopeCompletionPass.visitPrimaryConstructorDeclaration (cognitive 32) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2577— InScopeCompletionPass.visitPrimaryConstructorDeclaration has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 12 (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.
AddConst.compute (cognitive 32) pkg/analysis_server/lib/src/services/correction/dart/add_const.dart:32— AddConst.compute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 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.
AddMissingEnumCaseClauses.compute (cognitive 32) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart:26— AddMissingEnumCaseClauses.compute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (5 pts), boolean chains 1, ternaries 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.
_CreateMixin.compute (cognitive 32) pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart:125— _CreateMixin.compute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, error handling 1 (5 pts), loops 1 (2 pts), ternaries 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.
TemplateContext._getInvocation (cognitive 32) pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart:81— TemplateContext._getInvocation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 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.
ContextsPage.generateContent (cognitive 32) pkg/analysis_server/lib/src/status/pages/contexts_page.dart:37— ContextsPage.generateContent has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 5 (7 pts), ternaries 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.
_ConstLiteralVerifier._validateMapLiteralEntry (cognitive 32) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1475— _ConstLiteralVerifier._validateMapLiteralEntry has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 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.
UnknownInferredType.isUnknown (cognitive 32) pkg/analyzer/lib/src/dart/element/type_schema.dart:84— UnknownInferredType.isUnknown has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 5 (10 pts), 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.
FunctionReferenceResolver.resolveInstantiation (cognitive 32) pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart:30— FunctionReferenceResolver.resolveInstantiation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3 (8 pts), match/switch 3 (6 pts), boolean chains 5 (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.
ElementUsageDetector._visitParametersAndArguments (cognitive 32) pkg/analyzer/lib/src/error/element_usage_detector.dart:432— ElementUsageDetector._visitParametersAndArguments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 2 (5 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (ElementUsageDetectorV2._visitParametersAndArguments) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ElementUsageDetectorV2._visitParametersAndArguments (cognitive 32) pkg/analyzer/lib/src/error/element_usage_detector.dart:1020— ElementUsageDetectorV2._visitParametersAndArguments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 2 (5 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (ElementUsageDetector._visitParametersAndArguments) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
IgnoreValidator.reportErrors (cognitive 32) pkg/analyzer/lib/src/error/ignore_validator.dart:72— IgnoreValidator.reportErrors has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 5 (6 pts), 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.
ErrorVerifier._validateConstructorBodyAllowed (cognitive 32) pkg/analyzer/lib/src/generated/error_verifier.dart:8855— ErrorVerifier._validateConstructorBodyAllowed has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 2 (8 pts), 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.
FfiVerifier._validateNativeCallable (cognitive 32) pkg/analyzer/lib/src/generated/ffi_verifier.dart:2186— FfiVerifier._validateNativeCallable has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 5, 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.
SimplyBoundedNode._visitType (cognitive 32) pkg/analyzer/lib/src/summary2/simply_bounded.dart:274— SimplyBoundedNode._visitType has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 3 (7 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_PropertyInducingElementTypeInference.perform (cognitive 32) pkg/analyzer/lib/src/summary2/top_level_inference.dart:213— _PropertyInducingElementTypeInference.perform has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, loops 1 (2 pts), 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.
ElementSuggestionBuilder.addSuggestion (cognitive 32) pkg/analyzer_plugin/lib/src/utilities/completion/element_suggestion_builder.dart:35— ElementSuggestionBuilder.addSuggestion has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 2 (10 pts), boolean chains 2 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FragmentEmitter.emitNativeSupport (cognitive 32) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:2274— FragmentEmitter.emitNativeSupport has cognitive complexity 32 (threshold 15). Drivers by points: loops 5 (16 pts), if/else 6 (13 pts), boolean chains 3 (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.
KernelSsaGraphBuilder._buildParameterStub (cognitive 32) pkg/compiler/lib/src/ssa/builder.dart:1383— KernelSsaGraphBuilder._buildParameterStub has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (26 pts), loops 2 (6 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LibraryCompiler._emitClassProperties (cognitive 32) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2799— LibraryCompiler._emitClassProperties has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 3, loops 3, ternaries 1 (2 pts) (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.
IncrementalCompiler.compileExpression (cognitive 32) pkg/front_end/lib/src/base/incremental_compiler.dart:2002— IncrementalCompiler.compileExpression has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (7 pts), boolean chains 4, ternaries 1 (4 pts) (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.
BodyBuilderImpl._buildConstructorInvocation (cognitive 32) pkg/front_end/lib/src/kernel/body_builder.dart:10756— BodyBuilderImpl._buildConstructorInvocation has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (27 pts), 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.
DartScopeBuilder2._looksLikePatternMatching (cognitive 32) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:946— DartScopeBuilder2._looksLikePatternMatching has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 13, loops 2 (5 pts) (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.
_InitializerBuilder.processInitializers (cognitive 32) pkg/front_end/lib/src/kernel/resolver_helpers.dart:235— _InitializerBuilder.processInitializers has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 1 (3 pts), match/switch 1 (2 pts), 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.
SourceLoader.checkMixinSuperAccesses (cognitive 32) pkg/front_end/lib/src/source/source_loader.dart:2923— SourceLoader.checkMixinSuperAccesses has cognitive complexity 32 (threshold 15). Drivers by points: if/else 4 (19 pts), loops 4 (13 pts) (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.
OperationsCfe.lookupMemberTypeInternal (cognitive 32) pkg/front_end/lib/src/type_inference/type_inference_engine.dart:1182— OperationsCfe.lookupMemberTypeInternal has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 1 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
HtmlDartGenerator._ConvertArgumentTypes (cognitive 32) tools/dom/scripts/htmldartgenerator.py:987— HtmlDartGenerator._ConvertArgumentTypes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (21 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
JsInteropChecks._checkDisallowedTearoff (cognitive 31) pkg/_js_interop_checks/lib/js_interop_checks.dart:685— JsInteropChecks._checkDisallowedTearoff has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 5 (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.
CompletionResult.group (cognitive 31) pkg/analysis_server/tool/code_completion/completion_metrics.dart:1696— CompletionResult.group has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 6 (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.
AstNodeImplGenerator._generateConstructor (cognitive 31) pkg/analyzer/tool/generators/ast_generator.dart:602— AstNodeImplGenerator._generateConstructor has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 2 (4 pts), 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.
_ImplGenerator.generate (cognitive 31) pkg/analyzer/tool/summary/generate.dart:960— _ImplGenerator.generate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (29 pts), 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.
Application._printOutput (cognitive 31) pkg/front_end/tool/parser_direct_ast/console_helper.dart:108— Application._printOutput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 3 (9 pts), boolean chains 4, loops 2 (3 pts) (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.
Analysis._calculateRetainers (cognitive 31) pkg/heap_snapshot/lib/analysis.dart:720— Analysis._calculateRetainers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 3 (6 pts), 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.
ClosedWorldClassHierarchy._buildDeclaredMembers (cognitive 31) pkg/kernel/lib/class_hierarchy.dart:1636— ClosedWorldClassHierarchy._buildDeclaredMembers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 3 (4 pts), boolean chains 2, ternaries 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.
_VerifyingVisitor.visitFunctionNode (cognitive 31) pkg/kernel/lib/verifier.dart:1061— _VerifyingVisitor.visitFunctionNode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 7, loops 2 (6 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Utf8Decoder.convertChunked (cognitive 31) sdk/lib/_internal/vm/lib/convert_patch.dart:1869— _Utf8Decoder.convertChunked has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 4 (10 pts), boolean chains 2, loops 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.
RegisterAllocationChecker.verifyConstraints (cognitive 31) pkg/native_compiler/lib/back_end/regalloc_checker.dart:45— RegisterAllocationChecker.verifyConstraints has cognitive complexity 31 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 4 (11 pts), match/switch 1 (5 pts) (nesting depth added 21). 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.
_Uri._makeHost (cognitive 31) sdk/lib/core/uri.dart:2397— _Uri._makeHost has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 2 (9 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Parser.parseEnum (cognitive 31) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:2593— Parser.parseEnum has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (5 pts), boolean chains 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.
Parser.parseInitializer (cognitive 31) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4804— Parser.parseInitializer has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 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.
DeclarationHelper._addMembersOfEnclosingInstance (cognitive 31) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1458— DeclarationHelper._addMembersOfEnclosingInstance has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 11, loops 4, ternaries 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.
InScopeCompletionPass.visitIfStatement (cognitive 31) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1816— InScopeCompletionPass.visitIfStatement has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 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.
BulkFixProcessor._computeFixes (cognitive 31) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:527— BulkFixProcessor._computeFixes has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 3 (5 pts), boolean chains 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.
ConvertToInitializingFormal.compute (cognitive 31) pkg/analysis_server/lib/src/services/correction/dart/convert_to_initializing_formal.dart:39— ConvertToInitializingFormal.compute has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 4 (7 pts) (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.
MakeFieldPublic.compute (cognitive 31) pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart:33— MakeFieldPublic.compute has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2 (6 pts), boolean chains 5 (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.
_InitializeParametersVisitor.visitSimpleIdentifier (cognitive 31) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:1429— _InitializeParametersVisitor.visitSimpleIdentifier has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PropertyElementResolver._resolveTargetSuperReference (cognitive 31) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:2428— PropertyElementResolver._resolveTargetSuperReference has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (31 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AssignmentVerifier._verify (cognitive 31) pkg/analyzer/lib/src/error/assignment_verifier.dart:91— AssignmentVerifier._verify has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 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.
BestPracticesVerifier._getSubExpressionsMarkedDoNotStore (cognitive 31) pkg/analyzer/lib/src/error/best_practices_verifier.dart:1651— BestPracticesVerifier._getSubExpressionsMarkedDoNotStore has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ImportsVerifier.generateUnusedShownNameHints (cognitive 31) pkg/analyzer/lib/src/error/imports_verifier.dart:270— ImportsVerifier.generateUnusedShownNameHints has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 3 (7 pts), 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.
DocCommentBuilder._parseOneCommentReference (cognitive 31) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:605— DocCommentBuilder._parseOneCommentReference has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 8 (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.
DumpInfoTask.buildDumpInfoDataNew (cognitive 31) pkg/compiler/lib/src/dump_info.dart:1913— DumpInfoTask.buildDumpInfoDataNew has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 6 (9 pts), ternaries 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.
TypeMask.getNotNormalizedReason (cognitive 31) pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart:526— TypeMask.getNotNormalizedReason has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 2 (4 pts) (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.
RuntimeTypesImpl.computeRequiredChecks (cognitive 31) pkg/compiler/lib/src/js_backend/runtime_types.dart:534— RuntimeTypesImpl.computeRequiredChecks has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 9 (12 pts), 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.
KernelToElementMap._ensureSupertypes (cognitive 31) pkg/compiler/lib/src/kernel/element_map_impl.dart:355— KernelToElementMap._ensureSupertypes has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (10 pts) (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.
SsaCodeGenerator.visitInvokeStatic (cognitive 31) pkg/compiler/lib/src/ssa/codegen.dart:2323— SsaCodeGenerator.visitInvokeStatic has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (30 pts), 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.
SsaCodeGenerator.visitInvokeExternal (cognitive 31) pkg/compiler/lib/src/ssa/codegen.dart:2901— SsaCodeGenerator.visitInvokeExternal has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 4 (7 pts), boolean chains 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.
ClassSet.addSubtype (cognitive 31) pkg/compiler/lib/src/universe/class_set.dart:780— ClassSet.addSubtype has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 1 (2 pts) (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.
DartDebugAdapter._buildOutputEventsWithSourceReferences (cognitive 31) pkg/dap_adapters/lib/src/adapters/dart.dart:2659— DartDebugAdapter._buildOutputEventsWithSourceReferences has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 5 (6 pts), boolean chains 5, error handling 2 (3 pts), 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.
TestAdapter.sendTestTextOutput (cognitive 31) pkg/dap_adapters/lib/src/adapters/mixins.dart:93— TestAdapter.sendTestTextOutput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 2 (8 pts), boolean chains 2, match/switch 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
CompileNativeCommand.run (cognitive 31) pkg/dartdev/lib/src/commands/compile.dart:639— CompileNativeCommand.run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 2, error handling 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.
MiniJsParser.parsePrimary (cognitive 31) pkg/dev_compiler/lib/src/js_ast/builder.dart:866— MiniJsParser.parsePrimary has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (29 pts), loops 1 (2 pts) (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.
MiniJsParser.parseCall (cognitive 31) pkg/dev_compiler/lib/src/js_ast/builder.dart:1104— MiniJsParser.parseCall has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (5 pts), ternaries 1 (3 pts), 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.
IncrementalCompiler._computeExpressionCompilationExtensionData (cognitive 31) pkg/front_end/lib/src/base/incremental_compiler.dart:2393— IncrementalCompiler._computeExpressionCompilationExtensionData has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 5 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantEvaluator._handleFromEnvironment (cognitive 31) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5109— ConstantEvaluator._handleFromEnvironment has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (29 pts), ternaries 1 (2 pts) (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.
SourceCompilationUnitImpl._includePartIfValid (cognitive 31) pkg/front_end/lib/src/source/source_compilation_unit.dart:902— SourceCompilationUnitImpl._includePartIfValid has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 1, match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
_ConstMapLiteralBuilder.translate (cognitive 31) pkg/front_end/lib/src/type_inference/collection_encoding.dart:322— _ConstMapLiteralBuilder.translate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 2 (4 pts), loops 2, match/switch 1 (2 pts), 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.
Cache.createExpression (cognitive 31) pkg/front_end/lib/src/type_inference/matching_cache.dart:1249— Cache.createExpression has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 1 (4 pts), 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.
BestEffortParserAstVisitor.accept (cognitive 31) pkg/front_end/lib/src/util/parser_ast.dart:124— BestEffortParserAstVisitor.accept has cognitive complexity 31 (threshold 15). Drivers by points: if/else 24, boolean chains 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.
FrontendServerClient.compile (cognitive 31) pkg/frontend_server_client/lib/src/frontend_server_client.dart:178— FrontendServerClient.compile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (5 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
_Visitor.visitInstanceCreationExpression (cognitive 31) pkg/linter/lib/src/rules/prefer_collection_literals.dart:40— _Visitor.visitInstanceCreationExpression has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 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.
_Visitor.visitDeclaredVariablePattern (cognitive 31) pkg/linter/lib/src/rules/prefer_final_locals.dart:78— _Visitor.visitDeclaredVariablePattern has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 2 (5 pts) (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.
_Visitor._checkConstructor (cognitive 31) pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart:69— _Visitor._checkConstructor has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (28 pts), boolean chains 2, loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TypeMemberContributor._computeSuggestions (cognitive 31) pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart:64— TypeMemberContributor._computeSuggestions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 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.
HtmlDartGenerator._AddFutureifiedOperation (cognitive 31) tools/dom/scripts/htmldartgenerator.py:694— HtmlDartGenerator._AddFutureifiedOperation has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 6 (7 pts), loops 2 (4 pts), 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.
BulkFixDetails.collectOverrides (cognitive 30) pkg/analysis_server/tool/bulk_fix/parse_utils.dart:14— BulkFixDetails.collectOverrides has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (22 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Analysis.examine (cognitive 30) pkg/heap_snapshot/lib/analysis.dart:127— Analysis.examine has cognitive complexity 30 (threshold 15). Drivers by points: loops 4 (14 pts), if/else 8 (13 pts), boolean chains 3 (nesting depth added 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.
Primitives.applyFunction (cognitive 30) sdk/lib/_internal/js_runtime/lib/js_helper.dart:980— Primitives.applyFunction has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (28 pts), 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.
_ChunkedJsonParser.parseStringToBuffer (cognitive 30) sdk/lib/_internal/vm/lib/convert_patch.dart:1125— _ChunkedJsonParser.parseStringToBuffer has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (3 pts), 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.
Arm64Assembler.loadImmediate (cognitive 30) pkg/native_compiler/lib/back_end/arm64/assembler.dart:598— Arm64Assembler.loadImmediate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 4 (6 pts), ternaries 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.
_Base64Decoder._checkPadding (cognitive 30) sdk/lib/convert/base64.dart:848— _Base64Decoder._checkPadding has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (29 pts), 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.
CorrectionUtils._invertCondition0 (cognitive 30) pkg/analysis_server_plugin/lib/edit/correction_utils.dart:348— CorrectionUtils._invertCondition0 has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (30 pts) (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.
ExpressionIdentifierContext.ensureIdentifier (cognitive 30) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:393— ExpressionIdentifierContext.ensureIdentifier has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 18, if/else 8 (12 pts) (nesting depth added 4). 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.
Parser.parseRecordType (cognitive 30) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:1735— Parser.parseRecordType has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 7, 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.
ComplexTypeInfo._checkIfRecordTypeParenthesisAreRecovered (cognitive 30) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:879— ComplexTypeInfo._checkIfRecordTypeParenthesisAreRecovered has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 8, 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.
TypeAnalyzerOperationsMixin.chooseTypeFromConstraint (cognitive 30) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:1014— TypeAnalyzerOperationsMixin.chooseTypeFromConstraint has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 4 (12 pts) (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.
ContextManagerImpl._createAnalysisContexts (cognitive 30) pkg/analysis_server/lib/src/context_manager.dart:687— ContextManagerImpl._createAnalysisContexts has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6 (10 pts), boolean chains 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.
EditBulkFixes.handle (cognitive 30) pkg/analysis_server/lib/src/handler/legacy/edit_bulk_fixes.dart:22— EditBulkFixes.handle has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (7 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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.
_DebounceRequests._filterRequests (cognitive 30) pkg/analysis_server/lib/src/server/debounce_requests.dart:65— _DebounceRequests._filterRequests has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (29 pts), 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.
BulkFixProcessor._fixErrorsInLibraryUnit (cognitive 30) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:703— BulkFixProcessor._fixErrorsInLibraryUnit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 10, loops 3 (4 pts) (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.
AddSuperConstructorInvocation._producersFromPrimary (cognitive 30) pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart:85— AddSuperConstructorInvocation._producersFromPrimary has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (28 pts), 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.
ConvertMapFromIterableToForLiteral._extractClosure (cognitive 30) pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart:179— ConvertMapFromIterableToForLiteral._extractClosure has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (28 pts), boolean chains 2 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_MatcherBuilder._buildFromSimpleIdentifier (cognitive 30) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart:601— _MatcherBuilder._buildFromSimpleIdentifier has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 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.
_ReferenceProcessor._inlineMethodInvocation (cognitive 30) pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart:766— _ReferenceProcessor._inlineMethodInvocation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 1 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MoveFileRefactoringImpl._collectSourceReferences (cognitive 30) pkg/analysis_server/lib/src/services/refactoring/legacy/move_file.dart:195— MoveFileRefactoringImpl._collectSourceReferences has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 4 (11 pts) (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.
PluginsPage._emitIncompatibleInfo (cognitive 30) pkg/analysis_server/lib/src/status/pages/plugins_page.dart:82— PluginsPage._emitIncompatibleInfo has cognitive complexity 30 (threshold 15). Drivers by points: loops 7 (18 pts), if/else 4 (12 pts) (nesting depth added 19). 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.
ClassElementImpl.allSubtypes (cognitive 30) pkg/analyzer/lib/src/dart/element/element.dart:157— ClassElementImpl.allSubtypes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (3 pts) (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.
FfiVerifier._checkFfiNative (cognitive 30) pkg/analyzer/lib/src/generated/ffi_verifier.dart:663— FfiVerifier._checkFfiNative has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LocalDeclarationVisitor._visitStatements (cognitive 30) pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:449— LocalDeclarationVisitor._visitStatements has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (5 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
KClassEnv._ensureMaps (cognitive 30) pkg/compiler/lib/src/kernel/env.dart:243— KClassEnv._ensureMaps has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 5 (7 pts), 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.
KernelAnnotationProcessor.extractJsInteropAnnotations (cognitive 30) pkg/compiler/lib/src/kernel/native_basic_data.dart:75— KernelAnnotationProcessor.extractJsInteropAnnotations has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (27 pts), 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.
Maplet.[]= (cognitive 30) pkg/compiler/lib/src/util/maplet.dart:95— Maplet.[]= has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (8 pts), 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.
ProtocolConverter.convertVmInstanceRefToDisplayString (cognitive 30) pkg/dap_adapters/lib/src/protocol_converter.dart:45— ProtocolConverter.convertVmInstanceRefToDisplayString has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (19 pts), ternaries 4 (8 pts), boolean chains 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.
JsBuilder.escapedString (cognitive 30) pkg/dev_compiler/lib/src/js_ast/builder.dart:288— JsBuilder.escapedString has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 11, loops 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.
ProgramCompiler._is31BitUnsigned (cognitive 30) pkg/dev_compiler/lib/src/kernel/compiler.dart:6283— ProgramCompiler._is31BitUnsigned has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 2 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LibraryCompiler._is31BitUnsigned (cognitive 30) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6972— LibraryCompiler._is31BitUnsigned has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 2 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExpressionCompiler._findScopeAt (cognitive 30) pkg/dev_compiler/lib/src/kernel/expression_compiler.dart:328— ExpressionCompiler._findScopeAt has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 4 (7 pts), error handling 1 (2 pts), 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.
BodyBuilderImpl.endFormalParameters (cognitive 30) pkg/front_end/lib/src/kernel/body_builder.dart:3944— BodyBuilderImpl.endFormalParameters has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 9, match/switch 1 (2 pts) (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.
BodyBuilderImpl.endRecordLiteral (cognitive 30) pkg/front_end/lib/src/kernel/body_builder.dart:5089— BodyBuilderImpl.endRecordLiteral has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (5 pts), boolean chains 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.
ConstantsTransformer.visitRecordLiteral (cognitive 30) pkg/front_end/lib/src/kernel/constant_evaluator.dart:2342— ConstantsTransformer.visitRecordLiteral has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 2 (4 pts), 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.
SourceLoader.buildOutlines (cognitive 30) pkg/front_end/lib/src/source/source_loader.dart:1308— SourceLoader.buildOutlines has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 4 (9 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ReferenceName.fromNamedNode (cognitive 30) pkg/kernel/lib/src/equivalence_helpers.dart:253— ReferenceName.fromNamedNode has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (30 pts) (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.
_Visitor._checkTopLevelFragment (cognitive 30) pkg/linter/lib/src/rules/analyzer_public_api.dart:162— _Visitor._checkTopLevelFragment has cognitive complexity 30 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 6 (10 pts), boolean chains 3, match/switch 1 (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.
DebuggerLocation._parseFunction (cognitive 30) pkg/observatory/lib/src/debugger/debugger_location.dart:243— DebuggerLocation._parseFunction has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (7 pts) (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.
ScriptInsetElement.lineNumberElement (cognitive 30) pkg/observatory/lib/src/elements/script_inset.dart:903— ScriptInsetElement.lineNumberElement has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (9 pts), boolean chains 1, ternaries 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.
ServiceEvent._update (cognitive 30) pkg/observatory/lib/src/service/object.dart:2342— ServiceEvent._update has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27 (28 pts), boolean chains 2 (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.
Event.toJson (cognitive 30) pkg/vm_service/lib/src/vm_service.dart:4168— Event.toJson has cognitive complexity 30 (threshold 15). Drivers by points: if/else 30. 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.
HtmlEventGenerator.EmitStreamGetters (cognitive 30) tools/dom/scripts/htmleventgenerator.py:316— HtmlEventGenerator.EmitStreamGetters has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 4 (12 pts), loops 3 (5 pts) (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.
Dart2JSBackend.AddIndexer (cognitive 30) tools/dom/scripts/systemhtml.py:1427— Dart2JSBackend.AddIndexer has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 4 (8 pts), loops 2 (5 pts), 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.
Dart2JSBackend._AddDirectNativeOperation (cognitive 30) tools/dom/scripts/systemhtml.py:1943— Dart2JSBackend._AddDirectNativeOperation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 6 (13 pts), boolean chains 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConfigurationFilesMixin.writePackageConfig2 (cognitive 29) pkg/analyzer_testing/lib/configuration_files_mixin.dart:54— ConfigurationFilesMixin.writePackageConfig2 has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 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.
_TextFormatter.add (cognitive 29) pkg/analyzer_utilities/lib/text_formatter.dart:58— _TextFormatter.add has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2 (6 pts), loops 1 (2 pts), match/switch 1 (2 pts) (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.
Translator.convertType (cognitive 29) pkg/dart2wasm/lib/translator.dart:1580— Translator.convertType has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 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.
FrontendCompiler.writePackagesToSinkAndTrimComponent (cognitive 29) pkg/frontend_server/lib/frontend_server.dart:1619— FrontendCompiler.writePackagesToSinkAndTrimComponent has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 8 (14 pts) (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.
_VerifyingVisitor._computeExtensionMembers (cognitive 29) pkg/kernel/lib/verifier.dart:579— _VerifyingVisitor._computeExtensionMembers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 2 (5 pts), 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. This shape REPEATS in the file: one other method here (_VerifyingVisitor._computeExtensionTypeMembers) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_VerifyingVisitor._computeExtensionTypeMembers (cognitive 29) pkg/kernel/lib/verifier.dart:643— _VerifyingVisitor._computeExtensionTypeMembers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 2 (5 pts), 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. This shape REPEATS in the file: one other method here (_VerifyingVisitor._computeExtensionMembers) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_GrowableList.addAll (cognitive 29) sdk/lib/_internal/vm/lib/growable_array.dart:294— _GrowableList.addAll has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (9 pts), 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.
_Timer._runTimers (cognitive 29) sdk/lib/_internal/vm/lib/timer_impl.dart:374— _Timer._runTimers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BinaryPrinter.writeStringTable (cognitive 29) pkg/kernel/lib/binary/ast_to_binary.dart:146— BinaryPrinter.writeStringTable has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (5 pts), boolean chains 3 (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.
BinaryPrinter.writeConstantTableEntry (cognitive 29) pkg/kernel/lib/binary/ast_to_binary.dart:232— BinaryPrinter.writeConstantTableEntry has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19, loops 4 (8 pts), ternaries 1 (2 pts) (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.
_SimpleUri.replace (cognitive 29) sdk/lib/core/uri.dart:4753— _SimpleUri.replace has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_FfiDefinitionTransformer._checkFieldAnnotations (cognitive 29) pkg/vm/lib/modular/transformations/ffi/definitions.dart:462— _FfiDefinitionTransformer._checkFieldAnnotations has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, error handling 1 (4 pts), 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.
NativeTypeCfe.NativeTypeCfe (cognitive 29) pkg/vm/lib/modular/transformations/ffi/native_type_cfe.dart:19— NativeTypeCfe.NativeTypeCfe has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 2, loops 1 (2 pts) (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.
_FfiUseSiteTransformer._verifyAndReplaceNativeCallable (cognitive 29) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:1274— _FfiUseSiteTransformer._verifyAndReplaceNativeCallable has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 8 (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.
Lowering.visitComparison (cognitive 29) pkg/native_compiler/lib/passes/lowering.dart:95— Lowering.visitComparison has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 8, ternaries 2 (8 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ComplexTypeParamOrArgInfo.parseVariables (cognitive 29) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1475— ComplexTypeParamOrArgInfo.parseVariables has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 6, loops 3 (5 pts) (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.
TypeAnalyzer.analyzeSwitchStatement (cognitive 29) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:2511— TypeAnalyzer.analyzeSwitchStatement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (5 pts), boolean chains 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.
DependencyWalker.walk (cognitive 29) pkg/_fe_analyzer_shared/lib/src/util/dependency_walker.dart:24— DependencyWalker.walk has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (4 pts) (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.
JsUtilOptimizer._getPrefixSelectorsForStaticallyResolvableMember (cognitive 29) pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart:301— JsUtilOptimizer._getPrefixSelectorsForStaticallyResolvableMember has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 8, ternaries 2 (4 pts) (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.
LibraryElementSuggestionBuilder._visitInterfaceElement (cognitive 29) pkg/analysis_server/lib/src/cider/local_library_contributor.dart:207— LibraryElementSuggestionBuilder._visitInterfaceElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DeclarationHelper._addInstanceMembers (cognitive 29) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1202— DeclarationHelper._addInstanceMembers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 2, loops 2, ternaries 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.
InScopeCompletionPass.visitPrefixedIdentifier (cognitive 29) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2513— InScopeCompletionPass.visitPrefixedIdentifier has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 4 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
KeywordHelper.addImportDirectiveKeywords (cognitive 29) pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart:543— KeywordHelper.addImportDirectiveKeywords has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 3 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AmbiguousImportFix._getImportDirectives (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/ambiguous_import_fix.dart:84— AmbiguousImportFix._getImportDirectives has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 3 (6 pts), ternaries 1 (4 pts) (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.
ConvertIntoGetter.compute (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart:41— ConvertIntoGetter.compute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, loops 1 (2 pts) (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.
ConvertToBooleanExpression.compute (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/convert_to_boolean_expression.dart:28— ConvertToBooleanExpression.compute has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 5 (7 pts), boolean chains 2, match/switch 1 (2 pts) (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.
_CreateConstructor._computeWithoutSuperParameters (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart:95— _CreateConstructor._computeWithoutSuperParameters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CreateExtensionOperator.compute (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:352— CreateExtensionOperator.compute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CreateOperator.compute (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/create_operator.dart:33— CreateOperator.compute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ImportLibrary._otherUnresolvedNames (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/import_library.dart:811— ImportLibrary._otherUnresolvedNames has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (10 pts), 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.
RemoveIgnoredDiagnostic.compute (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/remove_ignored_diagnostic.dart:31— RemoveIgnoredDiagnostic.compute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 2 (5 pts) (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.
RemoveThisAlias.compute (cognitive 29) pkg/analysis_server/lib/src/services/correction/dart/remove_this_alias.dart:32— RemoveThisAlias.compute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 6, 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.
MoveTopLevelToFile.compute (cognitive 29) pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart:84— MoveTopLevelToFile.compute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 9 (14 pts) (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.
_ParsedExpressionBuilder.build (cognitive 29) pkg/analyzer/lib/src/dart/ast/ast.dart:60164— _ParsedExpressionBuilder.build has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 4, match/switch 2 (4 pts), loops 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.
LanguageVersionOverrideVerifier._verifyMisplaced (cognitive 29) pkg/analyzer/lib/src/error/language_version_override_verifier.dart:301— LanguageVersionOverrideVerifier._verifyMisplaced has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (8 pts) (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.
TypeArgumentsVerifier._checkTypeArgumentConst (cognitive 29) pkg/analyzer/lib/src/error/type_arguments_verifier.dart:632— TypeArgumentsVerifier._checkTypeArgumentConst has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
SdkConstraintVerifier._checkSinceSdkVersion (cognitive 29) pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart:325— SdkConstraintVerifier._checkSinceSdkVersion has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (29 pts) (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.
MissingDependencyValidator.validate (cognitive 29) pkg/analyzer/lib/src/pubspec/validators/missing_dependency_validator.dart:60— MissingDependencyValidator.validate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6 (9 pts), boolean chains 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.
DartEditBuilderImpl.writeFormalParameters (cognitive 29) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:347— DartEditBuilderImpl.writeFormalParameters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 2 (4 pts), 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.
CommonMasks._createFromStaticType (cognitive 29) pkg/compiler/lib/src/inferrer/typemasks/masks.dart:332— CommonMasks._createFromStaticType has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (6 pts), boolean chains 5, ternaries 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.
SizeEstimator.visitAssignment (cognitive 29) pkg/compiler/lib/src/js/size_estimator.dart:566— SizeEstimator.visitAssignment has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (12 pts) (nesting depth added 6). 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.
ResolutionEnqueuerListener.registerUsedElement (cognitive 29) pkg/compiler/lib/src/js_backend/resolution_listener.dart:293— ResolutionEnqueuerListener.registerUsedElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 3 (8 pts), 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.
KernelSsaGraphBuilder._handleCreateInvocationMirror (cognitive 29) pkg/compiler/lib/src/ssa/builder.dart:5579— KernelSsaGraphBuilder._handleCreateInvocationMirror has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 5 (12 pts), boolean chains 1, match/switch 1, ternaries 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.
SsaInstructionSimplifier.visitBitOr (cognitive 29) pkg/compiler/lib/src/ssa/optimize.dart:2862— SsaInstructionSimplifier.visitBitOr has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaGlobalValueNumberer.visitBasicBlock (cognitive 29) pkg/compiler/lib/src/ssa/optimize.dart:3817— SsaGlobalValueNumberer.visitBasicBlock has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (2 pts) (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.
Setlet.add (cognitive 29) pkg/compiler/lib/src/util/setlet.dart:88— Setlet.add has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 3 (8 pts), 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.
FixCommand.run (cognitive 29) pkg/dartdev/lib/src/commands/fix.dart:97— FixCommand.run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 9, ternaries 5 (7 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NamedTypeBuilderImpl.substituteRange (cognitive 29) pkg/front_end/lib/src/builder/named_type_builder.dart:1011— NamedTypeBuilderImpl.substituteRange has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), boolean chains 1, 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.
ConstantEvaluator.checkAssert (cognitive 29) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3914— ConstantEvaluator.checkAssert has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (29 pts) (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.
ConstantEvaluator.visitLogicalExpression (cognitive 29) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4610— ConstantEvaluator.visitLogicalExpression has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 2, 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.
_DynamicModuleValidator._expandNode (cognitive 29) pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:503— _DynamicModuleValidator._expandNode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 5 (10 pts), match/switch 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
MiniJsParser.parsePrimary (cognitive 29) pkg/js_ast/lib/src/builder.dart:790— MiniJsParser.parsePrimary has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 1 (2 pts) (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.
Printer.visitAssignment (cognitive 29) pkg/js_ast/lib/src/printer.dart:922— Printer.visitAssignment has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (12 pts) (nesting depth added 6). 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.
StandardBounds.getStandardUpperBoundInternal (cognitive 29) pkg/kernel/lib/src/standard_bounds.dart:593— StandardBounds.getStandardUpperBoundInternal has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 4 (8 pts), match/switch 2 (4 pts), loops 1 (3 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
VmServerConnection._delegateRequest (cognitive 29) pkg/vm_service_interface/lib/src/vm_service_interface.dart:1403— VmServerConnection._delegateRequest has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 3 (9 pts), error handling 2, match/switch 1 (2 pts) (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.
DFilterExpression.evaluate (cognitive 29) runtime/tools/heapsnapshot/lib/src/expression.dart:53— DFilterExpression.evaluate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 11, ternaries 1 (2 pts) (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.
_SummaryNormalizer._normalizeExpr (cognitive 29) pkg/vm/lib/transformations/type_flow/summary_collector.dart:92— _SummaryNormalizer._normalizeExpr has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnnotateKernel._annotateCallSite (cognitive 29) pkg/vm/lib/transformations/type_flow/transformer.dart:633— AnnotateKernel._annotateCallSite has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 9 (13 pts), ternaries 1 (nesting depth added 4). 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.
DatabaseBuilder._output_examination (cognitive 29) tools/dom/scripts/databasebuilder.py:886— DatabaseBuilder._output_examination has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (20 pts), if/else 3 (6 pts), loops 2 (3 pts) (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.
D3SymbolTreeMap.D3SymbolTreeMap._showInfoBox (cognitive 29) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:774— D3SymbolTreeMap.D3SymbolTreeMap._showInfoBox has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 13). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
graphexplorer.Graph.rewriteEdgesForOwners (cognitive 29) runtime/tools/graphexplorer/graphexplorer.js:381— graphexplorer.Graph.rewriteEdgesForOwners has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 6 (9 pts) (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.
ImpliedTypeComputer._computeInContext (cognitive 28) pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart:164— ImpliedTypeComputer._computeInContext has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (7 pts), error handling 1 (3 pts) (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.
RelevanceMetricsComputer._computeInContext (cognitive 28) pkg/analysis_server/tool/code_completion/relevance_metrics.dart:2187— RelevanceMetricsComputer._computeInContext has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (7 pts), error handling 1 (3 pts) (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.
AstNodeImplGenerator._removeGeneratedMembers (cognitive 28) pkg/analyzer/tool/generators/ast_generator.dart:1378— AstNodeImplGenerator._removeGeneratedMembers has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (6 pts), match/switch 1 (3 pts) (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.
_CodeGenerator._addFieldForGetter (cognitive 28) pkg/analyzer/tool/summary/generate.dart:739— _CodeGenerator._addFieldForGetter has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (26 pts), 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.
BytecodeGenerator.defaultMember (cognitive 28) pkg/dart2bytecode/lib/bytecode_generator.dart:822— BytecodeGenerator.defaultMember has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (27 pts), 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.
FunctionDeclaration.toString (cognitive 28) pkg/dart2bytecode/lib/declarations.dart:709— FunctionDeclaration.toString has cognitive complexity 28 (threshold 15). Drivers by points: if/else 27, boolean chains 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.
AstCompilationTask.run (cognitive 28) pkg/dart2wasm/lib/translator.dart:2753— AstCompilationTask.run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 2 (6 pts), 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.
DartDevelopmentServiceLauncher.start (cognitive 28) pkg/dds/lib/dds_launcher.dart:52— DartDevelopmentServiceLauncher.start has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 4 (8 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DevToolsServer._serveDevToolsWithArgs (cognitive 28) pkg/dds/lib/devtools_server.dart:510— DevToolsServer._serveDevToolsWithArgs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 7, boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_HttpOutgoing.writeHeaders (cognitive 28) sdk/lib/_http/http_impl.dart:1795— _HttpOutgoing.writeHeaders has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 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.
_SyncStarIterator.moveNext (cognitive 28) sdk/lib/_internal/js_runtime/lib/async_patch.dart:644— _SyncStarIterator.moveNext has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 1 (3 pts), boolean chains 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.
BoxedDouble.compareTo (cognitive 28) sdk/lib/_internal/wasm/common/boxed_double.dart:325— BoxedDouble.compareTo has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 2 (5 pts), 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.
Uri._parseIPv4Address (cognitive 28) sdk/lib/core/uri.dart:1429— Uri._parseIPv4Address has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (24 pts), ternaries 1 (2 pts), boolean chains 1, 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.
_Uri._uriDecode (cognitive 28) sdk/lib/core/uri.dart:3619— _Uri._uriDecode has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6, loops 2 (3 pts) (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.parseParenthesizedExpressionOrRecordLiteral (cognitive 28) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8293— Parser.parseParenthesizedExpressionOrRecordLiteral has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, 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.
Parser.parseConstExpression (cognitive 28) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9015— Parser.parseConstExpression has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 6 (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.
InScopeCompletionPass.visitFieldDeclaration (cognitive 28) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1383— InScopeCompletionPass.visitFieldDeclaration has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 4 (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.
BulkFixProcessor.fixErrorsUsingParsedResult (cognitive 28) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:284— BulkFixProcessor.fixErrorsUsingParsedResult has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (11 pts), boolean chains 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.
_ConvertQuotes._fixBackslashesForQuotes (cognitive 28) pkg/analysis_server/lib/src/services/correction/dart/convert_quotes.dart:146— _ConvertQuotes._fixBackslashesForQuotes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CreateExtensionMethod.compute (cognitive 28) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:167— CreateExtensionMethod.compute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22, boolean chains 4, match/switch 1 (2 pts) (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.
ReplaceReturnType.compute (cognitive 28) pkg/analysis_server/lib/src/services/correction/dart/replace_return_type.dart:31— ReplaceReturnType.compute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Collector._typedLiteral (cognitive 28) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:522— _Collector._typedLiteral has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (4 pts), boolean chains 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.
InterfaceLeastUpperBoundHelper._computeLongestInheritancePathToObject (cognitive 28) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:199— InterfaceLeastUpperBoundHelper._computeLongestInheritancePathToObject has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (7 pts), ternaries 1 (3 pts), 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.
ReplacementVisitor.visitFunctionType (cognitive 28) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:164— ReplacementVisitor.visitFunctionType has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (8 pts), 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.
TypeSystemImpl.isAlwaysExhaustive (cognitive 28) pkg/analyzer/lib/src/dart/element/type_system.dart:844— TypeSystemImpl.isAlwaysExhaustive has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 3, loops 1 (2 pts) (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.
TypeSystemImpl._refineNumericInvocationContextNullSafe (cognitive 28) pkg/analyzer/lib/src/dart/element/type_system.dart:1953— TypeSystemImpl._refineNumericInvocationContextNullSafe has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9 (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.
CallInvocationResolver.resolve (cognitive 28) pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart:39— CallInvocationResolver.resolve has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
ImportsVerifier._addDuplicateShownHiddenNames (cognitive 28) pkg/analyzer/lib/src/error/imports_verifier.dart:326— ImportsVerifier._addDuplicateShownHiddenNames has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (7 pts) (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.
LibraryManifestBuilder._fillInterfaceElementInterface (cognitive 28) pkg/analyzer/lib/src/fine/library_manifest.dart:1338— LibraryManifestBuilder._fillInterfaceElementInterface has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (6 pts), boolean chains 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.
FfiVerifier._isValidFfiNativeType (cognitive 28) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1116— FfiVerifier._isValidFfiNativeType has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FfiVerifier._validateSizeOfAnnotation (cognitive 28) pkg/analyzer/lib/src/generated/ffi_verifier.dart:2425— FfiVerifier._validateSizeOfAnnotation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2, 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.
ResolverVisitor.visitEnumConstantDeclaration (cognitive 28) pkg/analyzer/lib/src/generated/resolver.dart:3091— ResolverVisitor.visitEnumConstantDeclaration has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SuperContext.of (cognitive 28) pkg/analyzer/lib/src/generated/super_context.dart:36— SuperContext.of has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (25 pts), 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.
VarianceBuilder._compute (cognitive 28) pkg/analyzer/lib/src/summary2/variance_builder.dart:57— VarianceBuilder._compute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (10 pts), 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.
DartFileEditBuilderImpl._importLibrary (cognitive 28) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:3007— DartFileEditBuilderImpl._importLibrary has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (5 pts), match/switch 1 (4 pts) (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.
SpecializedChecks._findAsCheck (cognitive 28) pkg/compiler/lib/src/js_backend/specialized_checks.dart:153— SpecializedChecks._findAsCheck has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 7 (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.
KernelSsaGraphBuilder._handleInvokeFactoryConstructor (cognitive 28) pkg/compiler/lib/src/ssa/builder.dart:5196— KernelSsaGraphBuilder._handleInvokeFactoryConstructor has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 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.
SsaInstructionSimplifier.visitShiftLeft (cognitive 28) pkg/compiler/lib/src/ssa/optimize.dart:2990— SsaInstructionSimplifier.visitShiftLeft has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (25 pts), boolean chains 3 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CallStructure.signatureApplies (cognitive 28) pkg/compiler/lib/src/universe/call_structure.dart:196— CallStructure.signatureApplies has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (5 pts) (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.
ExecutableCompiler.isSnapshotFresh (cognitive 28) pkg/dartdev/lib/src/executable_compiler.dart:131— ExecutableCompiler.isSnapshotFresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 7, error handling 2 (3 pts), loops 1 (2 pts), ternaries 1 (2 pts) (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.
ProgramCompiler._emitCovarianceCheckStub (cognitive 28) pkg/dev_compiler/lib/src/kernel/compiler.dart:2693— ProgramCompiler._emitCovarianceCheckStub has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 6, loops 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.
LibraryCompiler._emitCovarianceCheckStub (cognitive 28) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:3003— LibraryCompiler._emitCovarianceCheckStub has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 6, loops 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.
DevHandler._handleConnection (cognitive 28) pkg/dwds/lib/src/handlers/dev_handler.dart:403— DevHandler._handleConnection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 2 (3 pts), ternaries 1 (3 pts), 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.
LoadedLibrariesImpl.forEachImportChain (cognitive 28) pkg/front_end/lib/src/base/import_chains.dart:125— LoadedLibrariesImpl.forEachImportChain has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (5 pts) (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.
Modifiers.from (cognitive 28) pkg/front_end/lib/src/base/modifiers.dart:97— Modifiers.from has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 13, boolean chains 12, match/switch 1 (2 pts), if/else 1 (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.
FactoryEncoding.inferRedirectionTarget (cognitive 28) pkg/front_end/lib/src/fragment/factory/encoding.dart:225— FactoryEncoding.inferRedirectionTarget has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 6, 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.
BodyBuilderImpl.createFieldInitializer (cognitive 28) pkg/front_end/lib/src/kernel/body_builder.dart:2234— BodyBuilderImpl.createFieldInitializer has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 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.
SynthesizedInterfaceMember._ensureMemberAndCovariance (cognitive 28) pkg/front_end/lib/src/kernel/hierarchy/class_member.dart:540— SynthesizedInterfaceMember._ensureMemberAndCovariance has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 2 (6 pts), 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.
_SanitizedMember.computeMembers (cognitive 28) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:1002— _SanitizedMember.computeMembers has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 3 (9 pts), ternaries 2 (8 pts) (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.
_DeclarationBuilderRegistry.registerBuilder (cognitive 28) pkg/front_end/lib/src/source/name_space_builder.dart:258— _DeclarationBuilderRegistry.registerBuilder has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (23 pts), 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.
MatchingExpressionVisitor.visitListPattern (cognitive 28) pkg/front_end/lib/src/type_inference/matching_expressions.dart:117— MatchingExpressionVisitor.visitListPattern has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (26 pts), 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.
MiniJsParser.getString (cognitive 28) pkg/js_ast/lib/src/builder.dart:579— MiniJsParser.getString has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), 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.
_Visitor._checkFormalParameters (cognitive 28) pkg/linter/lib/src/rules/strict_top_level_inference.dart:137— _Visitor._checkFormalParameters has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 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.
ConcreteType.intersection (cognitive 28) pkg/vm/lib/transformations/type_flow/types.dart:1420— ConcreteType.intersection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 1 (3 pts) (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.
bin_to_coff.main (cognitive 28) runtime/tools/bin_to_coff.py:113— bin_to_coff.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (19 pts), ternaries 4 (5 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DartiumBackend._GenerateNativeBinding (cognitive 28) tools/dom/scripts/systemnative.py:1009— DartiumBackend._GenerateNativeBinding has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 2, ternaries 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.
D3SymbolTreeMap.D3SymbolTreeMap._clone (cognitive 28) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:286— D3SymbolTreeMap.D3SymbolTreeMap._clone has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
AstNodeImplGenerator._generateNodeGettersSetters (cognitive 27) pkg/analyzer/tool/generators/ast_generator.dart:934— AstNodeImplGenerator._generateNodeGettersSetters has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 2 (7 pts), 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.
BytecodeGenerator.getFieldDeclaration (cognitive 27) pkg/dart2bytecode/lib/bytecode_generator.dart:513— BytecodeGenerator.getFieldDeclaration has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AstCodeGenerator._setupLocalParameters (cognitive 27) pkg/dart2wasm/lib/code_generator.dart:248— AstCodeGenerator._setupLocalParameters has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 4 (5 pts), boolean chains 3, ternaries 1 (3 pts) (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.
DevToolsServer._serveDevToolsWithArgs (cognitive 27) pkg/dart_runtime_service_dds/lib/devtools_server.dart:516— DevToolsServer._serveDevToolsWithArgs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 5, ternaries 4, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AstIndexerAndIgnoreCollector._checkCommentAndIgnoreCoverageWithBeginAndEnd (cognitive 27) pkg/front_end/tool/coverage_merger.dart:967— AstIndexerAndIgnoreCollector._checkCommentAndIgnoreCoverageWithBeginAndEnd has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, loops 4 (8 pts) (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.
_KeyboardEventHandler._firesKeyPressEvent (cognitive 27) tools/dom/src/KeyboardEventStream.dart:207— _KeyboardEventHandler._firesKeyPressEvent has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 21, if/else 5, 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.
_SyncStarIterator.moveNext (cognitive 27) sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart:927— _SyncStarIterator.moveNext has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 1 (3 pts), boolean chains 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.
BoxedDouble.computeRemainder (cognitive 27) sdk/lib/_internal/wasm/common/boxed_double.dart:83— BoxedDouble.computeRemainder has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 4 (6 pts), 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.
LinearScanRegisterAllocator.allocateFreeRegister (cognitive 27) pkg/native_compiler/lib/back_end/register_allocator.dart:628— LinearScanRegisterAllocator.allocateFreeRegister has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (26 pts), 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.
LinearScanRegisterAllocator.evictIntersection (cognitive 27) pkg/native_compiler/lib/back_end/register_allocator.dart:865— LinearScanRegisterAllocator.evictIntersection has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (25 pts), ternaries 1 (2 pts) (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.
Simplification.visitBinaryIntOp (cognitive 27) pkg/cfg/lib/passes/simplification.dart:364— Simplification.visitBinaryIntOp has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 3 (7 pts), 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.
PromotionModel.joinPromotedTypes (cognitive 27) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:5115— PromotionModel.joinPromotedTypes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (26 pts), 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.
Parser.parseListPatternSuffix (cognitive 27) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:11989— Parser.parseListPatternSuffix has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), 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.
DartUnitSignatureComputer.compute (cognitive 27) pkg/analysis_server/lib/src/computer/computer_signature.dart:27— DartUnitSignatureComputer.compute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (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.
ImportElementsComputer._computeUpdate (cognitive 27) pkg/analysis_server/lib/src/computer/import_elements_computer.dart:192— ImportElementsComputer._computeUpdate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (4 pts), 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.
TypeHierarchyComputerHelper.findMemberElement (cognitive 27) pkg/analysis_server/lib/src/search/type_hierarchy.dart:194— TypeHierarchyComputerHelper.findMemberElement has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 4, 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.
TokenData.fromSelection (cognitive 27) pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart:548— TokenData.fromSelection has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8, loops 2 (3 pts) (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.
UriHelper.addSuggestions (cognitive 27) pkg/analysis_server/lib/src/services/completion/dart/uri_helper.dart:29— UriHelper.addSuggestions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ImportRemoveShow.compute (cognitive 27) pkg/analysis_server/lib/src/services/correction/dart/ambiguous_import_fix.dart:257— _ImportRemoveShow.compute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (7 pts), 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.
ConvertDocumentationIntoLine.compute (cognitive 27) pkg/analysis_server/lib/src/services/correction/dart/convert_documentation_into_line.dart:32— ConvertDocumentationIntoLine.compute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2, boolean chains 1, ternaries 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.
ConvertForEachToForLoop.compute (cognitive 27) pkg/analysis_server/lib/src/services/correction/dart/convert_for_each_to_for_loop.dart:28— ConvertForEachToForLoop.compute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (24 pts), 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.
ConvertToSwitchExpression._convertArgumentSwitchExpression (cognitive 27) pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:82— ConvertToSwitchExpression._convertArgumentSwitchExpression has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (7 pts), loops 2, match/switch 1 (2 pts), 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.
CreateGetter.compute (cognitive 27) pkg/analysis_server/lib/src/services/correction/dart/create_getter.dart:130— CreateGetter.compute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (27 pts) (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.
_ReplacementEditBuilder.visitSimpleIdentifier (cognitive 27) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:330— _ReplacementEditBuilder.visitSimpleIdentifier has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 5 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnalysisDriverScheduler._run (cognitive 27) pkg/analyzer/lib/src/dart/analysis/driver.dart:2736— AnalysisDriverScheduler._run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (7 pts), 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.
_ElementMapperV2._visitIdentifier (cognitive 27) pkg/analyzer/lib/src/dart/ast/element_locator.dart:595— _ElementMapperV2._visitIdentifier has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 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.
_ConstructorInvocationEvaluator._checkFields (cognitive 27) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3158— _ConstructorInvocationEvaluator._checkFields has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (21 pts), ternaries 1 (3 pts), boolean chains 2, 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.
DartdocDirectiveInfo.processDartdoc (cognitive 27) pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart:118— DartdocDirectiveInfo.processDartdoc has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (23 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Constructor.updateWithParameters (cognitive 27) pkg/analyzer/lib/src/error/constructor_fields_verifier.dart:298— _Constructor.updateWithParameters has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnalyzerTypeOperations._getInterfaceFieldTypes (cognitive 27) pkg/analyzer/lib/src/generated/exhaustiveness.dart:382— AnalyzerTypeOperations._getInterfaceFieldTypes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (6 pts), 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.
ResolverVisitor.checkForBodyMayCompleteNormally (cognitive 27) pkg/analyzer/lib/src/generated/resolver.dart:573— ResolverVisitor.checkForBodyMayCompleteNormally has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, match/switch 1 (2 pts) (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.
_InfoBuilder.build (cognitive 27) pkg/analyzer/lib/src/summary2/informative_data.dart:566— _InfoBuilder.build has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (22 pts), loops 3 (5 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InstanceMemberInferrer._inferConstructor (cognitive 27) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:378— InstanceMemberInferrer._inferConstructor has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 1 (3 pts), 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.
InstanceMemberInferrer._inferExecutable (cognitive 27) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:410— InstanceMemberInferrer._inferExecutable has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 4, 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.
Linker._buildExportScopes (cognitive 27) pkg/analyzer/lib/src/summary2/link.dart:161— Linker._buildExportScopes has cognitive complexity 27 (threshold 15). Drivers by points: loops 13 (19 pts), if/else 4 (8 pts) (nesting depth added 10). 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.
DartEditBuilderImpl._getBaseNameFromUnwrappedExpression (cognitive 27) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1266— DartEditBuilderImpl._getBaseNameFromUnwrappedExpression has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 1 (2 pts) (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.
DartFileEditBuilderImpl._insertDocImportIntoBlockDocComment (cognitive 27) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:3094— DartFileEditBuilderImpl._insertDocImportIntoBlockDocComment has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 2 (6 pts), loops 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.
_OpTypeAstVisitor.visitRegularFormalParameter (cognitive 27) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:1514— _OpTypeAstVisitor.visitRegularFormalParameter has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 15, if/else 9 (12 pts) (nesting depth added 3). 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.
KernelInfoCollector.visitClass (cognitive 27) pkg/compiler/lib/src/dump_info.dart:935— KernelInfoCollector.visitClass has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2, ternaries 1 (2 pts), 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.
NativeEnqueuer._processNativeBehavior (cognitive 27) pkg/compiler/lib/src/native/enqueue.dart:81— NativeEnqueuer._processNativeBehavior has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 10, 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.
SsaCodeGenerator.visitSwitchInfo (cognitive 27) pkg/compiler/lib/src/ssa/codegen.dart:905— SsaCodeGenerator.visitSwitchInfo has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (7 pts), boolean chains 4 (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.
SsaCodeGenerator.visitInvokeSuper (cognitive 27) pkg/compiler/lib/src/ssa/codegen.dart:2685— SsaCodeGenerator.visitInvokeSuper has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (25 pts), 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.
SsaInstructionMerger.analyzeInputs (cognitive 27) pkg/compiler/lib/src/ssa/codegen_helpers.dart:844— SsaInstructionMerger.analyzeInputs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaInstructionMerger.tryMergingExpressions (cognitive 27) pkg/compiler/lib/src/ssa/codegen_helpers.dart:1100— SsaInstructionMerger.tryMergingExpressions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 2, 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.
SsaInstructionSimplifier.visitInvokeDynamicMethod (cognitive 27) pkg/compiler/lib/src/ssa/optimize.dart:1028— SsaInstructionSimplifier.visitInvokeDynamicMethod has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 4, ternaries 1 (3 pts) (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.
SsaLiveBlockAnalyzer.visitSwitch (cognitive 27) pkg/compiler/lib/src/ssa/optimize.dart:3548— SsaLiveBlockAnalyzer.visitSwitch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartCliDebugAdapter.launchAndRespond (cognitive 27) pkg/dap_adapters/lib/src/adapters/dart_cli_adapter.dart:73— DartCliDebugAdapter.launchAndRespond has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, ternaries 4 (5 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProtocolConverter.convertVmToDapStackFrame (cognitive 27) pkg/dap_adapters/lib/src/protocol_converter.dart:612— ProtocolConverter.convertVmToDapStackFrame has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, ternaries 10, if/else 5 (6 pts) (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.
MigrateCommand.run (cognitive 27) pkg/dartdev/lib/src/commands/migrate.dart:56— MigrateCommand.run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, error handling 1, ternaries 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.
Printer.propertyNameOut (cognitive 27) pkg/dev_compiler/lib/src/js_ast/printer.dart:1476— Printer.propertyNameOut has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractOrExternalFieldEncoding._updateMemberTypes (cognitive 27) pkg/front_end/lib/src/fragment/field/encoding.dart:1141— AbstractOrExternalFieldEncoding._updateMemberTypes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BodyBuilderImpl.buildRedirectingInitializer (cognitive 27) pkg/front_end/lib/src/kernel/body_builder.dart:1862— BodyBuilderImpl.buildRedirectingInitializer has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 1 (4 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantsTransformer.visitBlock (cognitive 27) pkg/front_end/lib/src/kernel/constant_evaluator.dart:660— ConstantsTransformer.visitBlock has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (5 pts) (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.
StatementConstantEvaluator.visitTryCatch (cognitive 27) pkg/front_end/lib/src/kernel/constant_evaluator.dart:6339— StatementConstantEvaluator.visitTryCatch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LoweredTypedefTearOff.fromExpression (cognitive 27) pkg/front_end/lib/src/kernel/constructor_tearoff_lowering.dart:501— LoweredTypedefTearOff.fromExpression has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClassHierarchyBuilder._getLegacyLeastUpperBoundInternal (cognitive 27) pkg/front_end/lib/src/kernel/hierarchy/hierarchy_builder.dart:150— ClassHierarchyBuilder._getLegacyLeastUpperBoundInternal has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 6, loops 3 (5 pts) (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.
OutlineBuilder.endClassDeclaration (cognitive 27) pkg/front_end/lib/src/source/outline_builder.dart:1407— OutlineBuilder.endClassDeclaration has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (6 pts) (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.
SourceClassBuilder.checkMethodOverride (cognitive 27) pkg/front_end/lib/src/source/source_class_builder.dart:1890— SourceClassBuilder.checkMethodOverride has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 3 (4 pts) (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.
SuccessfulInferenceResult.applyResult (cognitive 27) pkg/front_end/lib/src/type_inference/inference_results.dart:245— SuccessfulInferenceResult.applyResult has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (25 pts), 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.
_Visitor.visitMethodDeclaration (cognitive 27) pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart:54— _Visitor.visitMethodDeclaration has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (25 pts), 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.
_Visitor.visitLexeme (cognitive 27) pkg/linter/lib/src/rules/unnecessary_string_escapes.dart:55— _Visitor.visitLexeme has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (3 pts) (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.
AsyncStateVisitor.visitSwitchStatement (cognitive 27) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:583— AsyncStateVisitor.visitSwitchStatement has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FileInfo.fromReaderDwarf5 (cognitive 27) pkg/native_stack_traces/lib/src/dwarf.dart:1153— FileInfo.fromReaderDwarf5 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 3 (6 pts), loops 3 (4 pts), match/switch 1 (2 pts), 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.
BreakCommand.run (cognitive 27) pkg/observatory/lib/src/elements/debugger.dart:779— BreakCommand.run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 2 (6 pts), boolean chains 1, ternaries 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.
_SelectorApproximation.observeArgs (cognitive 27) pkg/vm/lib/transformations/type_flow/analysis.dart:1076— _SelectorApproximation.observeArgs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (6 pts), boolean chains 4, ternaries 1 (3 pts) (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.
_InvocationsCache.getInvocation (cognitive 27) pkg/vm/lib/transformations/type_flow/analysis.dart:1153— _InvocationsCache.getInvocation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (26 pts), ternaries 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_TFClassImpl._initDispatchTargets (cognitive 27) pkg/vm/lib/transformations/type_flow/analysis.dart:1543— _TFClassImpl._initDispatchTargets has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 3 (4 pts), ternaries 1 (2 pts) (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.
RuntimeType.isSubtypeOfRuntimeType (cognitive 27) pkg/vm/lib/transformations/type_flow/types.dart:1640— RuntimeType.isSubtypeOfRuntimeType has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 7, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
build.Build (cognitive 27) tools/build.py:270— build.Build has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 6 (12 pts) (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.
generate_blink_file._Emit_Blink_Operation (cognitive 27) tools/dom/scripts/generate_blink_file.py:580— generate_blink_file._Emit_Blink_Operation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2 (4 pts), boolean chains 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.
BytecodeGenerator._checkArguments (cognitive 26) pkg/dart2bytecode/lib/bytecode_generator.dart:2444— BytecodeGenerator._checkArguments has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 5 (8 pts), boolean chains 4 (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.
AstCodeGenerator.visitEqualsCall (cognitive 26) pkg/dart2wasm/lib/code_generator.dart:1954— AstCodeGenerator.visitEqualsCall has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 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.
ClosedWorldClassHierarchy.sanityChecks (cognitive 26) pkg/kernel/lib/class_hierarchy.dart:1425— ClosedWorldClassHierarchy.sanityChecks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 7 (10 pts) (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.
Configuration.optionsEqual (cognitive 26) pkg/smith/lib/configuration.dart:556— Configuration.optionsEqual has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 26. 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.
KeyCode.isCharacterKey (cognitive 26) tools/dom/src/KeyCode.dart:202— KeyCode.isCharacterKey has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 24, if/else 2. 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.
Arm64Assembler.fmov (cognitive 26) pkg/native_compiler/lib/back_end/arm64/assembler.dart:2413— Arm64Assembler.fmov has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (18 pts), match/switch 3 (5 pts), if/else 3 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
Arm64CodeGenerator.visitTypeTest (cognitive 26) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:1764— Arm64CodeGenerator.visitTypeTest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, ternaries 2 (4 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
Uri._validateIPvFutureAddress (cognitive 26) sdk/lib/core/uri.dart:1546— Uri._validateIPvFutureAddress has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2, 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.
_Uri.replace (cognitive 26) sdk/lib/core/uri.dart:2282— _Uri.replace has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConstantPropagation.visitPhi (cognitive 26) pkg/cfg/lib/passes/constant_propagation.dart:224— ConstantPropagation.visitPhi has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (25 pts), 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.
Utf8BytesScanner.scanUntilLineEnd (cognitive 26) pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart:249— Utf8BytesScanner.scanUntilLineEnd has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, 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.
Utf8BytesScanner.skipSpaces (cognitive 26) pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart:319— Utf8BytesScanner.skipSpaces has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 18, if/else 4 (6 pts), loops 2 (nesting depth added 2). 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.
ExportChecker.visitClass (cognitive 26) pkg/_js_interop_checks/lib/src/transformations/export_checker.dart:95— ExportChecker.visitClass has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 10, loops 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.
PluginManager._createPackageConfigFile (cognitive 26) pkg/analysis_server/lib/src/plugin/plugin_manager.dart:770— PluginManager._createPackageConfigFile has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 3 (10 pts), error handling 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InScopeCompletionPass._forPattern (cognitive 26) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:4096— InScopeCompletionPass._forPattern has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AddAwait.compute (cognitive 26) pkg/analysis_server/lib/src/services/correction/dart/add_await.dart:46— AddAwait.compute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 1 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
AddKeyToConstructors._canBeConst (cognitive 26) pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart:54— AddKeyToConstructors._canBeConst has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 3 (5 pts), 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.
RemoveLate._lateKeywordLocation (cognitive 26) pkg/analysis_server/lib/src/services/correction/dart/remove_late.dart:26— RemoveLate._lateKeywordLocation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (2 pts) (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.
ImportOrganizer._organizeDocImportsInBlockComment (cognitive 26) pkg/analysis_server/lib/src/services/correction/organize_imports.dart:344— ImportOrganizer._organizeDocImportsInBlockComment has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, ternaries 2 (6 pts), loops 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.
_ContextLocator._locateRoots (cognitive 26) pkg/analyzer/lib/src/dart/analysis/context_locator.dart:704— _ContextLocator._locateRoots has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (6 pts) (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.
AstRewriter._prepareReceiverInvocation (cognitive 26) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:955— AstRewriter._prepareReceiverInvocation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (8 pts), boolean chains 3, match/switch 1 (2 pts) (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.
InvocationInferrer._visitArguments (cognitive 26) pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart:689— InvocationInferrer._visitArguments has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 1, 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.
VariableDeclarationResolver.resolve (cognitive 26) pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart:28— VariableDeclarationResolver.resolve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 8, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
YieldStatementResolver._checkForYieldOfInvalidType (cognitive 26) pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart:61— YieldStatementResolver._checkForYieldOfInvalidType has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 1 (3 pts) (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.
DartdocDirectiveInfo._stripDelimiters (cognitive 26) pkg/analyzer/lib/src/dartdoc/dartdoc_directive_info.dart:201— DartdocDirectiveInfo._stripDelimiters has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (24 pts), 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.
AstBuilder.doDotExpression (cognitive 26) pkg/analyzer/lib/src/fasta/ast_builder.dart:859— AstBuilder.doDotExpression has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, ternaries 2 (4 pts) (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.
ErrorVerifier.visitFieldDeclaration (cognitive 26) pkg/analyzer/lib/src/generated/error_verifier.dart:1208— ErrorVerifier.visitFieldDeclaration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (4 pts), boolean chains 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.
ErrorVerifier._checkForNonFinalFieldInEnum (cognitive 26) pkg/analyzer/lib/src/generated/error_verifier.dart:7150— ErrorVerifier._checkForNonFinalFieldInEnum has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErrorVerifier._checkForNotInitializedFieldDeclaration (cognitive 26) pkg/analyzer/lib/src/generated/error_verifier.dart:7248— ErrorVerifier._checkForNotInitializedFieldDeclaration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3, loops 2 (3 pts) (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.
FfiVerifier.visitCascadeMethodInvocation (cognitive 26) pkg/analyzer/lib/src/generated/ffi_verifier.dart:170— FfiVerifier.visitCascadeMethodInvocation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 2, loops 1 (2 pts), 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.
ConstructorInitializerResolver._constructorElement (cognitive 26) pkg/analyzer/lib/src/summary2/constructor_initializer_resolver.dart:34— ConstructorInitializerResolver._constructorElement has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (8 pts), match/switch 1 (2 pts) (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.
DefaultTypesBuilder._breakSelfCycles (cognitive 26) pkg/analyzer/lib/src/summary2/default_types_builder.dart:69— DefaultTypesBuilder._breakSelfCycles has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 3 (8 pts), 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.
ElementBuilder._buildInstanceElementMembers (cognitive 26) pkg/analyzer/lib/src/summary2/element_builder.dart:95— ElementBuilder._buildInstanceElementMembers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (8 pts), match/switch 2 (6 pts), ternaries 1 (3 pts) (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.
FragmentBuilder.visitPrimaryConstructorDeclaration (cognitive 26) pkg/analyzer/lib/src/summary2/element_builder.dart:2027— FragmentBuilder.visitPrimaryConstructorDeclaration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7, 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.
VarianceBuilder.perform (cognitive 26) pkg/analyzer/lib/src/summary2/variance_builder.dart:23— VarianceBuilder.perform has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 6 (12 pts) (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.
FuzzyMatcher.fuzzyMap (cognitive 26) pkg/analyzer/lib/src/utilities/fuzzy_matcher.dart:298— FuzzyMatcher.fuzzyMap has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, ternaries 2 (5 pts), 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.
Compiler.produceKernel (cognitive 26) pkg/compiler/lib/src/compiler.dart:425— Compiler.produceKernel has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ElementInfoCollector.visitClass (cognitive 26) pkg/compiler/lib/src/dump_info.dart:561— ElementInfoCollector.visitClass has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3 (8 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DumpInfoAnnotator.visitClass (cognitive 26) pkg/compiler/lib/src/dump_info.dart:1348— DumpInfoAnnotator.visitClass has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (8 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_GraphGenerator.addNode (cognitive 26) pkg/compiler/lib/src/inferrer/type_graph_dump.dart:280— _GraphGenerator.addNode has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 5 (10 pts), ternaries 1 (3 pts), 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.
UnionTypeMask.unionOfHelper (cognitive 26) pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart:94— UnionTypeMask.unionOfHelper has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), ternaries 1 (3 pts) (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.
OnlineJavaScriptTracer._handleNotifySteps (cognitive 26) pkg/compiler/lib/src/io/position_information.dart:1644— OnlineJavaScriptTracer._handleNotifySteps has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 1 (2 pts), 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.
CodegenEnqueuerListener._processClass (cognitive 26) pkg/compiler/lib/src/js_backend/codegen_listener.dart:333— CodegenEnqueuerListener._processClass has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16, boolean chains 10. 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.
NativeDataBuilder.close (cognitive 26) pkg/compiler/lib/src/js_backend/native_data.dart:485— NativeDataBuilder.close has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (5 pts), ternaries 2 (4 pts), 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.
NativeBehavior.processEffects (cognitive 26) pkg/compiler/lib/src/native/behavior.dart:503— NativeBehavior.processEffects has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CompilerOptions.deriveOptions (cognitive 26) pkg/compiler/lib/src/options.dart:1077— CompilerOptions.deriveOptions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KernelSsaGraphBuilder._handleInvokeStaticForeign (cognitive 26) pkg/compiler/lib/src/ssa/builder.dart:5464— KernelSsaGraphBuilder._handleInvokeStaticForeign has cognitive complexity 26 (threshold 15). Drivers by points: if/else 26. 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.
SsaCodeGenerator.generateExpressionAssignment (cognitive 26) pkg/compiler/lib/src/ssa/codegen.dart:698— SsaCodeGenerator.generateExpressionAssignment has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (10 pts), ternaries 1 (5 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaGlobalValueNumberer.moveLoopInvariantCodeFromBlock (cognitive 26) pkg/compiler/lib/src/ssa/optimize.dart:3755— SsaGlobalValueNumberer.moveLoopInvariantCodeFromBlock has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 10, loops 2 (4 pts) (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.
MarkdownTable.finish (cognitive 26) pkg/dartdev/lib/src/utils.dart:424— MarkdownTable.finish has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 3 (9 pts), loops 4 (7 pts) (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.
LibraryCompiler._emitClassDeclaration (cognitive 26) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1463— LibraryCompiler._emitClassDeclaration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (5 pts), boolean chains 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.
LibraryCompiler._emitLibraryMembers (cognitive 26) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4054— LibraryCompiler._emitLibraryMembers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, loops 3 (5 pts) (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.
TypeRecipeGenerator.liveInterfaceTypeRules (cognitive 26) pkg/dev_compiler/lib/src/kernel/type_recipe_generator.dart:85— TypeRecipeGenerator.liveInterfaceTypeRules has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 6 (12 pts) (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.
_TypeRecipeVisitor.addLiveTypeAncestries (cognitive 26) pkg/dev_compiler/lib/src/kernel/type_recipe_generator.dart:614— _TypeRecipeVisitor.addLiveTypeAncestries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (9 pts), ternaries 1 (3 pts), 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.
FrameComputer._collectAsyncFrames (cognitive 26) pkg/dwds/lib/src/debugging/frame_computer.dart:80— FrameComputer._collectAsyncFrames has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 1 (4 pts), boolean chains 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.
IncrementalCompiler._loadEnsureLoadedComponents (cognitive 26) pkg/front_end/lib/src/base/incremental_compiler.dart:1702— IncrementalCompiler._loadEnsureLoadedComponents has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (8 pts) (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.
FactoryEncoding._computeRedirecteeType (cognitive 26) pkg/front_end/lib/src/fragment/factory/encoding.dart:684— FactoryEncoding._computeRedirecteeType has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 1 (2 pts), ternaries 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.
BodyBuilderImpl.pushQualifiedReference (cognitive 26) pkg/front_end/lib/src/kernel/body_builder.dart:9772— BodyBuilderImpl.pushQualifiedReference has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 3, match/switch 1 (2 pts) (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.
InternalFunctionNode.toTextInternal (cognitive 26) pkg/front_end/lib/src/kernel/internal_ast.dart:6664— InternalFunctionNode.toTextInternal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 3 (5 pts) (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.
OutlineBuilder.endNamedMixinApplication (cognitive 26) pkg/front_end/lib/src/source/outline_builder.dart:2772— OutlineBuilder.endNamedMixinApplication has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (5 pts), 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.
SourceLoader.tokenize (cognitive 26) pkg/front_end/lib/src/source/source_loader.dart:1119— SourceLoader.tokenize has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (23 pts), error handling 1 (2 pts), 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.
InferenceVisitorImpl.visitInstantiation (cognitive 26) pkg/front_end/lib/src/type_inference/inference_visitor.dart:671— InferenceVisitorImpl.visitInstantiation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 2, match/switch 1 (2 pts) (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.
FrontendServerClient.start (cognitive 26) pkg/frontend_server_client/lib/src/frontend_server_client.dart:33— FrontendServerClient.start has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 3 (4 pts), ternaries 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MiniJsParser.parseCall (cognitive 26) pkg/js_ast/lib/src/builder.dart:956— MiniJsParser.parseCall has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (5 pts), ternaries 1 (3 pts), 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.
_Visitor.visitSwitchCase (cognitive 26) pkg/linter/lib/src/rules/invalid_case_patterns.dart:49— _Visitor.visitSwitchCase has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (24 pts), 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.
Instance._update (cognitive 26) pkg/observatory/lib/src/service/object.dart:3023— Instance._update has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17, loops 2 (4 pts), match/switch 1 (2 pts), ternaries 2, 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.
_TreeShakerPass2.visitExtension (cognitive 26) pkg/vm/lib/transformations/type_flow/transformer.dart:2411— _TreeShakerPass2.visitExtension has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 2 (10 pts), if/else 3 (8 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_TreeShakerPass2.visitExtensionTypeDeclaration) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_TreeShakerPass2.visitExtensionTypeDeclaration (cognitive 26) pkg/vm/lib/transformations/type_flow/transformer.dart:2455— _TreeShakerPass2.visitExtensionTypeDeclaration has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 2 (10 pts), if/else 3 (8 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_TreeShakerPass2.visitExtension) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_SuggestionBuilder.buildSuggestions (cognitive 26) pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart:313— _SuggestionBuilder.buildSuggestions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (6 pts), ternaries 1 (4 pts) (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.
HtmlDartGenerator._AddConstructor (cognitive 26) tools/dom/scripts/htmldartgenerator.py:554— HtmlDartGenerator._AddConstructor has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 3 (5 pts), loops 1 (3 pts), 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.
sandbox.onRcpMessage (cognitive 26) REDACTED:58— sandbox.onRcpMessage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 1, error handling 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.
ExpectedCompletionsVisitor.visitSimpleIdentifier (cognitive 25) pkg/analysis_server/tool/code_completion/visitors.dart:679— ExpectedCompletionsVisitor.visitSimpleIdentifier has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 3 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RemoveLastFormalParameterMutation._deletionForLast (cognitive 25) pkg/analyzer/tool/fine/ab_mutate/mutations/impl/remove_last_formal_parameter.dart:49— RemoveLastFormalParameterMutation._deletionForLast has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 8 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_CodeGenerator.checkIdl (cognitive 25) pkg/analyzer/tool/summary/generate.dart:534— _CodeGenerator.checkIdl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 3 (4 pts) (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.
ClassInfoCollector.collect (cognitive 25) pkg/dart2wasm/lib/class_info.dart:626— ClassInfoCollector.collect has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 6 (11 pts), 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.
WasmCompilerOptions._validatePhases (cognitive 25) pkg/dart2wasm/lib/compiler_options.dart:184— WasmCompilerOptions._validatePhases has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, 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.
StateMachineCodeGenerator.visitSwitchStatement (cognitive 25) pkg/dart2wasm/lib/state_machine.dart:970— StateMachineCodeGenerator.visitSwitchStatement has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 6 (8 pts), loops 5 (6 pts), boolean chains 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.
TraverseFilter.asString (cognitive 25) pkg/heap_snapshot/lib/analysis.dart:797— TraverseFilter.asString has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (9 pts), 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.
TypeChecker.checkComponent (cognitive 25) pkg/kernel/lib/type_checker.dart:30— TypeChecker.checkComponent has cognitive complexity 25 (threshold 15). Drivers by points: loops 9 (19 pts), if/else 2 (4 pts), boolean chains 2 (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.
_HttpClient._findProxyFromEnvironment (cognitive 25) sdk/lib/_http/http_impl.dart:3251— _HttpClient._findProxyFromEnvironment has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 4, 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.
_StringBase.createFromCharCodes (cognitive 25) sdk/lib/_internal/vm/lib/string_patch.dart:115— _StringBase.createFromCharCodes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 pts), 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.
_TypeUniverse.substituteTypeArgument (cognitive 25) sdk/lib/_internal/wasm/common/type.dart:802— _TypeUniverse.substituteTypeArgument has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
HtmlEscape._convert (cognitive 25) sdk/lib/convert/html_escape.dart:241— HtmlEscape._convert has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 1 (2 pts), 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.
AstToIr._enterScope (cognitive 25) pkg/cfg/lib/front_end/ast_to_ir.dart:934— AstToIr._enterScope has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (6 pts), 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.
SSAComputation.rename (cognitive 25) pkg/cfg/lib/ir/ssa_computation.dart:108— SSAComputation.rename has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 4 (10 pts), match/switch 1 (3 pts) (nesting depth added 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.
Parser.parseFunctionBody (cognitive 25) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6531— Parser.parseFunctionBody has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 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.
Parser.parseNewExpression (cognitive 25) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:8896— Parser.parseNewExpression has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8 (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.parseParenthesizedPatternOrRecordPattern (cognitive 25) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:12159— Parser.parseParenthesizedPatternOrRecordPattern has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, 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.
TypeAnalyzer.analyzeSwitchExpression (cognitive 25) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:2343— TypeAnalyzer.analyzeSwitchExpression has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 1 (2 pts), 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.
DartUnitHoverComputer._typeDisplayString (cognitive 25) pkg/analysis_server/lib/src/computer/computer_hover.dart:352— DartUnitHoverComputer._typeDisplayString has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 11 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TypeDefinitionHandler.handle (cognitive 25) pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart:42— TypeDefinitionHandler.handle has cognitive complexity 25 (threshold 15). Drivers by points: if/else 22 (24 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DeclarationHelper._bestMember (cognitive 25) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1761— DeclarationHelper._bestMember has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (4 pts), 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.
DeclarationHelper._visitPattern (cognitive 25) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:3071— DeclarationHelper._visitPattern has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
SuggestionBuilder._addBuilder (cognitive 25) pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:1289— SuggestionBuilder._addBuilder has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 3 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AddNullCheck._computeTargetAndNullAwareToken (cognitive 25) pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart:225— AddNullCheck._computeTargetAndNullAwareToken has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConvertIntoFinalField.compute (cognitive 25) pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart:26— ConvertIntoFinalField.compute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, match/switch 2 (3 pts), 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.
CreateClass.producers (cognitive 25) pkg/analysis_server/lib/src/services/correction/dart/create_class.dart:20— CreateClass.producers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), 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.
ExpressionImpl.constantContext (cognitive 25) pkg/analyzer/lib/src/dart/ast/ast.dart:18135— ExpressionImpl.constantContext has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 2, match/switch 1 (2 pts), 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. This shape REPEATS in the file: one other method here (ExpressionImpl.constantContext2) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ExpressionImpl.constantContext2 (cognitive 25) pkg/analyzer/lib/src/dart/ast/ast.dart:18203— ExpressionImpl.constantContext2 has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 2, match/switch 1 (2 pts), 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. This shape REPEATS in the file: one other method here (ExpressionImpl.constantContext) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AstRewriter._parsedConstructorType (cognitive 25) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:786— AstRewriter._parsedConstructorType has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 7, 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.
ExitDetector.visitForStatement (cognitive 25) pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:256— ExitDetector.visitForStatement has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 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.
PrefixedIdentifierResolver.resolve (cognitive 25) pkg/analyzer/lib/src/dart/resolver/prefixed_identifier_resolver.dart:24— PrefixedIdentifierResolver.resolve has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SimpleIdentifierResolver._resolve2 (cognitive 25) pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart:195— SimpleIdentifierResolver._resolve2 has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AnnotationVerifier._checkInternal (cognitive 25) pkg/analyzer/lib/src/error/annotation_verifier.dart:326— AnnotationVerifier._checkInternal has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (4 pts), 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.
ElementUsageDetector._isLocalParameter (cognitive 25) pkg/analyzer/lib/src/error/element_usage_detector.dart:467— ElementUsageDetector._isLocalParameter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 1 (2 pts) (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. This shape REPEATS in the file: one other method here (ElementUsageDetectorV2._isLocalParameter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ElementUsageDetectorV2.checkUsage (cognitive 25) pkg/analyzer/lib/src/error/element_usage_detector.dart:556— ElementUsageDetectorV2.checkUsage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 3 (4 pts), 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.
ElementUsageDetectorV2._isLocalParameter (cognitive 25) pkg/analyzer/lib/src/error/element_usage_detector.dart:1066— ElementUsageDetectorV2._isLocalParameter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 1 (2 pts) (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. This shape REPEATS in the file: one other method here (ElementUsageDetector._isLocalParameter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ImportsVerifier.generateUnnecessaryImportHints (cognitive 25) pkg/analyzer/lib/src/error/imports_verifier.dart:152— ImportsVerifier.generateUnnecessaryImportHints has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 pts), 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.
_ClassVerifier._checkDirectSuperTypes (cognitive 25) pkg/analyzer/lib/src/error/inheritance_override.dart:646— _ClassVerifier._checkDirectSuperTypes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 pts), 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.
RequiredParametersVerifier._check (cognitive 25) pkg/analyzer/lib/src/error/required_parameters_verifier.dart:161— RequiredParametersVerifier._check has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AstBuilder.buildInitializer (cognitive 25) pkg/analyzer/lib/src/fasta/ast_builder.dart:639— AstBuilder.buildInitializer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (23 pts), match/switch 1 (2 pts) (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.
AstBuilder.endFormalParameter (cognitive 25) pkg/analyzer/lib/src/fasta/ast_builder.dart:1877— AstBuilder.endFormalParameter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 9, match/switch 1, ternaries 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.
DartFileEditBuilderImpl._getImportElement (cognitive 25) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:2887— DartFileEditBuilderImpl._getImportElement has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 3 (9 pts), 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.
InliningTraceListener.finish (cognitive 25) pkg/compiler/lib/src/io/position_information.dart:503— InliningTraceListener.finish has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (8 pts), 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.
_RecipeGenerator.visitFunctionType (cognitive 25) pkg/compiler/lib/src/js_backend/runtime_types_new.dart:340— _RecipeGenerator.visitFunctionType has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 5 (8 pts), ternaries 1 (2 pts) (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.
InlineWeeder.handleGenerativeConstructorFactory (cognitive 25) pkg/compiler/lib/src/ssa/builder.dart:9723— InlineWeeder.handleGenerativeConstructorFactory has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (6 pts) (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.
SsaInstructionSimplifier.simplifyExpressionPhi (cognitive 25) pkg/compiler/lib/src/ssa/optimize.dart:525— SsaInstructionSimplifier.simplifyExpressionPhi has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9, ternaries 4, loops 1 (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.
SsaInstructionSimplifier.visitFieldGet (cognitive 25) pkg/compiler/lib/src/ssa/optimize.dart:1769— SsaInstructionSimplifier.visitFieldGet has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaInstructionSimplifier.visitInvokeDynamicSetter (cognitive 25) pkg/compiler/lib/src/ssa/optimize.dart:2136— SsaInstructionSimplifier.visitInvokeDynamicSetter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), 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.
ClassHierarchyNode.printOn (cognitive 25) pkg/compiler/lib/src/universe/class_set.dart:377— ClassHierarchyNode.printOn has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 2, loops 1 (2 pts) (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.
EvalPackageResolver.resolvePackageConfig (cognitive 25) pkg/dartdev/lib/src/eval_packages.dart:72— EvalPackageResolver.resolvePackageConfig has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, loops 2 (4 pts), error handling 1 (2 pts) (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.
ProgramCompiler._emitClassDeclaration (cognitive 25) pkg/dev_compiler/lib/src/kernel/compiler.dart:1170— ProgramCompiler._emitClassDeclaration has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (5 pts), boolean chains 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.
ClassPropertyModel._findExtensionMembers (cognitive 25) pkg/dev_compiler/lib/src/kernel/property_model.dart:342— ClassPropertyModel._findExtensionMembers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 1 (4 pts), boolean chains 3, 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.
NamedTypeBuilderImpl.buildSupertype (cognitive 25) pkg/front_end/lib/src/builder/named_type_builder.dart:654— NamedTypeBuilderImpl.buildSupertype has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (6 pts), boolean chains 3, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
NamedTypeBuilderImpl.computeTypeParameterBuilderVariance (cognitive 25) pkg/front_end/lib/src/builder/named_type_builder.dart:860— NamedTypeBuilderImpl.computeTypeParameterBuilderVariance has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (9 pts), boolean chains 1, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
FragmentFactoryImpl.computeAndValidateConstructorName (cognitive 25) pkg/front_end/lib/src/source/fragment_factory_impl.dart:1751— FragmentFactoryImpl.computeAndValidateConstructorName has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 2, ternaries 1 (2 pts) (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.
SourceLibraryBuilder.checkTypesInOutline (cognitive 25) pkg/front_end/lib/src/source/source_library_builder.dart:1389— SourceLibraryBuilder.checkTypesInOutline has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 5, 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.
_ConstListOrSetLiteralBuilder.translate (cognitive 25) pkg/front_end/lib/src/type_inference/collection_encoding.dart:168— _ConstListOrSetLiteralBuilder.translate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 2 (4 pts), loops 2, match/switch 1 (2 pts) (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.
InferenceVisitorImpl.visitDotShorthandPropertyGet (cognitive 25) pkg/front_end/lib/src/type_inference/inference_visitor.dart:14092— InferenceVisitorImpl.visitDotShorthandPropertyGet has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, loops 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.
InferenceVisitorBase._inferInstanceMethodInvocation (cognitive 25) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3036— InferenceVisitorBase._inferInstanceMethodInvocation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_Processor._preprocessImportsAsNeeded (cognitive 25) pkg/front_end/lib/src/util/outline_extractor.dart:272— _Processor._preprocessImportsAsNeeded has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (6 pts) (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.
AstPrinter.writeFunctionNode (cognitive 25) pkg/kernel/lib/src/printer.dart:608— AstPrinter.writeFunctionNode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (5 pts) (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.
_Visitor.visitCompilationUnit (cognitive 25) pkg/linter/lib/src/rules/dangling_library_doc_comments.dart:38— _Visitor.visitCompilationUnit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (5 pts) (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.
Isolate._update (cognitive 25) pkg/observatory/lib/src/service/object.dart:1708— Isolate._update has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 5 (11 pts), boolean chains 2, ternaries 1 (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.
TableSelectorAssigner._memberIdsForClass (cognitive 25) pkg/vm/lib/transformations/type_flow/table_selector_assigner.dart:45— TableSelectorAssigner._memberIdsForClass has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (4 pts), boolean chains 2, loops 2, ternaries 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.
_TreeShakerPass2.defaultMember (cognitive 25) pkg/vm/lib/transformations/type_flow/transformer.dart:2321— _TreeShakerPass2.defaultMember has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 1 (3 pts), 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.
_SuggestionBuilder._addSuggestion (cognitive 25) pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart:357— _SuggestionBuilder._addSuggestion has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (25 pts) (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.
IDLType.__init__ (cognitive 25) tools/dom/scripts/idlnode.py:661— IDLType.__init__ has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), 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.
D3SymbolTreeMap.D3SymbolTreeMap._handleInodes (cognitive 25) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:382— D3SymbolTreeMap.D3SymbolTreeMap._handleInodes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 4, boolean chains 3 (nesting depth added 3). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 464, 533, 429, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
_BuilderGenerator._generateSignatureCall (cognitive 24) pkg/analyzer/tool/summary/generate.dart:450— _BuilderGenerator._generateSignatureCall has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 1 (2 pts) (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.
UnreachableIfFinder.helperForIfLikeStructure (cognitive 24) pkg/front_end/tool/unreachable_if_finder.dart:69— UnreachableIfFinder.helperForIfLikeStructure has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 2 (4 pts), 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.
NaiveTypeChecker._checkFunctionOverride (cognitive 24) pkg/kernel/lib/naive_type_checker.dart:163— NaiveTypeChecker._checkFunctionOverride has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 4 (6 pts), 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.
CompilationSet.compileAllFunctions (cognitive 24) pkg/native_compiler/lib/compilation_set.dart:56— CompilationSet.compileAllFunctions has cognitive complexity 24 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 2 (8 pts) (nesting depth added 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.
_Utils._getCompletionsHelper (cognitive 24) tools/dom/src/native_DOMImplementation.dart:618— _Utils._getCompletionsHelper has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 1 (2 pts), 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.
_Double.compareTo (cognitive 24) sdk/lib/_internal/vm/lib/double.dart:341— _Double.compareTo has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 2 (5 pts), 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.
_FunctionType.toString (cognitive 24) sdk/lib/_internal/wasm/common/type.dart:513— _FunctionType.toString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), 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.
Arm64CodeGenerator.visitCompareAndBranch (cognitive 24) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:374— Arm64CodeGenerator.visitCompareAndBranch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, match/switch 2, ternaries 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.
LinearScanRegisterAllocator.allocate (cognitive 24) pkg/native_compiler/lib/back_end/register_allocator.dart:509— LinearScanRegisterAllocator.allocate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (7 pts), boolean chains 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.
DependenciesCollector._enqueueInstanceMembers (cognitive 24) pkg/dart2wasm/lib/deferred_load/dependencies.dart:158— DependenciesCollector._enqueueInstanceMembers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnnotationsListener.endLiteralString (cognitive 24) pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart:891— AnnotationsListener.endLiteralString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (4 pts) (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.parseMixinHeaderRecovery (cognitive 24) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:3476— Parser.parseMixinHeaderRecovery has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), 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.
Parser._attemptPrecedenceLevelRecovery (cognitive 24) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7614— Parser._attemptPrecedenceLevelRecovery has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (10 pts), loops 1 (nesting depth added 5). 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.
Parser.parseSend (cognitive 24) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9337— Parser.parseSend has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8 (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.
Parser.parseMapPatternSuffix (cognitive 24) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:12070— Parser.parseMapPatternSuffix has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (23 pts), 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.
ExtensionIndex._indexExtensions (cognitive 24) pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart:1148— ExtensionIndex._indexExtensions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (3 pts), 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.
DartUnitHighlightsComputer._addCommentRanges (cognitive 24) pkg/analysis_server/lib/src/computer/computer_highlights.dart:69— DartUnitHighlightsComputer._addCommentRanges has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 pts) (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.
ContextManagerImpl._handleWatchEvent (cognitive 24) pkg/analysis_server/lib/src/context_manager.dart:952— ContextManagerImpl._handleWatchEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, match/switch 2 (4 pts), loops 1 (2 pts) (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.
FlutterOutlineComputer._addAttribute (cognitive 24) pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart:48— FlutterOutlineComputer._addAttribute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 2 (8 pts), 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.
ResultMerger.mergeOutline (cognitive 24) pkg/analysis_server/lib/src/plugin/result_merger.dart:392— ResultMerger.mergeOutline has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (6 pts), 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.
Driver.startAnalysisServer (cognitive 24) pkg/analysis_server/lib/src/server/driver.dart:428— Driver.startAnalysisServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 2 (3 pts), error handling 1 (2 pts) (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.
DeclarationHelper.addFieldsForInitializers (cognitive 24) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:265— DeclarationHelper.addFieldsForInitializers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 5, 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.
InScopeCompletionPass.visitPropertyAccess (cognitive 24) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2703— InScopeCompletionPass.visitPropertyAccess has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 8 (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.
KeywordHelper.addFieldDeclarationKeywords (cognitive 24) pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart:444— KeywordHelper.addFieldDeclarationKeywords has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 9 (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.
NotImportedCompletionPass.computeSuggestions (cognitive 24) pkg/analysis_server/lib/src/services/completion/dart/not_imported_completion_pass.dart:97— NotImportedCompletionPass.computeSuggestions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1, error handling 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.
StatementCompletionProcessor._checkExpressions (cognitive 24) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:297— StatementCompletionProcessor._checkExpressions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 2, ternaries 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.
AddCallSuper.compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart:29— AddCallSuper.compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 1 (4 pts), loops 1 (2 pts), 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.
AddDiagnosticPropertyReference._fixAllDiagnosticPropertyReferences (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart:209— AddDiagnosticPropertyReference._fixAllDiagnosticPropertyReferences has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (5 pts), 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.
_AddInvocation.compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart:213— _AddInvocation.compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, loops 2 (3 pts) (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.
BindToField._replaceParameterWithThis (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart:121— BindToField._replaceParameterWithThis has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, ternaries 1 (3 pts), 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.
ConvertMapFromIterableToForLiteral.compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart:33— ConvertMapFromIterableToForLiteral.compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 4, loops 1 (2 pts) (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.
ConvertToSetLiteral.compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart:34— ConvertToSetLiteral.compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (22 pts), 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.
_JoinIfWithElseBlock._compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/join_else_with_if.dart:200— _JoinIfWithElseBlock._compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (23 pts), 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.
MakeRequiredNamedParametersFirst.compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/make_required_named_parameters_first.dart:28— MakeRequiredNamedParametersFirst.compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3, boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RemoveDeadCode._handleDeadAtStartOfNode (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart:126— RemoveDeadCode._handleDeadAtStartOfNode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
RemoveUnexpectedUnderscores.compute (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/remove_unexpected_underscores.dart:26— RemoveUnexpectedUnderscores.compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8, 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.
RemoveUnusedLocalVariable._deleteDeclarationInPatternField (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart:220— RemoveUnusedLocalVariable._deleteDeclarationInPatternField has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 1, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
ReplaceWithInterpolation._extractComponentsInto (cognitive 24) pkg/analysis_server/lib/src/services/correction/dart/replace_with_interpolation.dart:63— ReplaceWithInterpolation._extractComponentsInto has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (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.
_ReferenceFinder.visitExtensionDeclaration (cognitive 24) pkg/analysis_server/lib/src/utilities/import_analyzer.dart:258— _ReferenceFinder.visitExtensionDeclaration has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (8 pts), 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.
AnalysisDriver.workPriority (cognitive 24) pkg/analyzer/lib/src/dart/analysis/driver.dart:468— AnalysisDriver.workPriority has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20 (22 pts), loops 1 (2 pts) (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.
_DiscoverAvailableFilesJob._initialize (cognitive 24) pkg/analyzer/lib/src/dart/analysis/driver.dart:3187— _DiscoverAvailableFilesJob._initialize has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (5 pts), 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.
ExpressionImpl.correspondingParameter (cognitive 24) pkg/analyzer/lib/src/dart/ast/ast.dart:17913— ExpressionImpl.correspondingParameter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (23 pts), 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.
ConstantVerifier._canBeEqual (cognitive 24) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:565— ConstantVerifier._canBeEqual has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ConstructorInvocationEvaluator.evaluateFactoryConstructorCall (cognitive 24) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3027— _ConstructorInvocationEvaluator.evaluateFactoryConstructorCall has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3 (6 pts), boolean chains 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.
InheritanceManager3._topMerge (cognitive 24) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:1191— InheritanceManager3._topMerge has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (22 pts), 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.
TopMergeHelper._functionTypes (cognitive 24) pkg/analyzer/lib/src/dart/element/top_merge.dart:133— TopMergeHelper._functionTypes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4, 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.
PropertyElementResolver.resolveIndexReadWriteAssignmentTarget (cognitive 24) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:610— PropertyElementResolver.resolveIndexReadWriteAssignmentTarget has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 2 (4 pts), boolean chains 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.
TypedLiteralResolver._inferSetOrMapLiteralType (cognitive 24) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:553— TypedLiteralResolver._inferSetOrMapLiteralType has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 11, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DeprecatedFunctionalityVerifier._checkForDeprecatedOptionalRedirectedParameters (cognitive 24) pkg/analyzer/lib/src/error/deprecated_functionality_verifier.dart:266— DeprecatedFunctionalityVerifier._checkForDeprecatedOptionalRedirectedParameters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 1 (2 pts) (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.
ImportsVerifier.generateUnusedImportWarnings (cognitive 24) pkg/analyzer/lib/src/error/imports_verifier.dart:227— ImportsVerifier.generateUnusedImportWarnings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (23 pts), 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.
_ClassVerifier._checkForRecursiveInterfaceInheritance (cognitive 24) pkg/analyzer/lib/src/error/inheritance_override.dart:690— _ClassVerifier._checkForRecursiveInterfaceInheritance has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 3 (6 pts) (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.
LiteralElementVerifier._verifySpreadForListOrSet (cognitive 24) pkg/analyzer/lib/src/error/literal_element_verifier.dart:243— LiteralElementVerifier._verifySpreadForListOrSet has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 1 (2 pts) (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.
_DirectiveParser._parseArgument (cognitive 24) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:1180— _DirectiveParser._parseArgument has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), 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.
ErrorVerifier._checkForWrongNumberOfParametersForOperator (cognitive 24) pkg/analyzer/lib/src/generated/error_verifier.dart:8149— ErrorVerifier._checkForWrongNumberOfParametersForOperator has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 18, if/else 6. 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.
FfiVerifier._validateCompatibleNativeType (cognitive 24) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1665— FfiVerifier._validateCompatibleNativeType has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 9, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InstanceMemberInferrer._setInducedModifier (cognitive 24) pkg/analyzer/lib/src/summary2/instance_member_inferrer.dart:638— InstanceMemberInferrer._setInducedModifier has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 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.
LocalDeclarationVisitor._visitCompilationUnit (cognitive 24) pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart:378— LocalDeclarationVisitor._visitCompilationUnit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 4 (11 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
InferrerEngine.updateParameterInputs (cognitive 24) pkg/compiler/lib/src/inferrer/engine.dart:894— InferrerEngine.updateParameterInputs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (23 pts), 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.
TypeSystem.joinTypeMasks (cognitive 24) pkg/compiler/lib/src/inferrer/type_system.dart:824— TypeSystem.joinTypeMasks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 2, ternaries 1 (2 pts) (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.
CodegenImpactTransformer.transformCodegenImpact (cognitive 24) pkg/compiler/lib/src/js_backend/impact_transformer.dart:77— CodegenImpactTransformer.transformCodegenImpact has cognitive complexity 24 (threshold 15). Drivers by points: loops 10, if/else 4 (8 pts), match/switch 3 (6 pts) (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.
TypeReferenceFinalizerImpl._allocateNames (cognitive 24) pkg/compiler/lib/src/js_backend/type_reference.dart:370— TypeReferenceFinalizerImpl._allocateNames has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (7 pts), 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.
ClassStubGenerator.generateCallStubsForGetter (cognitive 24) pkg/compiler/lib/src/js_emitter/class_stub_generator.dart:46— ClassStubGenerator.generateCallStubsForGetter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (7 pts), ternaries 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.
ProgramBuilder._buildMethod (cognitive 24) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:965— ProgramBuilder._buildMethod has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 8, ternaries 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.
SsaInstructionSimplifier.handleArrayTypeInfo (cognitive 24) pkg/compiler/lib/src/ssa/optimize.dart:2318— SsaInstructionSimplifier.handleArrayTypeInfo has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (23 pts), 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.
ProtocolConverter._gettersForClassHierarchy (cognitive 24) pkg/dap_adapters/lib/src/protocol_converter.dart:801— ProtocolConverter._gettersForClassHierarchy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (7 pts), boolean chains 5, loops 2 (4 pts) (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.
DDSRunner.start (cognitive 24) pkg/dartdev/lib/src/dds_runner.dart:16— DDSRunner.start has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 4, error handling 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.
DartDevelopmentServiceImpl._startDDSServer (cognitive 24) pkg/dds/lib/src/dds_impl.dart:168— DartDevelopmentServiceImpl._startDDSServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 3, boolean chains 2, error handling 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.
ExtensionBuilderImpl.lookupExtensionMemberByName (cognitive 24) pkg/front_end/lib/src/builder/extension_builder.dart:52— ExtensionBuilderImpl.lookupExtensionMemberByName has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 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.
BodyBuilderImpl.endLiteralString (cognitive 24) pkg/front_end/lib/src/kernel/body_builder.dart:4704— BodyBuilderImpl.endLiteralString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 1 (2 pts) (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.
DelayedGetterSetterCheck._checkGetterSetter (cognitive 24) pkg/front_end/lib/src/kernel/hierarchy/delayed.dart:101— DelayedGetterSetterCheck._checkGetterSetter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OutlineBuilder.endTypedef (cognitive 24) pkg/front_end/lib/src/source/outline_builder.dart:3897— OutlineBuilder.endTypedef has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 1, ternaries 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.
_Processor.preprocessUri (cognitive 24) pkg/front_end/lib/src/util/outline_extractor.dart:141— _Processor.preprocessUri has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 7 (10 pts), boolean chains 2 (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.
StringToSource.analyze (cognitive 24) pkg/js_ast/lib/src/strings.dart:26— StringToSource.analyze has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_Visitor.visitPatternField (cognitive 24) pkg/linter/lib/src/rules/simplify_variable_pattern.dart:40— _Visitor.visitPatternField has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.check (cognitive 24) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:1119— _Visitor.check has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 1 (3 pts), 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.
InspectPage._visitObject (cognitive 24) pkg/observatory/lib/src/app/page.dart:249— InspectPage._visitObject has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20 (21 pts), error handling 1 (3 pts) (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.
SampleProfile._loadCommon (cognitive 24) pkg/observatory/lib/src/sample_profile/sample_profile.dart:903— SampleProfile._loadCommon has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (5 pts), 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.
LateLowering.getLocalLowering (cognitive 24) pkg/kernel/lib/target/targets.dart:729— LateLowering.getLocalLowering has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (24 pts) (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. This shape REPEATS in the file: one other method here (LateLowering.getFieldLowering) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LateLowering.getFieldLowering (cognitive 24) pkg/kernel/lib/target/targets.dart:765— LateLowering.getFieldLowering has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (24 pts) (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. This shape REPEATS in the file: one other method here (LateLowering.getLocalLowering) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NativeCodeOracle.handleNativeProcedure (cognitive 24) pkg/vm/lib/transformations/type_flow/native_code.dart:430— NativeCodeOracle.handleNativeProcedure has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 pts), 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.
UnboxingInfoManager._updateUnboxingInfoOfMember (cognitive 24) pkg/vm/lib/transformations/type_flow/unboxing_info.dart:135— UnboxingInfoManager._updateUnboxingInfoOfMember has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (2 pts) (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.
VMService._routeRequestImpl (cognitive 24) sdk/lib/vmservice/vmservice.dart:730— VMService._routeRequestImpl has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 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.
mdnreader._get_browser_compat_data (cognitive 24) tools/dom/scripts/mdnreader.py:18— mdnreader._get_browser_compat_data has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (4 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CompletionQualityMetricsComputer.gatherMetricsForSuggestions (cognitive 23) pkg/analysis_server/tool/code_completion/completion_metrics.dart:929— CompletionQualityMetricsComputer.gatherMetricsForSuggestions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (6 pts), boolean chains 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.
RelevanceDataCollector._recordTypeRelationships (cognitive 23) pkg/analysis_server/tool/code_completion/relevance_metrics.dart:2053— RelevanceDataCollector._recordTypeRelationships has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BytecodeGenerator._handleVariableInitialization (cognitive 23) pkg/dart2bytecode/lib/bytecode_generator.dart:4725— BytecodeGenerator._handleVariableInitialization has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 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.
DispatchTable.output (cognitive 23) pkg/dart2wasm/lib/dispatch_table.dart:804— DispatchTable.output has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (5 pts), 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.
DynamicDispatchTable.outputTargetTable (cognitive 23) pkg/dart2wasm/lib/dynamic_dispatch_table.dart:199— DynamicDispatchTable.outputTargetTable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (7 pts), 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.
Driver._analyzeFiles (cognitive 23) pkg/linter/tool/checks/driver.dart:60— Driver._analyzeFiles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 2 (10 pts), loops 3 (6 pts), error handling 1 (5 pts), ternaries 1 (2 pts) (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.
_SnapshotGraph._dfs (cognitive 23) pkg/observatory/lib/object_graph.dart:1113— _SnapshotGraph._dfs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5 (9 pts) (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.
_SnapshotGraph._buildDominators (cognitive 23) pkg/observatory/lib/object_graph.dart:1420— _SnapshotGraph._buildDominators has cognitive complexity 23 (threshold 15). Drivers by points: loops 7 (10 pts), if/else 4 (9 pts), ternaries 1 (4 pts) (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.
DartFuzz._emitMinimizedLiteralHelper (cognitive 23) runtime/tools/dartfuzz/dartfuzz.dart:802— DartFuzz._emitMinimizedLiteralHelper has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 1 (3 pts), match/switch 1 (2 pts) (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.
_HttpHeaders._parseCookies (cognitive 23) sdk/lib/_http/http_headers.dart:587— _HttpHeaders._parseCookies has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (5 pts), error handling 1 (3 pts), 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.
_ParameterParser.parseParameterValue (cognitive 23) sdk/lib/_http/http_headers.dart:790— _ParameterParser.parseParameterValue has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CustomHashMap.remove (cognitive 23) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:195— CustomHashMap.remove has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 1 (5 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ModifiableList.setRange (cognitive 23) sdk/lib/_internal/wasm/common/list.dart:84— _ModifiableList.setRange has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (6 pts) (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.
_ChunkedJsonParser.parseStringToBuffer (cognitive 23) sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1021— _ChunkedJsonParser.parseStringToBuffer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (22 pts), 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.
Arm64CodeGenerator.visitAllocateArray (cognitive 23) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:2128— Arm64CodeGenerator.visitAllocateArray has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 4 (7 pts), 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.
DevirtualizionOracle.isAlwaysStaticallyDispatchedTo (cognitive 23) pkg/dart2wasm/lib/deferred_load/devirtualization_oracle.dart:24— DevirtualizionOracle.isAlwaysStaticallyDispatchedTo has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5 (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.
CorrectionUtils.replaceSourceIndent (cognitive 23) pkg/analysis_server_plugin/lib/edit/correction_utils.dart:244— CorrectionUtils.replaceSourceIndent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 3 (4 pts) (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.
InteropSpecializerFactory._getSpecializer (cognitive 23) pkg/dart2wasm/lib/js/interop_specializer.dart:661— InteropSpecializerFactory._getSpecializer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 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.
FfiTransformer.ensureNativeTypeMatch (cognitive 23) pkg/vm/lib/modular/transformations/ffi/common.dart:1922— FfiTransformer.ensureNativeTypeMatch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 1, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
FfiNativeTransformer.visitProcedure (cognitive 23) pkg/vm/lib/modular/transformations/ffi/native.dart:943— FfiNativeTransformer.visitProcedure has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 3 (6 pts), ternaries 1 (3 pts), 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.
Evaluator._visitExpression (cognitive 23) pkg/_fe_analyzer_shared/lib/src/metadata/evaluate.dart:47— Evaluator._visitExpression has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 5 (9 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
TypeReferenceIdentifierContext.ensureIdentifier (cognitive 23) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1511— TypeReferenceIdentifierContext.ensureIdentifier has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (11 pts) (nesting depth added 3). 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.
Parser.parseInitializers (cognitive 23) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4746— Parser.parseInitializers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), 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.
Parser.parseFactoryMethod (cognitive 23) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6162— Parser.parseFactoryMethod has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 3, 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.
Parser._computePrecedence (cognitive 23) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7726— Parser._computePrecedence has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7 (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.
Parser.parseCascadeExpression (cognitive 23) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7777— Parser.parseCascadeExpression has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 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.
IdValue.decode (cognitive 23) pkg/_fe_analyzer_shared/lib/src/testing/id.dart:128— IdValue.decode has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (23 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AnalyticsManager.toHtml (cognitive 23) pkg/analysis_server/lib/src/analytics/analytics_manager.dart:387— AnalyticsManager.toHtml has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (15 pts), if/else 8 (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.
EditGetFixesHandler._computeDartFixes (cognitive 23) pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart:168— EditGetFixesHandler._computeDartFixes has cognitive complexity 23 (threshold 15). Drivers by points: error handling 2 (8 pts), if/else 3 (8 pts), loops 2 (7 pts) (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.
DartCodeActionsProducer.getFixActions (cognitive 23) pkg/analysis_server/lib/src/lsp/handlers/code_actions/dart.dart:201— DartCodeActionsProducer.getFixActions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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.
MigrationRunner._runRound (cognitive 23) pkg/analysis_server/lib/src/lsp/handlers/custom/migration/migration_runner.dart:366— MigrationRunner._runRound has cognitive complexity 23 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 5 (8 pts), ternaries 2 (5 pts), 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.
_MinimalEditComputer._addEditFor (cognitive 23) pkg/analysis_server/lib/src/lsp/source_edits.dart:465— _MinimalEditComputer._addEditFor has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (9 pts), loops 2 (nesting depth added 2). 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.
PluginIsolate._computeEffectiveAnalysisRoots (cognitive 23) pkg/analysis_server/lib/src/plugin/plugin_isolate.dart:252— PluginIsolate._computeEffectiveAnalysisRoots has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (8 pts), 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.
StatementCompletionProcessor._complete_controlFlowBlock (cognitive 23) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:411— StatementCompletionProcessor._complete_controlFlowBlock has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, ternaries 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.
ConvertToContains.compute (cognitive 23) pkg/analysis_server/lib/src/services/correction/dart/convert_to_contains.dart:27— ConvertToContains.compute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (21 pts), 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.
ConvertToInBodyConstructor._writeNameAndParameterList (cognitive 23) pkg/analysis_server/lib/src/services/correction/dart/convert_to_in_body_constructor.dart:440— ConvertToInBodyConstructor._writeNameAndParameterList has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), 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.
CreateExtensionGetter.compute (cognitive 23) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:34— CreateExtensionGetter.compute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 4, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CreateMethod._createMethodFromMethodInvocation (cognitive 23) pkg/analysis_server/lib/src/services/correction/dart/create_method.dart:127— CreateMethod._createMethodFromMethodInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, match/switch 1 (3 pts) (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.
RemoveTypeName.compute (cognitive 23) pkg/analysis_server/lib/src/services/correction/dart/remove_type_name.dart:27— RemoveTypeName.compute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (22 pts), 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.
ReplacedBy._instanceInvocation (cognitive 23) pkg/analysis_server/lib/src/services/correction/fix/data_driven/replaced_by.dart:123— ReplacedBy._instanceInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), 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.
MemberSorter._sortUnitMembers (cognitive 23) pkg/analysis_server/lib/src/services/correction/sort_members.dart:169— MemberSorter._sortUnitMembers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 1 (2 pts), 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.
_PreviewVisitor.visitAnnotation (cognitive 23) pkg/analysis_server/lib/src/services/flutter/widget_previews.dart:271— _PreviewVisitor.visitAnnotation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, ternaries 1 (2 pts) (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.
ExtractWidgetRefactoringImpl._checkSelection (cognitive 23) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:178— ExtractWidgetRefactoringImpl._checkSelection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 pts), 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.
MoveFileRefactoringImpl.buildChange (cognitive 23) pkg/analysis_server/lib/src/services/refactoring/legacy/move_file.dart:67— MoveFileRefactoringImpl.buildChange has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 5 (10 pts), error handling 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.
ImportElementReferencesVisitor.visitSimpleIdentifier (cognitive 23) pkg/analyzer/lib/src/dart/analysis/search.dart:402— ImportElementReferencesVisitor.visitSimpleIdentifier has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InheritanceManager3._inheritCovariance (cognitive 23) pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart:1059— InheritanceManager3._inheritCovariance has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 4 (7 pts) (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.
PrefixScope.PrefixScope (cognitive 23) pkg/analyzer/lib/src/dart/element/scope.dart:601— PrefixScope.PrefixScope has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 2 (4 pts), 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.
ExtensionMemberResolver._chooseMostSpecific (cognitive 23) pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart:344— ExtensionMemberResolver._chooseMostSpecific has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (4 pts) (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.
NamedTypeResolver._instantiateElement (cognitive 23) pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart:436— NamedTypeResolver._instantiateElement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 1 (3 pts) (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.
PropertyElementResolver._resolveUnqualifiedNameRead (cognitive 23) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:2552— PropertyElementResolver._resolveUnqualifiedNameRead has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7, ternaries 1 (3 pts) (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.
TypedLiteralResolver._inferCollectionElementType (cognitive 23) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:366— TypedLiteralResolver._inferCollectionElementType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
BestPracticesVerifier._checkForUnnecessaryNoSuchMethod (cognitive 23) pkg/analyzer/lib/src/error/best_practices_verifier.dart:1456— BestPracticesVerifier._checkForUnnecessaryNoSuchMethod has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 9 (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.
DeprecatedFunctionalityVerifier._checkForDeprecatedOptionalSuperParameters (cognitive 23) pkg/analyzer/lib/src/error/deprecated_functionality_verifier.dart:306— DeprecatedFunctionalityVerifier._checkForDeprecatedOptionalSuperParameters has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (22 pts), 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.
LiteralElementVerifier._verifyElement (cognitive 23) pkg/analyzer/lib/src/error/literal_element_verifier.dart:88— LiteralElementVerifier._verifyElement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
MemberDuplicateDefinitionVerifier._checkExtensionStatic (cognitive 23) pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:486— MemberDuplicateDefinitionVerifier._checkExtensionStatic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (5 pts) (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.
ErrorVerifier._checkForBaseClassOrMixinImplementedOutsideOfLibrary (cognitive 23) pkg/analyzer/lib/src/generated/error_verifier.dart:3858— ErrorVerifier._checkForBaseClassOrMixinImplementedOutsideOfLibrary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 6, loops 2 (4 pts) (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.
ErrorVerifier._checkForWrongTypeParameterVarianceInMethod (cognitive 23) pkg/analyzer/lib/src/generated/error_verifier.dart:8241— ErrorVerifier._checkForWrongTypeParameterVarianceInMethod has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (7 pts) (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.
ResolverVisitor.computeWhyNotPromotedMessages (cognitive 23) pkg/analyzer/lib/src/generated/resolver.dart:725— ResolverVisitor.computeWhyNotPromotedMessages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ResolverVisitor.setWriteElement (cognitive 23) pkg/analyzer/lib/src/generated/resolver.dart:1949— ResolverVisitor.setWriteElement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, ternaries 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.
IgnoreInfo.isIgnoreForFileComment (cognitive 23) pkg/analyzer/lib/src/ignore_comments/ignore_info.dart:248— IgnoreInfo.isIgnoreForFileComment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 21 (22 pts), loops 1 (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.
DartEditBuilderImpl._canWriteType (cognitive 23) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1131— DartEditBuilderImpl._canWriteType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 7, loops 1 (2 pts) (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.
DartFileEditBuilderImpl._insertDocImportIntoLibraryDirective (cognitive 23) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:3210— DartFileEditBuilderImpl._insertDocImportIntoLibraryDirective has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (6 pts), boolean chains 5, 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.
MapTracerVisitor.visitDynamicCallSiteTypeInformation (cognitive 23) pkg/compiler/lib/src/inferrer/map_tracer.dart:79— MapTracerVisitor.visitDynamicCallSiteTypeInformation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (21 pts), 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.
TracerVisitor.visitDynamicCallSiteTypeInformation (cognitive 23) pkg/compiler/lib/src/inferrer/node_tracer.dart:433— TracerVisitor.visitDynamicCallSiteTypeInformation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CallPosition.getSemanticPositionForCall (cognitive 23) pkg/compiler/lib/src/io/position_information.dart:720— CallPosition.getSemanticPositionForCall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 9, loops 1 (2 pts) (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.
_RecipeToIdentifier.visitFunctionType (cognitive 23) pkg/compiler/lib/src/js_backend/type_reference.dart:712— _RecipeToIdentifier.visitFunctionType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5 (9 pts), 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.
SsaInstructionSimplifier.visitStringify (cognitive 23) pkg/compiler/lib/src/ssa/optimize.dart:2407— SsaInstructionSimplifier.visitStringify has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 1 (3 pts), 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.
SsaValueRangeAnalyzer.visitConditionalBranch (cognitive 23) pkg/compiler/lib/src/ssa/value_range_analyzer.dart:1260— SsaValueRangeAnalyzer.visitConditionalBranch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (23 pts) (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.
_DominatorFinder.run (cognitive 23) pkg/dart2js_info/lib/src/graph.dart:285— _DominatorFinder.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (7 pts) (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.
BuildCliSubcommand.run (cognitive 23) pkg/dartdev/lib/src/commands/build.dart:192— BuildCliSubcommand.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 3, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProgramCompiler._emitFactoryInvocation (cognitive 23) pkg/dev_compiler/lib/src/kernel/compiler.dart:7461— ProgramCompiler._emitFactoryInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 3, boolean chains 2, match/switch 1 (2 pts) (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.
ProgramCompiler._emitCast (cognitive 23) pkg/dev_compiler/lib/src/kernel/compiler.dart:7758— ProgramCompiler._emitCast has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LibraryCompiler._emitJSInteropClassNonExternalMembers (cognitive 23) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:1601— LibraryCompiler._emitJSInteropClassNonExternalMembers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, 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.
LibraryCompiler._emitFactoryInvocation (cognitive 23) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8328— LibraryCompiler._emitFactoryInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 3, boolean chains 2, match/switch 1 (2 pts) (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.
LibraryCompiler._emitCast (cognitive 23) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8625— LibraryCompiler._emitCast has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Import.finalizeImports (cognitive 23) pkg/front_end/lib/src/base/import.dart:54— Import.finalizeImports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (4 pts), 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.
_InitializationFromUri.initialize (cognitive 23) pkg/front_end/lib/src/base/incremental_compiler.dart:3369— _InitializationFromUri.initialize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (8 pts), boolean chains 4, error handling 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.
IncrementalSerializer.initialize (cognitive 23) pkg/front_end/lib/src/base/incremental_serializer.dart:25— IncrementalSerializer.initialize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (7 pts), error handling 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.
FactoryEncoding._isCyclicRedirectingFactory (cognitive 23) pkg/front_end/lib/src/fragment/factory/encoding.dart:804— FactoryEncoding._isCyclicRedirectingFactory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (7 pts), boolean chains 6, 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.
ConstantEvaluator._evaluate (cognitive 23) pkg/front_end/lib/src/kernel/constant_evaluator.dart:2820— ConstantEvaluator._evaluate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 1 (2 pts), 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.
KernelCompiledData.getOffsetFromId (cognitive 23) pkg/front_end/lib/src/testing/kernel_id_testing.dart:145— KernelCompiledData.getOffsetFromId has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (23 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MergeVisitor.mergeFunctionTypes (cognitive 23) pkg/kernel/lib/src/merge_visitor.dart:33— MergeVisitor.mergeFunctionTypes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 5 (8 pts) (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.
_Visitor._visitConstructorInvocation (cognitive 23) pkg/linter/lib/src/rules/avoid_redundant_argument_values.dart:137— _Visitor._visitConstructorInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, 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.
_DeclarationVisitor.checkPatternElements (cognitive 23) pkg/linter/lib/src/rules/parameter_assignments.dart:63— _DeclarationVisitor.checkPatternElements has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (4 pts) (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.
_Visitor.visitMethodInvocation (cognitive 23) pkg/linter/lib/src/rules/prefer_iterable_whereType.dart:36— _Visitor.visitMethodInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), 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.
_DeclarationGatherer.addDeclarations (cognitive 23) pkg/linter/lib/src/rules/unreachable_from_main.dart:56— _DeclarationGatherer.addDeclarations has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (21 pts), 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.
_Visitor.visitIfElement (cognitive 23) pkg/linter/lib/src/rules/use_null_aware_elements.dart:42— _Visitor.visitIfElement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2, match/switch 1 (2 pts) (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.parseType (cognitive 23) pkg/kernel/lib/testing/type_parser.dart:477— Parser.parseType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (6 pts), 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.
WidgetCreatorTracker._transformWidgetConstructors (cognitive 23) pkg/kernel/lib/transformations/track_widget_constructor_locations.dart:771— WidgetCreatorTracker._transformWidgetConstructors has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, loops 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.
_WorkList.processInvocation (cognitive 23) pkg/vm/lib/transformations/type_flow/analysis.dart:1979— _WorkList.processInvocation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (23 pts) (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.
SummaryCollector.rawArguments (cognitive 23) pkg/vm/lib/transformations/type_flow/summary_collector.dart:955— SummaryCollector.rawArguments has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (8 pts), boolean chains 1, 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.
SetType.union (cognitive 23) pkg/vm/lib/transformations/type_flow/types.dart:744— SetType.union has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 1 (2 pts), 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.
WideConeType.intersection (cognitive 23) pkg/vm/lib/transformations/type_flow/types.dart:1016— WideConeType.intersection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 1 (2 pts) (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.
SimpleUnreachableCodeElimination.visitSwitchStatement (cognitive 23) pkg/vm/lib/transformations/unreachable_code_elimination.dart:192— SimpleUnreachableCodeElimination.visitSwitchStatement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (4 pts), 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.
HtmlDartGenerator.AddMembers (cognitive 23) tools/dom/scripts/htmldartgenerator.py:77— HtmlDartGenerator.AddMembers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (6 pts), 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.
timeline.processTimelineResponse (cognitive 23) pkg/observatory/web/timeline.js:584— timeline.processTimelineResponse has cognitive complexity 23 (threshold 15). Drivers by points: loops 3 (12 pts), if/else 6 (11 pts) (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.
graphexplorer.Graph.loadDartHeapSnapshot (cognitive 23) runtime/tools/graphexplorer/graphexplorer.js:155— graphexplorer.Graph.loadDartHeapSnapshot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 6 (8 pts), ternaries 1 (3 pts), match/switch 1 (2 pts) (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.
computeDominators (cognitive 23) runtime/tools/graphexplorer/graphexplorer.js:576— computeDominators has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (7 pts), ternaries 1 (4 pts) (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.
DartLanguageServerBenchmark._launch (cognitive 22) pkg/analysis_server/tool/benchmark_tools/language_server_benchmark.dart:256— DartLanguageServerBenchmark._launch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), loops 1 (2 pts), 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.
CodeShapeMetricsComputer._writeChildData (cognitive 22) pkg/analysis_server/tool/code_completion/code_metrics.dart:1374— CodeShapeMetricsComputer._writeChildData has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (14 pts), if/else 3 (8 pts) (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.
Translator.getClosure (cognitive 22) pkg/dart2wasm/lib/translator.dart:1343— Translator.getClosure has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 4, ternaries 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_DartWasmLibraryChecks.visitStaticInvocation (cognitive 22) pkg/dart2wasm/lib/wasm_library_checks.dart:108— _DartWasmLibraryChecks.visitStaticInvocation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_VerifyingVisitor.visitProcedure (cognitive 22) pkg/kernel/lib/verifier.dart:896— _VerifyingVisitor.visitProcedure has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 11. 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.
StatusFile.read (cognitive 22) pkg/status_file/lib/status_file.dart:54— StatusFile.read has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (7 pts), loops 2 (4 pts) (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.
Api.parse (cognitive 22) pkg/vm_service/tool/dart/generate_dart_common.dart:96— Api.parse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 6, loops 3 (5 pts) (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.
Type.generateAssert (cognitive 22) pkg/vm_service/tool/dart/generate_dart_common.dart:965— Type.generateAssert has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (5 pts) (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.
_StringBase.indexOf (cognitive 22) sdk/lib/_internal/vm/lib/string_patch.dart:383— _StringBase.indexOf has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts), 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.
int._parseRadix (cognitive 22) sdk/lib/_internal/wasm/common/int_patch.dart:112— int._parseRadix has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 2, ternaries 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.
Arm64CodeGenerator._prepareNamedParameters (cognitive 22) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:186— Arm64CodeGenerator._prepareNamedParameters has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 pts), loops 4, 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.
RegisterAllocationChecker.computeInOut (cognitive 22) pkg/native_compiler/lib/back_end/regalloc_checker.dart:135— RegisterAllocationChecker.computeInOut has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 5 (8 pts) (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.
DateTime.parse (cognitive 22) sdk/lib/core/date_time.dart:252— DateTime.parse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FunctionRegistry.getFunction (cognitive 22) pkg/cfg/lib/ir/functions.dart:340— FunctionRegistry.getFunction has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 6, ternaries 2 (4 pts), match/switch 1 (nesting depth added 2). 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.
SSALivenessAnalysis.computeInitialSets (cognitive 22) pkg/cfg/lib/ir/liveness_analysis.dart:142— SSALivenessAnalysis.computeInitialSets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (11 pts) (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.
ValueNumbering.run (cognitive 22) pkg/cfg/lib/passes/value_numbering.dart:31— ValueNumbering.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (5 pts) (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.
ListPatternStaticType.witnessToDart (cognitive 22) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:159— ListPatternStaticType.witnessToDart has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 4, 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.
ModifierContext.parseFormalParameterModifiers (cognitive 22) pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart:205— ModifierContext.parseFormalParameterModifiers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), 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.
Parser.parseEnumHeaderOpt (cognitive 22) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:2737— Parser.parseEnumHeaderOpt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2, ternaries 1 (2 pts), 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.
Parser.computeTypeAfterIsOrAs (cognitive 22) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9647— Parser.computeTypeAfterIsOrAs has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 14, if/else 4 (8 pts) (nesting depth added 4). 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.
Parser.looksLikeExpressionAfterAwaitOrYield (cognitive 22) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:10551— Parser.looksLikeExpressionAfterAwaitOrYield has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10 (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.
TypeAnalyzer.analyzeMapPattern (cognitive 22) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:1482— TypeAnalyzer.analyzeMapPattern has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, loops 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.
AbstractRefactorCommandHandler.getRefactoring (cognitive 22) pkg/analysis_server/lib/src/lsp/handlers/commands/abstract_refactor.dart:48— AbstractRefactorCommandHandler.getRefactoring has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (6 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
DevAnalysisServer.processDirectories (cognitive 22) pkg/analysis_server/lib/src/server/dev_server.dart:37— DevAnalysisServer.processDirectories has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Driver.start (cognitive 22) pkg/analysis_server/lib/src/server/driver.dart:175— Driver.start has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 3, error handling 1 (2 pts), 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.
DeclarationHelper._addExternalTopLevelDeclarations (cognitive 22) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:934— DeclarationHelper._addExternalTopLevelDeclarations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (19 pts), match/switch 1 (2 pts), 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.
InScopeCompletionPass.visitExtensionDeclaration (cognitive 22) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1285— InScopeCompletionPass.visitExtensionDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), 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.
InScopeCompletionPass.visitMixinDeclaration (cognitive 22) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:2178— InScopeCompletionPass.visitMixinDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), 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.
StatementCompletionProcessor._complete_switchStatement (cognitive 22) pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart:979— StatementCompletionProcessor._complete_switchStatement has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 1 (4 pts), 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.
ConvertToExpressionFunctionBody.compute (cognitive 22) pkg/analysis_server/lib/src/services/correction/dart/convert_to_expression_function_body.dart:30— ConvertToExpressionFunctionBody.compute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConvertToWildcardVariable.compute (cognitive 22) pkg/analysis_server/lib/src/services/correction/dart/convert_to_wildcard_variable.dart:37— ConvertToWildcardVariable.compute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, match/switch 1 (2 pts), 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.
CreateMissingOverrides.compute (cognitive 22) pkg/analysis_server/lib/src/services/correction/dart/create_missing_overrides.dart:34— CreateMissingOverrides.compute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3, 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.
FlutterParentAndChild.swapParentAndChild (cognitive 22) pkg/analysis_server/lib/src/services/correction/dart/flutter_swap_with_child.dart:21— FlutterParentAndChild.swapParentAndChild has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AddTypeParameter.validate (cognitive 22) pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart:50— AddTypeParameter.validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (20 pts), 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.
_MatcherBuilder.buildMatchersForNode (cognitive 22) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart:203— _MatcherBuilder.buildMatchersForNode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RenameParameter.apply (cognitive 22) pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart:25— RenameParameter.apply has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RenameParameter.validate (cognitive 22) pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart:70— RenameParameter.validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 1 (3 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExtractWidgetRefactoringImpl._writeWidgetDeclaration (cognitive 22) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:435— ExtractWidgetRefactoringImpl._writeWidgetDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RenameConstructorRefactoringImpl.buildChange (cognitive 22) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_constructor.dart:46— RenameConstructorRefactoringImpl.buildChange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 pts), 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.
ContextRootImpl._isExcluded (cognitive 22) pkg/analyzer/lib/src/dart/analysis/context_root.dart:138— ContextRootImpl._isExcluded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (6 pts), 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.
_IndexContributor.visitSimpleIdentifier (cognitive 22) pkg/analyzer/lib/src/dart/analysis/index.dart:1405— _IndexContributor.visitSimpleIdentifier has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Search.references (cognitive 22) pkg/analyzer/lib/src/dart/analysis/search.dart:588— Search.references has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 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.
Search._searchReferences_Field (cognitive 22) pkg/analyzer/lib/src/dart/analysis/search.dart:1014— Search._searchReferences_Field has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (5 pts), match/switch 1 (3 pts), 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.
ConstantVisitor.visitBinaryOperatorInvocation (cognitive 22) pkg/analyzer/lib/src/dart/constant/evaluation.dart:673— ConstantVisitor.visitBinaryOperatorInvocation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, match/switch 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.
TypeSystemImpl._futureTypeOfBounded (cognitive 22) pkg/analyzer/lib/src/dart/element/type_system.dart:1822— TypeSystemImpl._futureTypeOfBounded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (21 pts), 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.
MethodInvocationResolver.resolve (cognitive 22) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:70— MethodInvocationResolver.resolve has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (20 pts), 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.
_ErrorHelper.reportNullOrNonTypeElement (cognitive 22) pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart:709— _ErrorHelper.reportNullOrNonTypeElement has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RecordTypeAnnotationResolver.reportInvalidFieldNames (cognitive 22) pkg/analyzer/lib/src/dart/resolver/record_type_annotation_resolver.dart:64— RecordTypeAnnotationResolver.reportInvalidFieldNames has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TypedLiteralResolver.resolveSetOrMapLiteral (cognitive 22) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:109— TypedLiteralResolver.resolveSetOrMapLiteral has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 pts), 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.
_Constructor.updateWithInitializers (cognitive 22) pkg/analyzer/lib/src/error/constructor_fields_verifier.dart:255— _Constructor.updateWithInitializers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AstBuilder.endVariablesDeclaration (cognitive 22) pkg/analyzer/lib/src/fasta/ast_builder.dart:3625— AstBuilder.endVariablesDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (20 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LibraryExportRequirements.build (cognitive 22) pkg/analyzer/lib/src/fine/requirements.dart:466— LibraryExportRequirements.build has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), match/switch 1 (3 pts) (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.
SdkConstraintExtractor._initializeTextAndOffset (cognitive 22) pkg/analyzer/lib/src/hint/sdk_constraint_extractor.dart:69— SdkConstraintExtractor._initializeTextAndOffset has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (19 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartEditBuilderImpl.writeConstructorDeclaration (cognitive 22) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:167— DartEditBuilderImpl.writeConstructorDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KernelInfoCollector.visitLibrary (cognitive 22) pkg/compiler/lib/src/dump_info.dart:846— KernelInfoCollector.visitLibrary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 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.
DumpInfoTask.buildDumpInfoData (cognitive 22) pkg/compiler/lib/src/dump_info.dart:1828— DumpInfoTask.buildDumpInfoData has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 6 (9 pts), ternaries 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.
KernelTypeGraphBuilder.visitLogicalExpression (cognitive 22) pkg/compiler/lib/src/inferrer/builder.dart:2265— KernelTypeGraphBuilder.visitLogicalExpression has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (22 pts) (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.
TracerVisitor.analyzeStoredIntoList (cognitive 22) pkg/compiler/lib/src/inferrer/node_tracer.dart:297— TracerVisitor.analyzeStoredIntoList has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts) (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. This shape REPEATS in the file: 2 other methods here (TracerVisitor.analyzeStoredIntoSet, TracerVisitor.analyzeStoredIntoMap) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
TracerVisitor.analyzeStoredIntoSet (cognitive 22) pkg/compiler/lib/src/inferrer/node_tracer.dart:317— TracerVisitor.analyzeStoredIntoSet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts) (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. This shape REPEATS in the file: 2 other methods here (TracerVisitor.analyzeStoredIntoList, TracerVisitor.analyzeStoredIntoMap) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
TracerVisitor.analyzeStoredIntoMap (cognitive 22) pkg/compiler/lib/src/inferrer/node_tracer.dart:338— TracerVisitor.analyzeStoredIntoMap has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts) (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. This shape REPEATS in the file: 2 other methods here (TracerVisitor.analyzeStoredIntoList, TracerVisitor.analyzeStoredIntoSet) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
RecordTypeMask.isInMask (cognitive 22) pkg/compiler/lib/src/inferrer/typemasks/record_type_mask.dart:319— RecordTypeMask.isInMask has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, loops 1 (2 pts) (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.
FragmentEmitter.emitTypeRules (cognitive 22) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:2122— FragmentEmitter.emitTypeRules has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (7 pts), loops 3 (6 pts), 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.
JsKernelToElementMap.JsKernelToElementMap (cognitive 22) pkg/compiler/lib/src/js_model/element_map_impl.dart:117— JsKernelToElementMap.JsKernelToElementMap has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6 (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.
JsKernelToElementMap._buildClosureClassFields (cognitive 22) pkg/compiler/lib/src/js_model/element_map_impl.dart:1923— JsKernelToElementMap._buildClosureClassFields has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), 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.
SsaCodeGenerator._expressionType (cognitive 22) pkg/compiler/lib/src/ssa/codegen.dart:538— SsaCodeGenerator._expressionType has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 1 (4 pts), loops 2 (3 pts), 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.
SsaTrustedLateCheckRemover.visitLateCheck (cognitive 22) pkg/compiler/lib/src/ssa/codegen_helpers.dart:610— SsaTrustedLateCheckRemover.visitLateCheck has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (21 pts), 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.
ShiftRightSpecializer.tryConvertToBuiltin (cognitive 22) pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart:1286— ShiftRightSpecializer.tryConvertToBuiltin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 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.
SsaInstructionSimplifier.visitTypeEval (cognitive 22) pkg/compiler/lib/src/ssa/optimize.dart:2504— SsaInstructionSimplifier.visitTypeEval has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (22 pts) (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.
SsaInstructionSimplifier.visitShiftRight (cognitive 22) pkg/compiler/lib/src/ssa/optimize.dart:2939— SsaInstructionSimplifier.visitShiftRight has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 1 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SideEffects.toString (cognitive 22) pkg/compiler/lib/src/universe/side_effects.dart:191— SideEffects.toString has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 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.
DartDebugAdapter._configureIsolateSettings (cognitive 22) pkg/dap_adapters/lib/src/adapters/dart.dart:790— DartDebugAdapter._configureIsolateSettings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, error handling 2, loops 1 (2 pts) (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.
BaseDebugAdapter.handleIncomingRequest (cognitive 22) pkg/dap_adapters/lib/src/base_debug_adapter.dart:326— BaseDebugAdapter.handleIncomingRequest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 22. 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.
InstallCommand._parseArguments (cognitive 22) pkg/dartdev/lib/src/commands/install.dart:94— InstallCommand._parseArguments has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (2 pts) (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.
FunctionTypeBuilderImpl.substituteRange (cognitive 22) pkg/front_end/lib/src/builder/function_type_builder.dart:349— FunctionTypeBuilderImpl.substituteRange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), 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.
RecordTypeBuilderImpl.printOn (cognitive 22) pkg/front_end/lib/src/builder/record_type_builder.dart:105— RecordTypeBuilderImpl.printOn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (4 pts) (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.
BodyBuilderImpl.endSwitchBlock (cognitive 22) pkg/front_end/lib/src/kernel/body_builder.dart:5371— BodyBuilderImpl.endSwitchBlock has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts), ternaries 2 (5 pts) (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.
ConstantEvaluator.isSubtype (cognitive 22) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5772— ConstantEvaluator.isSubtype has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, loops 2 (4 pts) (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.
CfeSealedClassOperations.getDirectSubclasses (cognitive 22) pkg/front_end/lib/src/kernel/exhaustiveness.dart:472— CfeSealedClassOperations.getDirectSubclasses has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (5 pts) (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.
SourceExtensionTypeDeclarationBuilder._buildRepresentationType (cognitive 22) pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart:468— SourceExtensionTypeDeclarationBuilder._buildRepresentationType has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (22 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartTypeToTextVisitor.visitFunctionType (cognitive 22) pkg/front_end/lib/src/testing/id_testing_utils.dart:802— DartTypeToTextVisitor.visitFunctionType has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (4 pts), 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.
InferenceVisitorBase._computeAssignabilityKind (cognitive 22) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:859— InferenceVisitorBase._computeAssignabilityKind has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, match/switch 1 (2 pts) (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.
InferenceVisitorBase.findInterfaceMember (cognitive 22) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:1394— InferenceVisitorBase.findInterfaceMember has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, ternaries 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.
InferenceVisitorBase.preCheckInvocationContravariance (cognitive 22) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:5010— InferenceVisitorBase.preCheckInvocationContravariance has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 8 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.visitFieldDeclaration (cognitive 22) pkg/linter/lib/src/rules/avoid_field_initializers_in_const_classes.dart:86— _Visitor.visitFieldDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (2 pts), ternaries 1 (2 pts) (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.
_Visitor.visitClassDeclaration (cognitive 22) pkg/linter/lib/src/rules/hash_and_equals.dart:37— _Visitor.visitClassDeclaration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, 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.
StackTraceHeader.tryParseHeaderLine (cognitive 22) pkg/native_stack_traces/lib/src/convert.dart:137— StackTraceHeader.tryParseHeaderLine has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 pts), 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.
LineNumberProgramHeader.fromReader (cognitive 22) pkg/native_stack_traces/lib/src/dwarf.dart:1402— LineNumberProgramHeader.fromReader has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (5 pts), boolean chains 1, ternaries 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.
DebuggerLocation._completeFunction (cognitive 22) pkg/observatory/lib/src/debugger/debugger_location.dart:323— DebuggerLocation._completeFunction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts) (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.
Instructions.serialize (cognitive 22) pkg/wasm_builder/lib/src/ir/instructions.dart:66— Instructions.serialize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), 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.
ModulePrinter.print (cognitive 22) pkg/wasm_builder/lib/src/serialize/printer.dart:254— ModulePrinter.print has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 6 (9 pts), boolean chains 1, ternaries 1 (nesting depth added 8). 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.
_ClassInfo._initDispatchTargets (cognitive 22) pkg/vm/lib/transformations/dynamic_interface_annotator.dart:644— _ClassInfo._initDispatchTargets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (4 pts), boolean chains 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.
SummaryCollector._makeNarrow (cognitive 22) pkg/vm/lib/transformations/type_flow/summary_collector.dart:1379— SummaryCollector._makeNarrow has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, ternaries 1 (3 pts) (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.
TreeShaker.addUsedMember (cognitive 22) pkg/vm/lib/transformations/type_flow/transformer.dart:1092— TreeShaker.addUsedMember has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), 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.
WideConeType.union (cognitive 22) pkg/vm/lib/transformations/type_flow/types.dart:977— WideConeType.union has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 1 (2 pts), 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.
DevFS._writeDevFSFile (cognitive 22) sdk/lib/vmservice/devfs.dart:280— DevFS._writeDevFSFile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 1 (2 pts) (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.
idlsync.remove_obsolete_webcore_files (cognitive 22) tools/dom/scripts/idlsync.py:226— idlsync.remove_obsolete_webcore_files has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Version.__lt__ (cognitive 22) tools/utils.py:192— Version.__lt__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, boolean chains 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.
BytecodeGenerator.getClassDeclaration (cognitive 21) pkg/dart2bytecode/lib/bytecode_generator.dart:313— BytecodeGenerator.getClassDeclaration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BytecodeGenerator.end (cognitive 21) pkg/dart2bytecode/lib/bytecode_generator.dart:2041— BytecodeGenerator.end has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (21 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BytecodeGenerator.getClosureDeclaration (cognitive 21) pkg/dart2bytecode/lib/bytecode_generator.dart:2681— BytecodeGenerator.getClosureDeclaration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 2, boolean chains 1, match/switch 1, ternaries 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.
Component.write (cognitive 21) pkg/dart2bytecode/lib/declarations.dart:1420— Component.write has cognitive complexity 21 (threshold 15). Drivers by points: loops 14, if/else 5 (7 pts) (nesting depth added 2). 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.
_Allocator._visitFunction (cognitive 21) pkg/dart2bytecode/lib/local_vars.dart:948— _Allocator._visitFunction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (3 pts) (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.
AstCodeGenerator.visitTryCatch (cognitive 21) pkg/dart2wasm/lib/code_generator.dart:931— AstCodeGenerator.visitTryCatch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (4 pts), 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.
_ConstantAccessor._defineConstantInModule (cognitive 21) pkg/dart2wasm/lib/constants.dart:2051— _ConstantAccessor._defineConstantInModule has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (5 pts), boolean chains 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.
_UsageCollector._findVariablesStoredInFields (cognitive 21) pkg/dart2wasm/lib/constructor_info.dart:158— _UsageCollector._findVariablesStoredInFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (5 pts) (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.
DynamicDispatchTable.outputClassIdTable (cognitive 21) pkg/dart2wasm/lib/dynamic_dispatch_table.dart:257— DynamicDispatchTable.outputClassIdTable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (6 pts), 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.
ParameterInfo.fromMember (cognitive 21) pkg/dart2wasm/lib/param_info.dart:73— ParameterInfo.fromMember has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (2 pts) (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.
FrontendCompiler.invalidateIfInitializingFromDill (cognitive 21) pkg/frontend_server/lib/frontend_server.dart:1335— FrontendCompiler.invalidateIfInitializingFromDill has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 3 (5 pts), loops 2 (3 pts) (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.
Type.generateSerializedFieldAccess (cognitive 21) pkg/vm_service/tool/dart/generate_dart_common.dart:928— Type.generateSerializedFieldAccess has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (3 pts) (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.
_ProgramInfoBuilder.getInfoNodeFor (cognitive 21) pkg/vm_snapshot_analysis/lib/v8_profile.dart:371— _ProgramInfoBuilder.getInfoNodeFor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 1 (5 pts), match/switch 1 (3 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AppWindowCreateWindowOptions.AppWindowCreateWindowOptions (cognitive 21) tools/dom/src/_chrome/app_window.dart:61— AppWindowCreateWindowOptions.AppWindowCreateWindowOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 21. 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.
_HttpOutgoing.addStream (cognitive 21) sdk/lib/_http/http_impl.dart:1846— _HttpOutgoing.addStream has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (21 pts) (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.
_HttpOutgoing.close (cognitive 21) sdk/lib/_http/http_impl.dart:1934— _HttpOutgoing.close has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (20 pts), 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.
_HttpParser._headersEnd (cognitive 21) sdk/lib/_http/http_parser.dart:388— _HttpParser._headersEnd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, boolean chains 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.
CustomHashMap.[] (cognitive 21) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:97— CustomHashMap.[] has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 1 (6 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Primitives.parseInt (cognitive 21) sdk/lib/_internal/js_runtime/lib/js_helper.dart:337— Primitives.parseInt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, loops 1 (2 pts) (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.
Arm64Assembler._emitAddSub (cognitive 21) pkg/native_compiler/lib/back_end/arm64/assembler.dart:1190— Arm64Assembler._emitAddSub has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 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.
_LineSplitterSink._addLines (cognitive 21) sdk/lib/convert/line_splitter.dart:144— _LineSplitterSink._addLines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), 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.
DependenciesCollector.directReferenceDependencies (cognitive 21) pkg/dart2wasm/lib/deferred_load/dependencies.dart:68— DependenciesCollector.directReferenceDependencies has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (4 pts), 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._isConstructor (cognitive 21) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:5721— Parser._isConstructor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (21 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TypeAnalyzer.analyzeRecordPattern (cognitive 21) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:2079— TypeAnalyzer.analyzeRecordPattern has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
EditGetAvailableRefactoringsHandler.handle (cognitive 21) pkg/analysis_server/lib/src/handler/legacy/edit_get_available_refactorings.dart:20— EditGetAvailableRefactoringsHandler.handle has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (21 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LspAnalysisServer.handleMessage (cognitive 21) pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart:425— LspAnalysisServer.handleMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), error handling 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.
ResultMerger.mergeRefactorings (cognitive 21) pkg/analysis_server/lib/src/plugin/result_merger.dart:694— ResultMerger.mergeRefactorings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 4 (5 pts) (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.
DeclarationHelper.addMembersFromExtensionElement (cognitive 21) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:500— DeclarationHelper.addMembersFromExtensionElement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 3 (5 pts), ternaries 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.
DeclarationHelper._addLocalDeclarations (cognitive 21) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:1309— DeclarationHelper._addLocalDeclarations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 1 (2 pts), 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.
FeatureComputer.computeElementKind (cognitive 21) pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart:186— FeatureComputer.computeElementKind has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, boolean chains 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. This shape REPEATS in the file: one other method here (FeatureComputer.computeElementKind2) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
FeatureComputer.computeElementKind2 (cognitive 21) pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart:238— FeatureComputer.computeElementKind2 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, boolean chains 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. This shape REPEATS in the file: one other method here (FeatureComputer.computeElementKind) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
InScopeCompletionPass.visitFormalParameterList (cognitive 21) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1519— InScopeCompletionPass.visitFormalParameterList has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
YamlCompletionGenerator._producerForPath (cognitive 21) pkg/analysis_server/lib/src/services/completion/yaml/yaml_completion_generator.dart:151— YamlCompletionGenerator._producerForPath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, ternaries 1 (4 pts), 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.
CreateExtensionSetter.compute (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:511— CreateExtensionSetter.compute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 4, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CreateField._proposeFromIdentifier (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/create_field.dart:147— CreateField._proposeFromIdentifier has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, 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.
CreateMixin.producers (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/create_mixin.dart:20— CreateMixin.producers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 1 (2 pts) (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.
CreateParameter.compute (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/create_parameter.dart:29— CreateParameter.compute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DestructureLocalVariableAssignment.computeObjectPattern (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/destructure_local_variable_assignment.dart:47— DestructureLocalVariableAssignment.computeObjectPattern has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (8 pts) (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.
RemoveThisAlias._resolveNameInScope (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/remove_this_alias.dart:149— RemoveThisAlias._resolveNameInScope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (4 pts), 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.
RemoveUnusedLocalVariable._deleteDeclaration (cognitive 21) pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart:85— RemoveUnusedLocalVariable._deleteDeclaration has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 2 (3 pts), 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.
Rename.apply (cognitive 21) pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart:22— Rename.apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3 (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.
TransformSetParser._translateCodeTemplate (cognitive 21) pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart:707— TransformSetParser._translateCodeTemplate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
_SignatureUpdater._rewriteToNamedSuper (cognitive 21) pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart:1195— _SignatureUpdater._rewriteToNamedSuper has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), 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.
_ApplyState._applyCannotIgnore (cognitive 21) pkg/analyzer/lib/src/analysis_options/analysis_options_parser.dart:173— _ApplyState._applyCannotIgnore has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 pts), ternaries 1 (5 pts) (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.
Search._addResults (cognitive 21) pkg/analyzer/lib/src/dart/analysis/search.dart:734— Search._addResults has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 4 (7 pts), 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.
_LocalReferencesVisitor.visitSimpleIdentifier (cognitive 21) pkg/analyzer/lib/src/dart/analysis/search.dart:2039— _LocalReferencesVisitor.visitSimpleIdentifier has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 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.
ImportDirectiveImpl.areSyntacticallyIdenticalExceptUri (cognitive 21) pkg/analyzer/lib/src/dart/ast/ast.dart:29605— ImportDirectiveImpl.areSyntacticallyIdenticalExceptUri has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 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.
ConstantVerifier._validateFieldInitializers (cognitive 21) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:932— ConstantVerifier._validateFieldInitializers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 2 (4 pts), 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.
ConstantVisitor._getDeferredLibraryError (cognitive 21) pkg/analyzer/lib/src/dart/constant/evaluation.dart:2191— ConstantVisitor._getDeferredLibraryError has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_ConstructorInvocationEvaluator._checkFromEnvironmentArguments (cognitive 21) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3210— _ConstructorInvocationEvaluator._checkFromEnvironmentArguments has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
_Collector._nameExpression (cognitive 21) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:406— _Collector._nameExpression has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
TypeSystemImpl.isMoreBottom (cognitive 21) pkg/analyzer/lib/src/dart/element/type_system.dart:1039— TypeSystemImpl.isMoreBottom has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
InvocationInferrer._resolveDeferredFunctionLiterals (cognitive 21) pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart:619— InvocationInferrer._resolveDeferredFunctionLiterals has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 pts), 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.
FfiVerifier._validateFfiMethodInvocation (cognitive 21) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1780— FfiVerifier._validateFfiMethodInvocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 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.
FragmentEmitter.emitInstanceMethodAliases (cognitive 21) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:1338— FragmentEmitter.emitInstanceMethodAliases has cognitive complexity 21 (threshold 15). Drivers by points: if/else 2 (9 pts), loops 3 (6 pts), ternaries 1 (6 pts) (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.
KernelSsaGraphBuilder.visitStaticInvocation (cognitive 21) pkg/compiler/lib/src/ssa/builder.dart:5079— KernelSsaGraphBuilder.visitStaticInvocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5 (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.
SsaCodeGenerator.handleDelayedVariableDeclarations (cognitive 21) pkg/compiler/lib/src/ssa/codegen.dart:464— SsaCodeGenerator.handleDelayedVariableDeclarations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 2, loops 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaInstructionSelection._computeBitWidth (cognitive 21) pkg/compiler/lib/src/ssa/codegen_helpers.dart:284— SsaInstructionSelection._computeBitWidth has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4 (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.
SsaInstructionSimplifier.visitBitAnd (cognitive 21) pkg/compiler/lib/src/ssa/optimize.dart:2796— SsaInstructionSimplifier.visitBitAnd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DartDebugAdapter.stackTraceRequest (cognitive 21) pkg/dap_adapters/lib/src/adapters/dart.dart:1837— DartDebugAdapter.stackTraceRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (5 pts), 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.
DdsIsolateManager.initializeIsolates (cognitive 21) pkg/dart_runtime_service_dds/lib/src/dds_isolate_manager.dart:166— DdsIsolateManager.initializeIsolates has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 1 (5 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
FixCommand._compareFixesInDirectory (cognitive 21) pkg/dartdev/lib/src/commands/fix.dart:245— FixCommand._compareFixesInDirectory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3, ternaries 1 (3 pts), error handling 1 (2 pts) (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.
AsyncRewriterBase.visitFor (cognitive 21) pkg/dev_compiler/lib/src/compiler/rewrite_async.dart:1241— AsyncRewriterBase.visitFor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (8 pts), loops 1 (3 pts), 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.
ProgramCompiler.emitModule (cognitive 21) pkg/dev_compiler/lib/src/kernel/compiler.dart:651— ProgramCompiler.emitModule has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ProgramCompiler._emitJSInteropClassNonExternalMembers (cognitive 21) pkg/dev_compiler/lib/src/kernel/compiler.dart:1313— ProgramCompiler._emitJSInteropClassNonExternalMembers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, 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.
ProgramCompiler._coerceBitOperationResultToUnsigned (cognitive 21) pkg/dev_compiler/lib/src/kernel/compiler.dart:6181— ProgramCompiler._coerceBitOperationResultToUnsigned has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), 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.
ProgramCompiler._emitSuperTarget (cognitive 21) pkg/dev_compiler/lib/src/kernel/compiler.dart:6579— ProgramCompiler._emitSuperTarget has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, if/else 5 (6 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LibraryCompiler._coerceBitOperationResultToUnsigned (cognitive 21) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6870— LibraryCompiler._coerceBitOperationResultToUnsigned has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), 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.
LibraryCompiler._emitSuperTarget (cognitive 21) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7268— LibraryCompiler._emitSuperTarget has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, if/else 5 (6 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IncrementalCompiler._convertSourceLibraryBuildersToDill (cognitive 21) pkg/front_end/lib/src/base/incremental_compiler.dart:772— IncrementalCompiler._convertSourceLibraryBuildersToDill has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (9 pts) (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.
IncrementalCompiler._cleanupSourcesForBuilder (cognitive 21) pkg/front_end/lib/src/base/incremental_compiler.dart:1912— IncrementalCompiler._cleanupSourcesForBuilder has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), 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.
TransitiveDependenciesCalculator._calculateTransitiveHashes (cognitive 21) pkg/front_end/lib/src/base/incremental_compiler.dart:4168— TransitiveDependenciesCalculator._calculateTransitiveHashes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 6 (10 pts), 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.
NamedTypeBuilderImpl.resolveIn (cognitive 21) pkg/front_end/lib/src/builder/named_type_builder.dart:200— NamedTypeBuilderImpl.resolveIn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 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.
_ExtensionTypeConstructorEncodingMixin._build (cognitive 21) pkg/front_end/lib/src/fragment/constructor/encoding.dart:570— _ExtensionTypeConstructorEncodingMixin._build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts) (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.
ConstantEvaluator.hasPrimitiveEqual (cognitive 21) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5683— ConstantEvaluator.hasPrimitiveEqual has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), 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.
ForwardingNode._createNoSuchMethodForwarder (cognitive 21) pkg/front_end/lib/src/kernel/forwarding_node.dart:494— ForwardingNode._createNoSuchMethodForwarder has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 2, ternaries 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.
Covariance.fromMethod (cognitive 21) pkg/front_end/lib/src/kernel/member_covariance.dart:116— Covariance.fromMethod has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), 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.
DelayedInstanceGet.createExpression (cognitive 21) pkg/front_end/lib/src/type_inference/delayed_expressions.dart:1050— DelayedInstanceGet.createExpression has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 6 (8 pts), 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.
InferenceVisitorImpl.visitAnonymousMethodBlock (cognitive 21) pkg/front_end/lib/src/type_inference/inference_visitor.dart:9366— InferenceVisitorImpl.visitAnonymousMethodBlock has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 4 (6 pts), boolean chains 1, 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.
InferenceVisitorBase.getWhyNotPromotedContext (cognitive 21) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:259— InferenceVisitorBase.getWhyNotPromotedContext has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 1 (2 pts), 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.
InferenceVisitorBase._finishFieldGetterInvocation (cognitive 21) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3282— InferenceVisitorBase._finishFieldGetterInvocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 6, match/switch 1 (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.
InferenceVisitorBase.inferMethodInvocation (cognitive 21) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3621— InferenceVisitorBase.inferMethodInvocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 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.
InferenceVisitorBase.inferVariableGet (cognitive 21) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:4364— InferenceVisitorBase.inferVariableGet has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), 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.
Printer._isSmallInitialization (cognitive 21) pkg/js_ast/lib/src/printer.dart:889— Printer._isSmallInitialization has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 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.
IntersectionType.IntersectionType (cognitive 21) pkg/kernel/lib/src/ast/types.dart:2050— IntersectionType.IntersectionType has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 21. 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.
_ConstructorChecker.check (cognitive 21) pkg/linter/lib/src/rules/prefer_initializing_formals.dart:79— _ConstructorChecker.check has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (6 pts) (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.
DebuggerLocation._lookupScript (cognitive 21) pkg/observatory/lib/src/debugger/debugger_location.dart:144— DebuggerLocation._lookupScript has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (4 pts), ternaries 1 (3 pts) (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.
DebuggerLocation._lookupClass (cognitive 21) pkg/observatory/lib/src/debugger/debugger_location.dart:199— DebuggerLocation._lookupClass has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (6 pts) (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.
ScriptInsetElement.lineBreakpointElement (cognitive 21) pkg/observatory/lib/src/elements/script_inset.dart:831— ScriptInsetElement.lineBreakpointElement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2 (4 pts), boolean chains 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.
Printer.visitLibraryDependency (cognitive 21) pkg/kernel/lib/text/ast_to_text.dart:2218— Printer.visitLibraryDependency has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (5 pts), boolean chains 2, ternaries 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.
TextIterator.skipToEndOfAtom (cognitive 21) pkg/kernel/lib/text/text_reader.dart:48— TextIterator.skipToEndOfAtom has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, 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.
_DeduplicateMixinKey.== (cognitive 21) pkg/vm/lib/transformations/mixin_deduplication.dart:117— _DeduplicateMixinKey.== has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3, ternaries 1 (2 pts) (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.
Join.simplify (cognitive 21) pkg/vm/lib/transformations/type_flow/summary.dart:249— Join.simplify has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts), 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.
_ConstantTreeShaker.collectRemovedFields (cognitive 21) pkg/vm/lib/transformations/type_flow/transformer.dart:2668— _ConstantTreeShaker.collectRemovedFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 3 (7 pts), 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.
AnalyzerConverter._getParametersString (cognitive 21) pkg/analyzer_plugin/lib/utilities/analyzer_converter.dart:252— AnalyzerConverter._getParametersString has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 pts), 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.
InheritedReferenceContributor._addSuggestionsForType (cognitive 21) pkg/analyzer_plugin/lib/utilities/completion/inherited_reference_contributor.dart:93— InheritedReferenceContributor._addSuggestionsForType has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (5 pts) (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.
DevFS._readDevFSFile (cognitive 21) sdk/lib/vmservice/devfs.dart:223— DevFS._readDevFSFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 2 (3 pts) (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.
AstNodeImplGenerator._buildImplClass (cognitive 20) pkg/analyzer/tool/generators/ast_generator.dart:64— AstNodeImplGenerator._buildImplClass has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, loops 1, ternaries 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.
_Visitor._tryFixingPropertyAccess (cognitive 20) pkg/analyzer_utilities/tool/messages/use_new_with_arguments.dart:174— _Visitor._tryFixingPropertyAccess has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts) (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.
BytecodeGenerator._genConditionAndJumpIf (cognitive 20) pkg/dart2bytecode/lib/bytecode_generator.dart:1742— BytecodeGenerator._genConditionAndJumpIf has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (20 pts) (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.
AstCodeGenerator._initializeContextLocals (cognitive 20) pkg/dart2wasm/lib/code_generator.dart:542— AstCodeGenerator._initializeContextLocals has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (2 pts), 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.
ConstantCreator.visitInstantiationConstant (cognitive 20) pkg/dart2wasm/lib/constants.dart:1343— ConstantCreator.visitInstantiationConstant has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 6, boolean chains 1, ternaries 1 (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.
FunctionCollector.getFunction (cognitive 20) pkg/dart2wasm/lib/functions.dart:90— FunctionCollector.getFunction has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts), ternaries 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.
ModuleOutputData.moduleForReference (cognitive 20) pkg/dart2wasm/lib/modules.dart:128— ModuleOutputData.moduleForReference has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DocTestIncrementalCompiler.compileDartDocTestLibrary (cognitive 20) pkg/front_end/tool/dart_doctest_impl.dart:1047— DocTestIncrementalCompiler.compileDartDocTestLibrary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (5 pts), 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.
ClosedWorldClassHierarchy._inheritMembers (cognitive 20) pkg/kernel/lib/class_hierarchy.dart:1741— ClosedWorldClassHierarchy._inheritMembers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 3 (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.
ErrorFormatter.reportFailure (cognitive 20) pkg/kernel/lib/error_formatter.dart:36— ErrorFormatter.reportFailure has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 3 (5 pts) (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.
_VerifyingVisitor.enterScopeProvider (cognitive 20) pkg/kernel/lib/verifier.dart:302— _VerifyingVisitor.enterScopeProvider has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (7 pts), error handling 1 (5 pts) (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.
_SnapshotGraph._eval (cognitive 20) pkg/observatory/lib/object_graph.dart:1331— _SnapshotGraph._eval has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (2 pts) (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.
_Utils._addStatics (cognitive 20) tools/dom/src/native_DOMImplementation.dart:857— _Utils._addStatics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), 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.
_Utils._addInstanceMirrors (cognitive 20) tools/dom/src/native_DOMImplementation.dart:924— _Utils._addInstanceMirrors has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts) (nesting depth added 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.
_HttpProfileData.toJson (cognitive 20) sdk/lib/_http/http_impl.dart:207— _HttpProfileData.toJson has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 1, ternaries 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.
Primitives.parseInt (cognitive 20) sdk/lib/_internal/js_dev_runtime/private/js_helper.dart:73— Primitives.parseInt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 1 (2 pts) (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.
_ChunkedJsonParser.parseString (cognitive 20) sdk/lib/_internal/vm/lib/convert_patch.dart:1044— _ChunkedJsonParser.parseString has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (2 pts), 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.
_Utf8Decoder.decode8 (cognitive 20) sdk/lib/_internal/vm/lib/convert_patch.dart:2012— _Utf8Decoder.decode8 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 1, ternaries 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.
_GrowableList.join (cognitive 20) sdk/lib/_internal/vm/lib/growable_array.dart:433— _GrowableList.join has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (7 pts) (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.
int._tryParseSmi (cognitive 20) sdk/lib/_internal/vm_shared/lib/integers_patch.dart:21— int._tryParseSmi has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1, ternaries 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.
GrowableList.addAll (cognitive 20) sdk/lib/_internal/wasm/common/list.dart:629— GrowableList.addAll has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts) (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.
String.fromCharCodes (cognitive 20) sdk/lib/_internal/wasm/js_compatibility/string_patch.dart:15— String.fromCharCodes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3, boolean chains 2, ternaries 1 (2 pts) (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.
Arm64CodeGenerator._passArguments (cognitive 20) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:639— Arm64CodeGenerator._passArguments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, loops 1, ternaries 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.
LinearScanRegisterAllocator.advance (cognitive 20) pkg/native_compiler/lib/back_end/register_allocator.dart:574— LinearScanRegisterAllocator.advance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts) (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.
BinaryBuilder.readUriToSource (cognitive 20) pkg/kernel/lib/binary/ast_from_binary.dart:1054— BinaryBuilder.readUriToSource has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (6 pts), boolean chains 2 (nesting depth added 10). 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.
BinaryPrinter.writeUriToSource (cognitive 20) pkg/kernel/lib/binary/ast_to_binary.dart:911— BinaryPrinter.writeUriToSource has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 3 (5 pts), boolean chains 4, ternaries 2 (4 pts) (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.
ListBase.replaceRange (cognitive 20) sdk/lib/collection/list.dart:408— ListBase.replaceRange has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), ternaries 1 (3 pts) (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.
_Utf8EncoderSink.addSlice (cognitive 20) sdk/lib/convert/utf.dart:254— _Utf8EncoderSink.addSlice has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, 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.
_Uri._normalizeRelativePath (cognitive 20) sdk/lib/core/uri.dart:3053— _Uri._normalizeRelativePath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), 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.
_StructuredClone.walk (cognitive 20) sdk/lib/html/html_common/conversions.dart:87— _StructuredClone.walk has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17 (20 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_File.readAsBytesSync (cognitive 20) sdk/lib/io/file_impl.dart:659— _File.readAsBytesSync has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (6 pts) (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.
_Platform.environment (cognitive 20) sdk/lib/io/platform_impl.dart:84— _Platform.environment has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (3 pts), ternaries 1 (3 pts) (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.
_RawSecureSocket._pushAllFilterStages (cognitive 20) sdk/lib/io/secure_socket.dart:1215— _RawSecureSocket._pushAllFilterStages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), 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.
LateVarInitTransformer._shouldApplyTransform (cognitive 20) pkg/vm/lib/modular/transformations/late_var_init_transformer.dart:11— LateVarInitTransformer._shouldApplyTransform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
Simplification.visitComparison (cognitive 20) pkg/cfg/lib/passes/simplification.dart:103— Simplification.visitComparison has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (6 pts), boolean chains 4, match/switch 1 (2 pts) (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.
Parser.parseFormalParametersRest (cognitive 20) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:1931— Parser.parseFormalParametersRest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, 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.
AbstractScanner.tokenizeDirectives (cognitive 20) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:991— AbstractScanner.tokenizeDirectives has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (19 pts), 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.
Utf8BytesScanner.nextCodePoint (cognitive 20) pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart:377— Utf8BytesScanner.nextCodePoint has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Writer._typeAnnotationToText (cognitive 20) pkg/_fe_analyzer_shared/lib/src/testing/metadata_helper.dart:364— Writer._typeAnnotationToText has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
TypeAnalyzer.analyzeListPattern (cognitive 20) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart:1183— TypeAnalyzer.analyzeListPattern has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), 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.
EditArgumentHandler._computeValueCode (cognitive 20) pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart:188— EditArgumentHandler._computeValueCode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MigrationSchedule.plan (cognitive 20) pkg/analysis_server/lib/src/lsp/handlers/custom/migration/migration_schedule.dart:115— MigrationSchedule.plan has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), boolean chains 2, ternaries 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.
KeywordHelper.addClassModifiers (cognitive 20) pkg/analysis_server/lib/src/services/completion/dart/keyword_helper.dart:86— KeywordHelper.addClassModifiers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 8 (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.
AddDiagnosticPropertyReference._getPropertyInfo (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart:345— AddDiagnosticPropertyReference._getPropertyInfo has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AddTypeAnnotation.compute (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart:55— AddTypeAnnotation.compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConvertIntoBlockBody._computeSetLiteral (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/convert_into_block_body.dart:129— ConvertIntoBlockBody._computeSetLiteral has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (3 pts), ternaries 1 (3 pts), 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.
ConvertToSwitchExpression._convertAssignmentSwitchExpression (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:181— ConvertToSwitchExpression._convertAssignmentSwitchExpression has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (7 pts), loops 2, match/switch 1 (2 pts) (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.
_CreateConstructor._computeWithSuperParameters (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/create_constructor_super.dart:186— _CreateConstructor._computeWithSuperParameters has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RemoveAbstract._compute (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/remove_abstract.dart:52— RemoveAbstract._compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), 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.
RemoveArgument.compute (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/remove_argument.dart:30— RemoveArgument.compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 2 (4 pts) (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.
RemoveInitializer.compute (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart:42— RemoveInitializer.compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RenameToCamelCase.compute (cognitive 20) pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart:35— RenameToCamelCase.compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1, 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.
ElementDescriptor._matchesConstructor (cognitive 20) pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart:80— ElementDescriptor._matchesConstructor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
_ParametersCollector.visitSimpleIdentifier (cognitive 20) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:662— _ParametersCollector.visitSimpleIdentifier has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (19 pts), 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.
_ReferenceFinder._getPrefixFromExpression (cognitive 20) pkg/analysis_server/lib/src/utilities/import_analyzer.dart:399— _ReferenceFinder._getPrefixFromExpression has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (20 pts) (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.
FixInFileProcessor.compute (cognitive 20) pkg/analysis_server_plugin/lib/src/correction/fix_in_file_processor.dart:28— FixInFileProcessor.compute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), 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.
FileState.serializeAstUnlinked2 (cognitive 20) pkg/analyzer/lib/src/dart/analysis/file_state.dart:959— FileState.serializeAstUnlinked2 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), match/switch 2 (4 pts) (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.
LibraryAnalyzer._resolvePartDirective (cognitive 20) pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart:984— LibraryAnalyzer._resolvePartDirective has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 2 (4 pts) (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.
ClassDeclarationImpl.visitChildrenWithHooks (cognitive 20) pkg/analyzer/lib/src/dart/ast/ast.dart:7998— ClassDeclarationImpl.visitChildrenWithHooks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (20 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
StringLexemeHelper._trimInitialWhitespace (cognitive 20) pkg/analyzer/lib/src/dart/ast/ast.dart:52453— StringLexemeHelper._trimInitialWhitespace has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, 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.
ConstantVerifier._validatePrimaryFieldInitializers (cognitive 20) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:979— ConstantVerifier._validatePrimaryFieldInitializers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 pts), 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.
_ConstLiteralVerifier._reportNotPotentialConstants (cognitive 20) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1354— _ConstLiteralVerifier._reportNotPotentialConstants has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 pts) (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.
ReplacementVisitor.visitFunctionTypeBuilder (cognitive 20) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:272— ReplacementVisitor.visitFunctionTypeBuilder has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts), 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.
PropertyElementResolver.resolveIndexExpression (cognitive 20) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:505— PropertyElementResolver.resolveIndexExpression has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PropertyElementResolver.resolveReceiverPropertyDirectAssignmentTarget (cognitive 20) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:866— PropertyElementResolver.resolveReceiverPropertyDirectAssignmentTarget has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
RecordLiteralResolver._reportInvalidFieldNames (cognitive 20) pkg/analyzer/lib/src/dart/resolver/record_literal_resolver.dart:100— RecordLiteralResolver._reportInvalidFieldNames has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NullSafetyDeadCodeVerifier._verifyUnassignedSimpleIdentifier (cognitive 20) pkg/analyzer/lib/src/error/dead_code_verifier.dart:474— NullSafetyDeadCodeVerifier._verifyUnassignedSimpleIdentifier has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), loops 1 (3 pts), match/switch 1 (nesting depth added 3). 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.
ElementUsageDetector.formalParameter (cognitive 20) pkg/analyzer/lib/src/error/element_usage_detector.dart:267— ElementUsageDetector.formalParameter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (ElementUsageDetectorV2.formalParameter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ElementUsageDetectorV2.formalParameter (cognitive 20) pkg/analyzer/lib/src/error/element_usage_detector.dart:809— ElementUsageDetectorV2.formalParameter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (ElementUsageDetector.formalParameter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
MemberDuplicateDefinitionVerifier._checkEnumStatic (cognitive 20) pkg/analyzer/lib/src/error/member_duplicate_definition_verifier.dart:422— MemberDuplicateDefinitionVerifier._checkEnumStatic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 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.
TypeArgumentsVerifier.checkConstructorTearOff (cognitive 20) pkg/analyzer/lib/src/error/type_arguments_verifier.dart:63— TypeArgumentsVerifier.checkConstructorTearOff has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 3, ternaries 1 (3 pts) (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.
LibraryManifestBuilder._fillItemMapFromInputManifests (cognitive 20) pkg/analyzer/lib/src/fine/library_manifest.dart:1467— LibraryManifestBuilder._fillItemMapFromInputManifests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 3 (5 pts) (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.
ErrorVerifier._checkForInstanceAccessToStaticMember (cognitive 20) pkg/analyzer/lib/src/generated/error_verifier.dart:6063— ErrorVerifier._checkForInstanceAccessToStaticMember has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), 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.
AnalyzerSealedClassOperations.getSubclassAsInstanceOf (cognitive 20) pkg/analyzer/lib/src/generated/exhaustiveness.dart:160— AnalyzerSealedClassOperations.getSubclassAsInstanceOf has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 pts), 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.
ResolverVisitor.resolveForWrite (cognitive 20) pkg/analyzer/lib/src/generated/resolver.dart:1566— ResolverVisitor.resolveForWrite has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 1 (2 pts), 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.
_FieldPromotability._handleMembers (cognitive 20) pkg/analyzer/lib/src/summary2/library_builder.dart:914— _FieldPromotability._handleMembers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, 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.
PackageConfigWorkspace.findPackageFor (cognitive 20) pkg/analyzer/lib/src/workspace/pub.dart:319— PackageConfigWorkspace.findPackageFor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (10 pts) (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.
AnalysisStats.print (cognitive 20) pkg/analyzer_cli/lib/src/error_formatter.dart:54— AnalysisStats.print has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 1 (3 pts), 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.
HumanErrorFormatter.flush (cognitive 20) pkg/analyzer_cli/lib/src/error_formatter.dart:241— HumanErrorFormatter.flush has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), ternaries 1 (2 pts), 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.
AnalysisOptionLinkComputer.findLinks (cognitive 20) pkg/analyzer_plugin/lib/src/utilities/navigation/document_links.dart:26— AnalysisOptionLinkComputer.findLinks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), match/switch 3 (7 pts), loops 2, error handling 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.
DiagnosticReporter._reportDiagnosticInternal (cognitive 20) pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart:124— DiagnosticReporter._reportDiagnosticInternal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, match/switch 1 (2 pts) (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.
_DartTypeToStringVisitor.visitFunctionType (cognitive 20) pkg/compiler/lib/src/elements/types.dart:1638— _DartTypeToStringVisitor.visitFunctionType has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 6 (9 pts), boolean chains 1 (nesting depth added 8). 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.
ClosureTracerVisitor.visitDynamicCallSiteTypeInformation (cognitive 20) pkg/compiler/lib/src/inferrer/closure_tracer.dart:126— ClosureTracerVisitor.visitDynamicCallSiteTypeInformation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InferrerEngine._isFieldInitializerPotentiallyNull (cognitive 20) pkg/compiler/lib/src/inferrer/engine.dart:769— InferrerEngine._isFieldInitializerPotentiallyNull has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, if/else 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.
UnionTypeMask._nonEmptyIntersection (cognitive 20) pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart:237— UnionTypeMask._nonEmptyIntersection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (5 pts) (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.
FragmentEmitter.emitInheritance (cognitive 20) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:1215— FragmentEmitter.emitInheritance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 4 (6 pts), ternaries 2 (5 pts), 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.
KernelSsaGraphBuilder.visitDoStatement (cognitive 20) pkg/compiler/lib/src/ssa/builder.dart:3046— KernelSsaGraphBuilder.visitDoStatement has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), 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.
SsaCodeGenerator.visitBoundsCheck (cognitive 20) pkg/compiler/lib/src/ssa/codegen.dart:3370— SsaCodeGenerator.visitBoundsCheck has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SsaLateFieldOptimizer.visitLateReadCheck (cognitive 20) pkg/compiler/lib/src/ssa/late_field_optimizer.dart:58— SsaLateFieldOptimizer.visitLateReadCheck has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (8 pts), 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.
SsaInstructionSimplifier.visitGetLength (cognitive 20) pkg/compiler/lib/src/ssa/optimize.dart:1860— SsaInstructionSimplifier.visitGetLength has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (2 pts), 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.
SsaDeadCodeEliminator.updateEmptyRegions (cognitive 20) pkg/compiler/lib/src/ssa/optimize.dart:3394— SsaDeadCodeEliminator.updateEmptyRegions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, loops 1 (2 pts) (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.
SsaDeadPhiEliminator.visitGraph (cognitive 20) pkg/compiler/lib/src/ssa/optimize.dart:3590— SsaDeadPhiEliminator.visitGraph has cognitive complexity 20 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 3 (8 pts), boolean chains 1 (nesting depth added 8). 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.
MemorySet.findCommonInstruction (cognitive 20) pkg/compiler/lib/src/ssa/optimize.dart:5033— MemorySet.findCommonInstruction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 1 (2 pts) (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.
SsaTypePropagator.visitInvokeDynamic (cognitive 20) pkg/compiler/lib/src/ssa/types_propagation.dart:414— SsaTypePropagator.visitInvokeDynamic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NoSuchMethodDecoderBase._expandCallSignature (cognitive 20) pkg/dart2js_tools/lib/src/name_decoder.dart:122— NoSuchMethodDecoderBase._expandCallSignature has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 2 (4 pts), 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.
ExecutableCompiler.parseDepfile (cognitive 20) pkg/dartdev/lib/src/executable_compiler.dart:84— ExecutableCompiler.parseDepfile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), 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.
BazelUriConverter.uriToPath (cognitive 20) pkg/dds/lib/src/bazel_uri_converter.dart:38— BazelUriConverter.uriToPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 pts), 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.
_TypeRecipeVisitor.visitFunctionType (cognitive 20) pkg/dev_compiler/lib/src/kernel/type_recipe_generator.dart:396— _TypeRecipeVisitor.visitFunctionType has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (6 pts), ternaries 1 (3 pts) (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.
ParsedType.== (cognitive 20) pkg/front_end/lib/src/api_prototype/expression_compilation_tools.dart:220— ParsedType.== has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 2 (4 pts) (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.
IncrementalSerializer.writePackagesToSinkAndTrimComponent (cognitive 20) pkg/front_end/lib/src/base/incremental_serializer.dart:85— IncrementalSerializer.writePackagesToSinkAndTrimComponent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 6 (8 pts) (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.
DillExportNameSpace.patchUpScope (cognitive 20) pkg/front_end/lib/src/base/name_space.dart:271— DillExportNameSpace.patchUpScope has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (2 pts), 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.
ProcessedOptions.validateOptions (cognitive 20) pkg/front_end/lib/src/base/processed_options.dart:395— ProcessedOptions.validateOptions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 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.
FactoryEncoding.buildOutlineNodes (cognitive 20) pkg/front_end/lib/src/fragment/factory/encoding.dart:93— FactoryEncoding.buildOutlineNodes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (7 pts), boolean chains 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.
BodyBuilderImpl.endBinaryPattern (cognitive 20) pkg/front_end/lib/src/kernel/body_builder.dart:3134— BodyBuilderImpl.endBinaryPattern has cognitive complexity 20 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (7 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
BodyBuilderImpl.handleCatchBlock (cognitive 20) pkg/front_end/lib/src/kernel/body_builder.dart:6548— BodyBuilderImpl.handleCatchBlock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 1 (4 pts) (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.
ConstantEvaluator.visitConstructorInvocation (cognitive 20) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3533— ConstantEvaluator.visitConstructorInvocation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ConstantEvaluator.visitStringConcatenation (cognitive 20) pkg/front_end/lib/src/kernel/constant_evaluator.dart:5044— ConstantEvaluator.visitStringConcatenation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), 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.
Covariance.merge (cognitive 20) pkg/front_end/lib/src/kernel/member_covariance.dart:228— Covariance.merge has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, loops 3 (6 pts), boolean chains 3 (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.
BuilderFactory._createMethodBuilder (cognitive 20) pkg/front_end/lib/src/source/builder_factory.dart:966— BuilderFactory._createMethodBuilder has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (5 pts), boolean chains 4, ternaries 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.
OutlineBuilder.endMixinDeclaration (cognitive 20) pkg/front_end/lib/src/source/outline_builder.dart:1519— OutlineBuilder.endMixinDeclaration has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (6 pts) (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.
OutlineBuilder.endTypeVariable (cognitive 20) pkg/front_end/lib/src/source/outline_builder.dart:4413— OutlineBuilder.endTypeVariable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (20 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceClassBuilder.build (cognitive 20) pkg/front_end/lib/src/source/source_class_builder.dart:485— SourceClassBuilder.build has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 1 (2 pts), ternaries 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.
_AsyncContext._checkValidReturn (cognitive 20) pkg/front_end/lib/src/type_inference/body_inference_context.dart:534— _AsyncContext._checkValidReturn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9 (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.
InferenceVisitorImpl.visitAnonymousMethodExpression (cognitive 20) pkg/front_end/lib/src/type_inference/inference_visitor.dart:9166— InferenceVisitorImpl.visitAnonymousMethodExpression has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceVisitorImpl._inferInternalVariableDeclaration (cognitive 20) pkg/front_end/lib/src/type_inference/inference_visitor.dart:14303— InferenceVisitorImpl._inferInternalVariableDeclaration has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, ternaries 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.
IntersectionType.nullability (cognitive 20) pkg/kernel/lib/src/ast/types.dart:2171— IntersectionType.nullability has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, match/switch 1. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
DartTypeEquivalence.visitRecordType (cognitive 20) pkg/kernel/lib/src/dart_type_equivalence.dart:118— DartTypeEquivalence.visitRecordType has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), 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.
_Visitor.visitVariableDeclarationList (cognitive 20) pkg/linter/lib/src/rules/always_specify_types.dart:177— _Visitor.visitVariableDeclarationList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (19 pts), 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.
_Visitor._problemsForAnalyzerPublicApi (cognitive 20) pkg/linter/lib/src/rules/analyzer_public_api.dart:362— _Visitor._problemsForAnalyzerPublicApi has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (6 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
_Visitor._checkConstant (cognitive 20) pkg/linter/lib/src/rules/prefer_contains.dart:73— _Visitor._checkConstant has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8 (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.
_Visitor.visitCompilationUnit (cognitive 20) pkg/linter/lib/src/rules/public_member_api_docs.dart:130— _Visitor.visitCompilationUnit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 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.
_Visitor._checkMembers (cognitive 20) pkg/linter/lib/src/rules/use_primary_constructors.dart:66— _Visitor._checkMembers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_Visitor.check (cognitive 20) pkg/linter/lib/src/rules/use_super_parameters.dart:72— _Visitor.check has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, 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.
_LineNumberContentType.validate (cognitive 20) pkg/native_stack_traces/lib/src/dwarf.dart:1070— _LineNumberContentType.validate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
ObservatoryDebugger.onEvent (cognitive 20) pkg/observatory/lib/src/elements/debugger.dart:1740— ObservatoryDebugger.onEvent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
HeapSnapshotElement._createReport (cognitive 20) pkg/observatory/lib/src/elements/heap_snapshot.dart:670— HeapSnapshotElement._createReport has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1, ternaries 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.
ScriptInsetElement.linesTable (cognitive 20) pkg/observatory/lib/src/elements/script_inset.dart:701— ScriptInsetElement.linesTable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (6 pts), boolean chains 1, ternaries 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.
Histogram.printCounts (cognitive 20) pkg/scrape/lib/src/histogram.dart:42— Histogram.printCounts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 2 (3 pts), 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.
ImportSection.deserialize (cognitive 20) pkg/wasm_builder/lib/src/serialize/sections.dart:158— ImportSection.deserialize has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 2 (8 pts), if/else 3 (6 pts), match/switch 1 (3 pts), loops 1 (2 pts), 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.
SmartConsole.smartReadLine (cognitive 20) runtime/tools/heapsnapshot/lib/src/console.dart:36— SmartConsole.smartReadLine has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), match/switch 1 (3 pts), 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.
_ImplicitUsesAnnotator.annotateDispatchTargets (cognitive 20) pkg/vm/lib/transformations/dynamic_interface_annotator.dart:532— _ImplicitUsesAnnotator.annotateDispatchTargets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 5 (10 pts) (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.
_DeduplicateMixinsTransformer._correctForwardingConstructors (cognitive 20) pkg/vm/lib/transformations/mixin_deduplication.dart:289— _DeduplicateMixinsTransformer._correctForwardingConstructors has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (7 pts), 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.
_DirectInvocation._processField (cognitive 20) pkg/vm/lib/transformations/type_flow/analysis.dart:313— _DirectInvocation._processField has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 4 (7 pts), boolean chains 3, 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.
PragmaEntryPointsVisitor.visitField (cognitive 20) pkg/vm/lib/transformations/type_flow/native_code.dart:265— PragmaEntryPointsVisitor.visitField has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1, ternaries 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.
BinaryOperation.apply (cognitive 20) pkg/vm/lib/transformations/type_flow/summary.dart:910— BinaryOperation.apply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 pts), 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.
TypesBuilder.fromStaticType (cognitive 20) pkg/vm/lib/transformations/type_flow/types.dart:232— TypesBuilder.fromStaticType has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
HtmlDartGenerator.AddSecondaryMembers (cognitive 20) tools/dom/scripts/htmldartgenerator.py:123— HtmlDartGenerator.AddSecondaryMembers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (5 pts) (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.
graphexplorer.Graph.forestEval (cognitive 20) runtime/tools/graphexplorer/graphexplorer.js:654— graphexplorer.Graph.forestEval has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (2 pts) (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.
graphexplorer.Graph.computeOwnedSizes (cognitive 20) runtime/tools/graphexplorer/graphexplorer.js:702— graphexplorer.Graph.computeOwnedSizes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts), 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.
CompletionResult._getElement (cognitive 19) pkg/analysis_server/tool/code_completion/completion_metrics.dart:1771— CompletionResult._getElement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (2 pts), 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.
LogEntry.from (cognitive 19) pkg/analysis_server/tool/instrumentation/log/log.dart:573— LogEntry.from has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16 (18 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_FlatBufferSchemaGenerator.generate (cognitive 19) pkg/analyzer/tool/summary/generate.dart:872— _FlatBufferSchemaGenerator.generate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts), ternaries 1 (3 pts) (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.
_AwaitTransformer.visitForStatement (cognitive 19) pkg/dart2wasm/lib/await_transformer.dart:243— _AwaitTransformer.visitForStatement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 3 (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.
_ConstantAccessor._constantName (cognitive 19) pkg/dart2wasm/lib/constants.dart:2280— _ConstantAccessor._constantName has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, ternaries 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.
DryRunSummarizer._lintChecks (cognitive 19) pkg/dart2wasm/lib/dry_run.dart:197— DryRunSummarizer._lintChecks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (8 pts) (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.
ParameterInfo.merge (cognitive 19) pkg/dart2wasm/lib/param_info.dart:143— ParameterInfo.merge has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 pts), 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.
_ClosureDynamicEntryGenerator.generate (cognitive 19) pkg/dart2wasm/lib/translator.dart:2955— _ClosureDynamicEntryGenerator.generate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4, boolean chains 1, ternaries 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.
Expect._escapeSubstring (cognitive 19) pkg/expect/lib/expect.dart:81— Expect._escapeSubstring has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), 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.
Expect.stringEquals (cognitive 19) pkg/expect/lib/expect.dart:490— Expect.stringEquals has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 2, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BenchMaker.visitFunctionType (cognitive 19) pkg/front_end/tool/bench_maker.dart:445— BenchMaker.visitFunctionType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts) (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.
AstIndexerAndIgnoreCollector._hasIgnoreComment (cognitive 19) pkg/front_end/tool/coverage_merger.dart:914— AstIndexerAndIgnoreCollector._hasIgnoreComment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (8 pts), 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.
MyLaunchingVMServiceHelper.run (cognitive 19) pkg/front_end/tool/coverage_runner.dart:44— MyLaunchingVMServiceHelper.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (5 pts), loops 2 (5 pts) (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.
ClassHierarchyExtensionTypeMixin.getExtensionTypeDeclarationAsInstanceOfClass (cognitive 19) pkg/kernel/lib/class_hierarchy.dart:232— ClassHierarchyExtensionTypeMixin.getExtensionTypeDeclarationAsInstanceOfClass has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (18 pts), 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.
TypeCheckingVisitor.getReceiverType (cognitive 19) pkg/kernel/lib/type_checker.dart:319— TypeCheckingVisitor.getReceiverType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7 (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.
Step.parse (cognitive 19) pkg/smith/lib/builder.dart:44— Step.parse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), boolean chains 1, ternaries 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.
Method.generateDefinition (cognitive 19) pkg/vm_service/tool/dart/generate_dart_common.dart:281— Method.generateDefinition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LinkedMap.remove (cognitive 19) sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart:246— LinkedMap.remove has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (2 pts), ternaries 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.
HashMap.HashMap (cognitive 19) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:25— HashMap.HashMap has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), 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. This shape REPEATS in the file: 3 other methods here (LinkedHashMap.LinkedHashMap, HashSet.HashSet, LinkedHashSet.LinkedHashSet) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LinkedHashMap.LinkedHashMap (cognitive 19) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:506— LinkedHashMap.LinkedHashMap has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), 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. This shape REPEATS in the file: 3 other methods here (HashMap.HashMap, HashSet.HashSet, LinkedHashSet.LinkedHashSet) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HashSet.HashSet (cognitive 19) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:608— HashSet.HashSet has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), 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. This shape REPEATS in the file: 3 other methods here (HashMap.HashMap, LinkedHashMap.LinkedHashMap, LinkedHashSet.LinkedHashSet) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LinkedHashSet.LinkedHashSet (cognitive 19) sdk/lib/_internal/js_runtime/lib/collection_patch.dart:1024— LinkedHashSet.LinkedHashSet has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), 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. This shape REPEATS in the file: 3 other methods here (HashMap.HashMap, LinkedHashMap.LinkedHashMap, HashSet.HashSet) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_List.setRange (cognitive 19) sdk/lib/_internal/vm/lib/array.dart:196— _List.setRange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), boolean chains 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.
_Utf8Decoder.decode16 (cognitive 19) sdk/lib/_internal/vm/lib/convert_patch.dart:2064— _Utf8Decoder.decode16 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 1, ternaries 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.
_StringBase._createStringFromIterable (cognitive 19) sdk/lib/_internal/vm/lib/string_patch.dart:198— _StringBase._createStringFromIterable has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2, ternaries 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.
_TypedIntListMixin._slowSetRange (cognitive 19) sdk/lib/_internal/vm/lib/typed_data_patch.dart:515— _TypedIntListMixin._slowSetRange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (6 pts) (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. This shape REPEATS in the file: 4 other methods here (_TypedDoubleListMixin._slowSetRange, _Float32x4ListMixin._slowSetRange, _Int32x4ListMixin._slowSetRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_TypedDoubleListMixin._slowSetRange (cognitive 19) sdk/lib/_internal/vm/lib/typed_data_patch.dart:858— _TypedDoubleListMixin._slowSetRange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (6 pts) (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. This shape REPEATS in the file: 4 other methods here (_TypedIntListMixin._slowSetRange, _Float32x4ListMixin._slowSetRange, _Int32x4ListMixin._slowSetRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_Float32x4ListMixin._slowSetRange (cognitive 19) sdk/lib/_internal/vm/lib/typed_data_patch.dart:976— _Float32x4ListMixin._slowSetRange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (6 pts) (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. This shape REPEATS in the file: 4 other methods here (_TypedIntListMixin._slowSetRange, _TypedDoubleListMixin._slowSetRange, _Int32x4ListMixin._slowSetRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_Int32x4ListMixin._slowSetRange (cognitive 19) sdk/lib/_internal/vm/lib/typed_data_patch.dart:1319— _Int32x4ListMixin._slowSetRange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (6 pts) (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. This shape REPEATS in the file: 4 other methods here (_TypedIntListMixin._slowSetRange, _TypedDoubleListMixin._slowSetRange, _Float32x4ListMixin._slowSetRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_Float64x2ListMixin._slowSetRange (cognitive 19) sdk/lib/_internal/vm/lib/typed_data_patch.dart:1662— _Float64x2ListMixin._slowSetRange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (6 pts) (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. This shape REPEATS in the file: 4 other methods here (_TypedIntListMixin._slowSetRange, _TypedDoubleListMixin._slowSetRange, _Float32x4ListMixin._slowSetRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_BigIntImpl.toString (cognitive 19) sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2600— _BigIntImpl.toString has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 1, ternaries 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.
Arm64CodeGenerator._prepareOptionalPositionalParameters (cognitive 19) pkg/native_compiler/lib/back_end/arm64/code_generator.dart:97— Arm64CodeGenerator._prepareOptionalPositionalParameters has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (5 pts), loops 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.
RegisterAllocationChecker._updateInState (cognitive 19) pkg/native_compiler/lib/back_end/regalloc_checker.dart:209— RegisterAllocationChecker._updateInState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts) (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.
LineInfo.getOffsetForLine (cognitive 19) pkg/analyzer/lib/source/line_info.dart:140— LineInfo.getOffsetForLine has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 pts), 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.
RecordFieldDeclarationIdentifierContext.ensureIdentifier (cognitive 19) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:629— RecordFieldDeclarationIdentifierContext.ensureIdentifier has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (6 pts) (nesting depth added 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.
ModifierContext._parseModifiers (cognitive 19) pkg/_fe_analyzer_shared/lib/src/parser/modifier_context.dart:340— ModifierContext._parseModifiers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Writer._formalParametersToText (cognitive 19) pkg/_fe_analyzer_shared/lib/src/testing/metadata_helper.dart:442— Writer._formalParametersToText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, 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.
TypeConstraintGenerator.performSubtypeConstraintGenerationForRightNullableType (cognitive 19) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:2022— TypeConstraintGenerator.performSubtypeConstraintGenerationForRightNullableType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 pts), 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.
CheckNameResponse._getInterpolationIdentifier (cognitive 19) pkg/analysis_server/lib/src/cider/rename.dart:323— CheckNameResponse._getInterpolationIdentifier has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), 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.
ContextManagerImpl._computePluginConflicts (cognitive 19) pkg/analysis_server/lib/src/context_manager.dart:606— ContextManagerImpl._computePluginConflicts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 5 (9 pts) (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.
MigrationSummaryBuilder._writeVersionMigrationSummary (cognitive 19) pkg/analysis_server/lib/src/lsp/handlers/custom/migration/migration_summary_builder.dart:110— MigrationSummaryBuilder._writeVersionMigrationSummary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (4 pts), loops 1 (2 pts), 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.
DeclarationHelper.addLexicalDeclarations (cognitive 19) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:440— DeclarationHelper.addLexicalDeclarations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, match/switch 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DeclarationHelper._suggestClass (cognitive 19) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2036— DeclarationHelper._suggestClass has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5 (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.
_ContextTypeVisitor.visitRecordLiteral (cognitive 19) pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart:1097— _ContextTypeVisitor.visitRecordLiteral has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (18 pts), 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.
InScopeCompletionPass.visitIfElement (cognitive 19) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1768— InScopeCompletionPass.visitIfElement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (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.
ConvertClassToMixin.compute (cognitive 19) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart:26— ConvertClassToMixin.compute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConvertFieldFormalToNormal.compute (cognitive 19) pkg/analysis_server/lib/src/services/correction/dart/convert_field_formal_to_normal.dart:25— ConvertFieldFormalToNormal.compute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConvertToIfNull._preferIfNull (cognitive 19) pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart:53— ConvertToIfNull._preferIfNull has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
CreateEnumConstant.compute (cognitive 19) pkg/analysis_server/lib/src/services/correction/dart/create_enum_constant.dart:32— CreateEnumConstant.compute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ReplaceIfElseWithConditional.compute (cognitive 19) pkg/analysis_server/lib/src/services/correction/dart/replace_if_else_with_conditional.dart:25— ReplaceIfElseWithConditional.compute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), 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.
WrapInUnawaited.compute (cognitive 19) pkg/analysis_server/lib/src/services/correction/dart/wrap_in_unawaited.dart:26— WrapInUnawaited.compute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (3 pts), boolean chains 1, ternaries 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.
CodeFragmentParser._parseAccessor (cognitive 19) pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart:179— CodeFragmentParser._parseAccessor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (19 pts) (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.
LegacyPluginsPage.generateContent (cognitive 19) pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart:26— LegacyPluginsPage.generateContent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), match/switch 1 (2 pts) (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.
PluginServer._computeEffectiveIncludedPaths (cognitive 19) pkg/analysis_server_plugin/lib/src/plugin_server.dart:835— PluginServer._computeEffectiveIncludedPaths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (6 pts), 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.
_ContextLocator._contextRootLocation (cognitive 19) pkg/analyzer/lib/src/dart/analysis/context_locator.dart:184— _ContextLocator._contextRootLocation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (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.
_ContextLocator._sortIncludedFoldersIntoWorkspaceResolutions (cognitive 19) pkg/analyzer/lib/src/dart/analysis/context_locator.dart:893— _ContextLocator._sortIncludedFoldersIntoWorkspaceResolutions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BinaryExpressionResolver._resolveEqual (cognitive 19) pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart:176— BinaryExpressionResolver._resolveEqual has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ExtensionMemberResolver._isValidContext (cognitive 19) pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart:527— ExtensionMemberResolver._isValidContext has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 18, if/else 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.
_AssignedVariablesVisitor._handleFor (cognitive 19) pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart:1381— _AssignedVariablesVisitor._handleFor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1 (3 pts) (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.
AnnotationVerifier._checkReopen (cognitive 19) pkg/analyzer/lib/src/error/annotation_verifier.dart:452— AnnotationVerifier._checkReopen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TodoFinder._scrapeTodoComment (cognitive 19) pkg/analyzer/lib/src/error/todo_finder.dart:63— TodoFinder._scrapeTodoComment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, loops 2 (4 pts) (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.
ErrorVerifier._checkForBadFunctionUse (cognitive 19) pkg/analyzer/lib/src/generated/error_verifier.dart:3816— ErrorVerifier._checkForBadFunctionUse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), 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.
FfiVerifier.visitCascadePropertyExtraction (cognitive 19) pkg/analyzer/lib/src/generated/ffi_verifier.dart:225— FfiVerifier.visitCascadePropertyExtraction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FfiVerifier._validateAddressReceiver (cognitive 19) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1403— FfiVerifier._validateAddressReceiver has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), 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.
FfiVerifier._validateAnnotations (cognitive 19) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1496— FfiVerifier._validateAnnotations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), 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.
ElementBuilder._linkTypeParameters (cognitive 19) pkg/analyzer/lib/src/summary2/element_builder.dart:1165— ElementBuilder._linkTypeParameters has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (8 pts), 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.
CommandLineOptions.filterUnknownArguments (cognitive 19) pkg/analyzer_cli/lib/src/options.dart:174— CommandLineOptions.filterUnknownArguments has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, 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.
TracerVisitor.analyzeStoredIntoRecord (cognitive 19) pkg/compiler/lib/src/inferrer/node_tracer.dart:359— TracerVisitor.analyzeStoredIntoRecord has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts), boolean chains 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.
FragmentEmitter.emitLazilyInitializedStatics (cognitive 19) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:1748— FragmentEmitter.emitLazilyInitializedStatics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ModelEmitter.emitProgram (cognitive 19) pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart:247— ModelEmitter.emitProgram has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 6 (8 pts), boolean chains 2 (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.
JumpVisitor.visitBreakStatement (cognitive 19) pkg/compiler/lib/src/js_model/locals.dart:366— JumpVisitor.visitBreakStatement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), 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.
KernelSsaGraphBuilder._handleForeignRawFunctionRef (cognitive 19) pkg/compiler/lib/src/ssa/builder.dart:5825— KernelSsaGraphBuilder._handleForeignRawFunctionRef has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), 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.
KernelSsaGraphBuilder._invokeJsInteropFunction (cognitive 19) pkg/compiler/lib/src/ssa/builder.dart:7009— KernelSsaGraphBuilder._invokeJsInteropFunction has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (5 pts), ternaries 2 (5 pts), loops 1 (2 pts) (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.
KernelSsaGraphBuilder._completeDynamicCallArgumentsList (cognitive 19) pkg/compiler/lib/src/ssa/builder.dart:8188— KernelSsaGraphBuilder._completeDynamicCallArgumentsList has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (6 pts), 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.
DominatedUses.replaceWith (cognitive 19) pkg/compiler/lib/src/ssa/nodes.dart:1583— DominatedUses.replaceWith has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (9 pts) (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.
SsaDeadCodeEliminator.simplifyPhi (cognitive 19) pkg/compiler/lib/src/ssa/optimize.dart:3286— SsaDeadCodeEliminator.simplifyPhi has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (4 pts) (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.
RecordUseValueConverter.findInstanceValue (cognitive 19) pkg/compiler/lib/src/universe/recorded_use.dart:457— RecordUseValueConverter.findInstanceValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (18 pts), 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.
IsolateManager._handlePause (cognitive 19) pkg/dap_adapters/lib/src/isolate_manager.dart:674— IsolateManager._handlePause has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 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.
LibraryCompiler.emitLibrary (cognitive 19) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:905— LibraryCompiler.emitLibrary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Locations._locationsForModule (cognitive 19) pkg/dwds/lib/src/debugging/location.dart:310— Locations._locationsForModule has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (6 pts), boolean chains 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.
DevHandler._startLocalDebugService (cognitive 19) pkg/dwds/lib/src/handlers/dev_handler.dart:239— DevHandler._startLocalDebugService has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2 (3 pts) (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.
DevHandler._handleMessage (cognitive 19) pkg/dwds/lib/src/handlers/dev_handler.dart:477— DevHandler._handleMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DwdsInjector.middleware (cognitive 19) pkg/dwds/lib/src/handlers/injector.dart:44— DwdsInjector.middleware has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (19 pts) (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.
_ConstructorDeclarationMixin.addSuperParameterDefaultValueCloners (cognitive 19) pkg/front_end/lib/src/fragment/constructor/declaration.dart:543— _ConstructorDeclarationMixin.addSuperParameterDefaultValueCloners has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (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.
FactoryEncoding.checkRedirectingFactory (cognitive 19) pkg/front_end/lib/src/fragment/factory/encoding.dart:567— FactoryEncoding.checkRedirectingFactory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BodyBuilderImpl.handleType (cognitive 19) pkg/front_end/lib/src/kernel/body_builder.dart:8713— BodyBuilderImpl.handleType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (7 pts), match/switch 1 (2 pts) (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.
StatementConstantEvaluator.visitForStatement (cognitive 19) pkg/front_end/lib/src/kernel/constant_evaluator.dart:6259— StatementConstantEvaluator.visitForStatement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 2, ternaries 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.
DartScopeBuilder2.addFound (cognitive 19) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:117— DartScopeBuilder2.addFound has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 7, loops 3 (4 pts) (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.
CfeSealedClassOperations.getSubclassAsInstanceOf (cognitive 19) pkg/front_end/lib/src/kernel/exhaustiveness.dart:523— CfeSealedClassOperations.getSubclassAsInstanceOf has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 pts) (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.
ClassMembersNodeBuilder.inferFieldType (cognitive 19) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:482— ClassMembersNodeBuilder.inferFieldType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (2 pts) (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.
BuilderFactory._createDeclarationFromFragment (cognitive 19) pkg/front_end/lib/src/source/builder_factory.dart:519— BuilderFactory._createDeclarationFromFragment has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 5, if/else 3 (5 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
OutlineBuilder.endConstructor (cognitive 19) pkg/front_end/lib/src/source/outline_builder.dart:2591— OutlineBuilder.endConstructor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SourceEnumBuilder._createSynthesizedMembers (cognitive 19) pkg/front_end/lib/src/source/source_enum_builder.dart:157— SourceEnumBuilder._createSynthesizedMembers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (5 pts), boolean chains 4, ternaries 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.
SourceLibraryBuilder.addImportsToScope (cognitive 19) pkg/front_end/lib/src/source/source_library_builder.dart:631— SourceLibraryBuilder.addImportsToScope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (4 pts), 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.
_SyncContext._checkValidReturn (cognitive 19) pkg/front_end/lib/src/type_inference/body_inference_context.dart:228— _SyncContext._checkValidReturn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8 (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.
InferenceVisitorImpl._buildRedirectingFactoryTargetInvocation (cognitive 19) pkg/front_end/lib/src/type_inference/inference_visitor.dart:2742— InferenceVisitorImpl._buildRedirectingFactoryTargetInvocation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 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.
_Processor._premarkTopLevel (cognitive 19) pkg/front_end/lib/src/util/outline_extractor.dart:233— _Processor._premarkTopLevel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts) (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.
_Processor.findInScope (cognitive 19) pkg/front_end/lib/src/util/outline_extractor.dart:572— _Processor.findInScope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (18 pts), 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.
Printer.out (cognitive 19) pkg/js_ast/lib/src/printer.dart:198— Printer.out has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 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.
RecordType.equals (cognitive 19) pkg/kernel/lib/src/ast/types.dart:2611— RecordType.equals has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts) (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.
_Visitor.visitTypeParameterList (cognitive 19) pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart:77— _Visitor.visitTypeParameterList has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 7, loops 2 (3 pts) (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.
_Visitor.visitCompilationUnit (cognitive 19) pkg/linter/lib/src/rules/lines_longer_than_80_chars.dart:159— _Visitor.visitCompilationUnit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), 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.
_Visitor._checkMethod (cognitive 19) pkg/linter/lib/src/rules/strict_top_level_inference.dart:194— _Visitor._checkMethod has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8 (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.
SearchBarElement.render (cognitive 19) pkg/observatory/lib/src/elements/containers/search_bar.dart:106— SearchBarElement.render has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 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.
ProtobufHandler.beforeSummaryCreation (cognitive 19) pkg/vm/lib/transformations/type_flow/protobuf_handler.dart:128— ProtobufHandler.beforeSummaryCreation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (2 pts) (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.
ClassInfo._initDispatchTargets (cognitive 19) pkg/vm/lib/transformations/type_flow/rta.dart:76— ClassInfo._initDispatchTargets has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 2, ternaries 1 (2 pts) (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.
TFADevirtualization.getDirectCall (cognitive 19) pkg/vm/lib/transformations/type_flow/transformer.dart:358— TFADevirtualization.getDirectCall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Prototype_HtmlEventGenerator._writeEventGetters (cognitive 19) tools/dom/scripts/prototype_htmleventgenerator.py:157— Prototype_HtmlEventGenerator._writeEventGetters has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 2 (5 pts), loops 2 (3 pts) (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.
used_names.analyze (cognitive 19) pkg/compiler/tool/used_names/used_names.js:11— used_names.analyze has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (6 pts) (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.
graphexplorer.Table.refreshRows (cognitive 19) runtime/tools/graphexplorer/graphexplorer.js:1674— graphexplorer.Table.refreshRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts) (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.
RelevanceDataCollector._argumentListContext (cognitive 18) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2170— RelevanceDataCollector._argumentListContext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ExpectedCompletionsVisitor.safelyRecordEntity (cognitive 18) pkg/analysis_server/tool/code_completion/visitors.dart:180— ExpectedCompletionsVisitor.safelyRecordEntity has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AnalysisTester._printStats (cognitive 18) pkg/analysis_server/tool/performance/utilities/analysis_tester.dart:156— AnalysisTester._printStats has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts) (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.
ErrorData.failureMessage (cognitive 18) pkg/analysis_server/tool/presubmit/verify_error_fix_status.dart:165— ErrorData.failureMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4 (8 pts) (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.
AstNodeImplGenerator._generateIsInValueExpressionSlot (cognitive 18) pkg/analyzer/tool/generators/ast_generator.dart:835— AstNodeImplGenerator._generateIsInValueExpressionSlot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 4 (8 pts) (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.
StringSearchUtilGenerator._findMethods (cognitive 18) pkg/analyzer/tool/generators/string_search_util_generator.dart:82— StringSearchUtilGenerator._findMethods has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 pts) (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.
StringSearchUtilGenerator._getAnnotationData (cognitive 18) pkg/analyzer/tool/generators/string_search_util_generator.dart:109— StringSearchUtilGenerator._getAnnotationData has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, 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.
_FunctionTypeHandle.toString (cognitive 18) pkg/dart2bytecode/lib/object_table.dart:979— _FunctionTypeHandle.toString has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (2 pts) (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.
Closures._buildContexts (cognitive 18) pkg/dart2wasm/lib/closures.dart:1540— Closures._buildContexts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4 (6 pts) (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.
ConstantCreator.visitInstanceConstant (cognitive 18) pkg/dart2wasm/lib/constants.dart:932— ConstantCreator.visitInstanceConstant has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 3 (4 pts) (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.
DynamicDispatchTable.build (cognitive 18) pkg/dart2wasm/lib/dynamic_dispatch_table.dart:52— DynamicDispatchTable.build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 5 (6 pts), 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.
FunctionCollector.getFunctionName (cognitive 18) pkg/dart2wasm/lib/functions.dart:337— FunctionCollector.getFunctionName has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WasmTarget.performModularTransformationsOnLibraries (cognitive 18) pkg/dart2wasm/lib/target.dart:299— WasmTarget.performModularTransformationsOnLibraries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 pts), 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.
Types.isTypeConstant (cognitive 18) pkg/dart2wasm/lib/types.dart:121— Types.isTypeConstant has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 18. 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.
C.m (cognitive 18) pkg/front_end/testcases/general/for_in_without_declaration.dart:21— C.m has cognitive complexity 18 (threshold 15). Drivers by points: loops 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.
AstClass.kind (cognitive 18) pkg/front_end/tool/ast_model.dart:299— AstClass.kind has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (18 pts) (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.
_VerifyingVisitor.visitField (cognitive 18) pkg/kernel/lib/verifier.dart:815— _VerifyingVisitor.visitField has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_SnapshotGraph._readObjects (cognitive 18) pkg/observatory/lib/object_graph.dart:969— _SnapshotGraph._readObjects has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (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.
Utils.formatDuration (cognitive 18) pkg/observatory/lib/utils.dart:150— Utils.formatDuration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
_ConnectionTarget.connect (cognitive 18) sdk/lib/_http/http_impl.dart:2653— _ConnectionTarget.connect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_HttpParser._onDone (cognitive 18) sdk/lib/_http/http_parser.dart:970— _HttpParser._onDone has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_WebSocketProtocolTransformer._controlFrameEnd (cognitive 18) sdk/lib/_http/websocket_impl.dart:546— _WebSocketProtocolTransformer._controlFrameEnd has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 3, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
CustomHashMap._set (cognitive 18) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:125— CustomHashMap._set has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 1 (2 pts) (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.
JsonMLFormatter.body (cognitive 18) sdk/lib/_internal/js_dev_runtime/private/debugger.dart:417— JsonMLFormatter.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (3 pts), boolean chains 1, 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.
LinkedSet.remove (cognitive 18) sdk/lib/_internal/js_dev_runtime/private/linked_hash_set.dart:215— LinkedSet.remove has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (2 pts) (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.
Isolate.spawnUri (cognitive 18) sdk/lib/_internal/vm/lib/isolate_patch.dart:432— Isolate.spawnUri has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, error handling 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.
int._parseBlock (cognitive 18) sdk/lib/_internal/vm_shared/lib/integers_patch.dart:271— int._parseBlock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), 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.
_Uri._uriEncode (cognitive 18) sdk/lib/_internal/vm_shared/lib/uri_encode_patch.dart:10— _Uri._uriEncode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 3 (4 pts) (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.
_ChunkedJsonParser.parseStringEscape (cognitive 18) sdk/lib/_internal/wasm/common/convert_patch.dart:1377— _ChunkedJsonParser.parseStringEscape has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts), 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.
CodeGenerator.visitParallelMove (cognitive 18) pkg/native_compiler/lib/back_end/code_generator.dart:347— CodeGenerator.visitParallelMove has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 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.
Object.hash (cognitive 18) sdk/lib/core/object.dart:152— Object.hash has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. 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.
FfiTransformer.convertDartTypeToNativeType (cognitive 18) pkg/vm/lib/modular/transformations/ffi/common.dart:1256— FfiTransformer.convertDartTypeToNativeType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (2 pts) (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.
_FfiDefinitionTransformer.manualVisitInTopologicalOrder (cognitive 18) pkg/vm/lib/modular/transformations/ffi/definitions.dart:185— _FfiDefinitionTransformer.manualVisitInTopologicalOrder has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (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.
PropertyWitness.witnessToDart (cognitive 18) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/witness.dart:90— PropertyWitness.witnessToDart has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (5 pts), 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.
Parser.parseDirectives (cognitive 18) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:467— Parser.parseDirectives has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
ComplexTypeInfo.computeRest (cognitive 18) pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart:1088— ComplexTypeInfo.computeRest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, 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.
CheckNameResponse._addElementDeclaration (cognitive 18) pkg/analysis_server/lib/src/cider/rename.dart:214— CheckNameResponse._addElementDeclaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), 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.
DartUnitHighlightsComputer._isCallMethod (cognitive 18) pkg/analysis_server/lib/src/computer/computer_highlights.dart:677— DartUnitHighlightsComputer._isCallMethod has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 16, match/switch 2. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
DartUnitOutlineComputer.compute (cognitive 18) pkg/analysis_server/lib/src/computer/computer_outline.dart:21— DartUnitOutlineComputer.compute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 3 (7 pts) (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.
ContextManagerImpl._analyzeAnalysisOptionsYamlFiles (cognitive 18) pkg/analysis_server/lib/src/context_manager.dart:392— ContextManagerImpl._analyzeAnalysisOptionsYamlFiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (6 pts), ternaries 1 (3 pts), error handling 1 (2 pts) (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.
MigrateHandler._validateMigrationTargets (cognitive 18) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_migrate.dart:113— MigrateHandler._validateMigrationTargets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 1 (2 pts), 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.
SummaryWriter.summarize (cognitive 18) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_summary.dart:71— SummaryWriter.summarize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), 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.
AddKeyToConstructors._updateSuperInBody (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart:335— AddKeyToConstructors._updateSuperInBody has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), 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.
ChangeTo._proposeField (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/change_to.dart:200— ChangeTo._proposeField has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 2 (4 pts) (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.
ChangeTo._proposeFunction (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/change_to.dart:240— ChangeTo._proposeFunction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), 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.
_EnumDescription._indexFieldData (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart:536— _EnumDescription._indexFieldData has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 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.
EncapsulateField.compute (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart:43— EncapsulateField.compute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, loops 1 (2 pts), match/switch 1, ternaries 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.
FlutterConvertToStatelessWidget._isDefaultOverride (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart:247— FlutterConvertToStatelessWidget._isDefaultOverride has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
FlutterWrap._wrapMultipleWidgets (cognitive 18) pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart:53— FlutterWrap._wrapMultipleWidgets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (2 pts) (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.
PubspecFixGenerator.computeFixes (cognitive 18) pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart:75— PubspecFixGenerator.computeFixes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. 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.
PubspecFixGenerator._sortPubDependencies (cognitive 18) pkg/analysis_server/lib/src/services/correction/fix/pubspec/fix_generator.dart:404— PubspecFixGenerator._sortPubDependencies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4, 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.
ImportOrganizer.getLeadingComment (cognitive 18) pkg/analysis_server/lib/src/services/correction/organize_imports.dart:452— ImportOrganizer.getLeadingComment has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 2, ternaries 1 (2 pts) (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.
_WidgetDescriptionComputer._addContainerProperty (cognitive 18) pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart:167— _WidgetDescriptionComputer._addContainerProperty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6 (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.
_ReferenceProcessor._canInlineBody (cognitive 18) pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart:719— _ReferenceProcessor._canInlineBody has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 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.
RenameClassMemberRefactoringImpl._updateReferences (cognitive 18) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart:173— RenameClassMemberRefactoringImpl._updateReferences has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), 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.
_RenameClassMemberValidator._getLocalShadowingElement (cognitive 18) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart:469— _RenameClassMemberValidator._getLocalShadowingElement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (6 pts), 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.
PluginsPage.generateContent (cognitive 18) pkg/analysis_server/lib/src/status/pages/plugins_page.dart:25— PluginsPage.generateContent has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 4 (7 pts) (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.
ServerBase.outputProcessor (cognitive 18) pkg/analysis_server_client/lib/src/server_base.dart:106— ServerBase.outputProcessor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 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.
AnalysisDriver.performWork (cognitive 18) pkg/analyzer/lib/src/dart/analysis/driver.dart:1182— AnalysisDriver.performWork has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_IndexContributor.recordRelationOffset (cognitive 18) pkg/analyzer/lib/src/dart/analysis/index.dart:576— _IndexContributor.recordRelationOffset has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts) (nesting depth added 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.
LibraryAnalyzer._reportImportDirectiveErrors (cognitive 18) pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart:719— LibraryAnalyzer._reportImportDirectiveErrors has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 7 (8 pts), 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.
_FindLibraryDeclarations._addDeclaration (cognitive 18) pkg/analyzer/lib/src/dart/analysis/search.dart:1548— _FindLibraryDeclarations._addDeclaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ExpressionImpl.computeConstantValue (cognitive 18) pkg/analyzer/lib/src/dart/ast/ast.dart:17991— ExpressionImpl.computeConstantValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (5 pts), 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.
SimpleIdentifierImpl.inGetterContext (cognitive 18) pkg/analyzer/lib/src/dart/ast/ast.dart:51453— SimpleIdentifierImpl.inGetterContext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (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.
StringLexemeHelper.StringLexemeHelper (cognitive 18) pkg/analyzer/lib/src/dart/ast/ast.dart:52415— StringLexemeHelper.StringLexemeHelper has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6 (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.
ConstantEvaluator.visitPrefixExpression (cognitive 18) pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:305— ConstantEvaluator.visitPrefixExpression has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), 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.
ConstantVerifier.visitSetOrMapLiteral (cognitive 18) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:434— ConstantVerifier.visitSetOrMapLiteral has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 4 (6 pts) (nesting depth added 10). 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.
ConstantVerifier.visitVariableDeclaration (cognitive 18) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:527— ConstantVerifier.visitVariableDeclaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
_ConstructorInvocationEvaluator._followConstantRedirectionChain (cognitive 18) pkg/analyzer/lib/src/dart/constant/evaluation.dart:3838— _ConstructorInvocationEvaluator._followConstantRedirectionChain has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
TypeSystemImpl.instantiateTypeFormalsToBounds (cognitive 18) pkg/analyzer/lib/src/dart/element/type_system.dart:762— TypeSystemImpl.instantiateTypeFormalsToBounds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 5 (8 pts) (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.
TypeSystemImpl.isMoreTop (cognitive 18) pkg/analyzer/lib/src/dart/element/type_system.dart:1123— TypeSystemImpl.isMoreTop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 8. 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.
TypeSystemImpl._isNonNullable (cognitive 18) pkg/analyzer/lib/src/dart/element/type_system.dart:1866— TypeSystemImpl._isNonNullable has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5 (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.
AssignmentExpressionResolver.resolveCompound (cognitive 18) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:156— AssignmentExpressionResolver.resolveCompound has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), 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.
AstRewriter.prefixedIdentifier (cognitive 18) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:497— AstRewriter.prefixedIdentifier has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PropertyElementResolver.resolveCascadeProperty (cognitive 18) pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart:180— PropertyElementResolver.resolveCascadeProperty has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 4 (6 pts), match/switch 2 (3 pts), 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.
ResolutionVisitor._resolveType (cognitive 18) pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart:1251— ResolutionVisitor._resolveType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), boolean chains 2, match/switch 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.
SimpleIdentifierResolver._resolve1 (cognitive 18) pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart:113— SimpleIdentifierResolver._resolve1 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MustCallSuperVerifier._findOverriddenMemberWithMustCallSuper (cognitive 18) pkg/analyzer/lib/src/error/must_call_super_verifier.dart:77— MustCallSuperVerifier._findOverriddenMemberWithMustCallSuper has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (4 pts), boolean chains 2, match/switch 1 (2 pts) (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.
GatherUsedLocalElementsVisitor._matchParameters (cognitive 18) pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart:721— GatherUsedLocalElementsVisitor._matchParameters has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts), 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.
AstBuilder.handleIdentifier (cognitive 18) pkg/analyzer/lib/src/fasta/ast_builder.dart:4569— AstBuilder.handleIdentifier has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5 (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.
AstBuilder.handleRecoverDeclarationHeader (cognitive 18) pkg/analyzer/lib/src/fasta/ast_builder.dart:5528— AstBuilder.handleRecoverDeclarationHeader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
AstBuilder._buildConstructorDeclaration (cognitive 18) pkg/analyzer/lib/src/fasta/ast_builder.dart:6039— AstBuilder._buildConstructorDeclaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (2 pts), 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.
DocCommentBuilder._parseDocComment (cognitive 18) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:267— DocCommentBuilder._parseDocComment has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 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.
LibraryManifestBuilder._getInterfaceElementMemberId (cognitive 18) pkg/analyzer/lib/src/fine/library_manifest.dart:1562— LibraryManifestBuilder._getInterfaceElementMemberId has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts) (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.
NonAssignabilityReporterForArgument.createDiagnostic (cognitive 18) pkg/analyzer/lib/src/generated/error_detection_helpers.dart:399— NonAssignabilityReporterForArgument.createDiagnostic has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 1 (3 pts) (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.
ErrorVerifier._checkForConflictingClassTypeVariableErrorCodes (cognitive 18) pkg/analyzer/lib/src/generated/error_verifier.dart:4245— ErrorVerifier._checkForConflictingClassTypeVariableErrorCodes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (6 pts), 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.
FfiVerifier._primitiveNativeType (cognitive 18) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1225— FfiVerifier._primitiveNativeType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (18 pts) (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.
FfiVerifier._validateFromFunction (cognitive 18) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1914— FfiVerifier._validateFromFunction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (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.
ResolverVisitor.visitMethodInvocation (cognitive 18) pkg/analyzer/lib/src/generated/resolver.dart:3973— ResolverVisitor.visitMethodInvocation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
ResolverVisitor._resolveParsedDotShorthandInvocation (cognitive 18) pkg/analyzer/lib/src/generated/resolver.dart:5674— ResolverVisitor._resolveParsedDotShorthandInvocation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3 (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.
SdkLibrariesReader_LibraryBuilder.visitMapLiteralEntry (cognitive 18) pkg/analyzer/lib/src/generated/sdk.dart:193— SdkLibrariesReader_LibraryBuilder.visitMapLiteralEntry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ElementBuilder._linkFormalParameters (cognitive 18) pkg/analyzer/lib/src/summary2/element_builder.dart:1010— ElementBuilder._linkFormalParameters has cognitive complexity 18 (threshold 15). Drivers by points: loops 9 (11 pts), if/else 5 (6 pts), match/switch 1 (nesting depth added 3). 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.
EnclosingTypeParameterReferenceFlag.perform (cognitive 18) pkg/analyzer/lib/src/summary2/enclosing_type_parameters_flag.dart:44— EnclosingTypeParameterReferenceFlag.perform has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 1 (4 pts), match/switch 1 (3 pts) (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.
TypesBuilder._declaration (cognitive 18) pkg/analyzer/lib/src/summary2/types_builder.dart:152— TypesBuilder._declaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. 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.
FuzzyMatcher.score (cognitive 18) pkg/analyzer/lib/src/utilities/fuzzy_matcher.dart:444— FuzzyMatcher.score has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), 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.
_InsertionPreparer.insertionLocation (cognitive 18) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:3632— _InsertionPreparer.insertionLocation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, ternaries 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.
CompletionTarget._computeDroppedToken (cognitive 18) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:651— CompletionTarget._computeDroppedToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 2 (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.
CompletionTarget._getContainingCommentToken (cognitive 18) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:700— CompletionTarget._getContainingCommentToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 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.
_OpTypeAstVisitor.visitSwitchPatternCase (cognitive 18) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:1686— _OpTypeAstVisitor.visitSwitchPatternCase has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 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.
_OpTypeAstVisitor._argumentListContext (cognitive 18) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:1856— _OpTypeAstVisitor._argumentListContext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 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.
ExpectedDiagnostic.matches (cognitive 18) pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart:125— ExpectedDiagnostic.matches has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), 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.
_ExpectedDiagnosticsUpdater._writeContent (cognitive 18) pkg/analyzer_testing/lib/src/expected_diagnostics.dart:293— _ExpectedDiagnosticsUpdater._writeContent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 pts) (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.
KernelTypeGraphBuilder._findLength (cognitive 18) pkg/compiler/lib/src/inferrer/builder.dart:1534— KernelTypeGraphBuilder._findLength has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
ConstantEmitter.visitMap (cognitive 18) pkg/compiler/lib/src/js_backend/constant_emitter.dart:319— ConstantEmitter.visitMap has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, loops 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.
TypeVariableTests._setupDependencies (cognitive 18) pkg/compiler/lib/src/js_backend/runtime_types_resolution.dart:350— TypeVariableTests._setupDependencies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 5 (8 pts) (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.
KClassEnv.convert (cognitive 18) pkg/compiler/lib/src/kernel/env.dart:388— KClassEnv.convert has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1 (2 pts) (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.
KernelSsaGraphBuilder.visitBreakStatement (cognitive 18) pkg/compiler/lib/src/ssa/builder.dart:3454— KernelSsaGraphBuilder.visitBreakStatement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts) (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.
KernelSsaGraphBuilder._setupStateForInlining (cognitive 18) pkg/compiler/lib/src/ssa/builder.dart:8333— KernelSsaGraphBuilder._setupStateForInlining has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineData.cannotBeInlinedReductiveReason (cognitive 18) pkg/compiler/lib/src/ssa/builder.dart:9044— InlineData.cannotBeInlinedReductiveReason has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16 (17 pts), loops 1 (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.
SsaCodeGenerator.visitLabeledBlockInfo (cognitive 18) pkg/compiler/lib/src/ssa/codegen.dart:1280— SsaCodeGenerator.visitLabeledBlockInfo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (6 pts) (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.
SsaCodeGenerator.visitTypeEval (cognitive 18) pkg/compiler/lib/src/ssa/codegen.dart:4131— SsaCodeGenerator.visitTypeEval has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SsaInstructionSelection.visitIf (cognitive 18) pkg/compiler/lib/src/ssa/codegen_helpers.dart:480— SsaInstructionSelection.visitIf has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
SsaSimplifyInterceptors.rewriteSelfInterceptorUses (cognitive 18) pkg/compiler/lib/src/ssa/interceptor_simplifier.dart:391— SsaSimplifyInterceptors.rewriteSelfInterceptorUses has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, 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.
SsaInstructionSimplifier._removeInstructionAndPureDeadInputs (cognitive 18) pkg/compiler/lib/src/ssa/optimize.dart:387— SsaInstructionSimplifier._removeInstructionAndPureDeadInputs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), 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.
SsaInstructionSimplifier.handleIdentityCheck (cognitive 18) pkg/compiler/lib/src/ssa/optimize.dart:1427— SsaInstructionSimplifier.handleIdentityCheck has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 1 (2 pts) (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.
SsaInstructionSimplifier.visitStringConcat (cognitive 18) pkg/compiler/lib/src/ssa/optimize.dart:2353— SsaInstructionSimplifier.visitStringConcat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), 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.
Range.& (cognitive 18) pkg/compiler/lib/src/ssa/value_range_analyzer.dart:656— Range.& has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 1 (3 pts) (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.
SsaValueRangeAnalyzer.visitRemainder (cognitive 18) pkg/compiler/lib/src/ssa/value_range_analyzer.dart:1083— SsaValueRangeAnalyzer.visitRemainder has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
IsolateManager._readyToResume (cognitive 18) pkg/dap_adapters/lib/src/isolate_manager.dart:405— IsolateManager._readyToResume has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, error handling 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.
StackTraceLine.fromText (cognitive 18) pkg/dart2js_tools/lib/src/trace.dart:26— StackTraceLine.fromText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (18 pts) (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.
ProgramCompiler._emitMemberName (cognitive 18) pkg/dev_compiler/lib/src/kernel/compiler.dart:3193— ProgramCompiler._emitMemberName has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (3 pts), 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.
ProgramCompiler._isStaticInteropTearOff (cognitive 18) pkg/dev_compiler/lib/src/kernel/compiler.dart:3554— ProgramCompiler._isStaticInteropTearOff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7 (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.
ProgramCompiler._emitInlineJSCode (cognitive 18) pkg/dev_compiler/lib/src/kernel/compiler.dart:7212— ProgramCompiler._emitInlineJSCode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 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.
LibraryCompiler._emitMemberName (cognitive 18) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:3708— LibraryCompiler._emitMemberName has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (3 pts), 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.
LibraryCompiler._isStaticInteropTearOff (cognitive 18) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4165— LibraryCompiler._isStaticInteropTearOff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7 (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.
LibraryCompiler._emitInlineJSCode (cognitive 18) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8079— LibraryCompiler._emitInlineJSCode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 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.
HotReloadDeltaInspector.compareGenerations (cognitive 18) pkg/dev_compiler/lib/src/kernel/hot_reload_delta_inspector.dart:29— HotReloadDeltaInspector.compareGenerations has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 pts), 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.
PersistentWebSocket._listenWithRetry (cognitive 18) pkg/dwds/lib/src/sockets.dart:167— PersistentWebSocket._listenWithRetry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (3 pts), match/switch 1 (2 pts), boolean chains 1, 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.
IncrementalCompiler.computeDelta (cognitive 18) pkg/front_end/lib/src/base/incremental_compiler.dart:318— IncrementalCompiler.computeDelta has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 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.
LookupResult._fromBuilders (cognitive 18) pkg/front_end/lib/src/base/lookup_result.dart:79— LookupResult._fromBuilders has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LookupResultIterator.moveNext (cognitive 18) pkg/front_end/lib/src/base/scope.dart:347— LookupResultIterator.moveNext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (18 pts) (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.
TypeAliasBuilderImpl._unaliasDeclaration (cognitive 18) pkg/front_end/lib/src/builder/type_alias_builder.dart:461— TypeAliasBuilderImpl._unaliasDeclaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), 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.
RegularConstructorEncoding._build (cognitive 18) pkg/front_end/lib/src/fragment/constructor/encoding.dart:263— RegularConstructorEncoding._build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (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.
BodyBuilderImpl.endForStatement (cognitive 18) pkg/front_end/lib/src/kernel/body_builder.dart:4093— BodyBuilderImpl.endForStatement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (18 pts) (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.
BodyBuilderImpl.handleThisExpression (cognitive 18) pkg/front_end/lib/src/kernel/body_builder.dart:8648— BodyBuilderImpl.handleThisExpression has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 8 (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.
MapConstantBuilder.addSpread (cognitive 18) pkg/front_end/lib/src/kernel/constant_collection_builders.dart:283— MapConstantBuilder.addSpread has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (3 pts) (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.
ConstantsTransformer.visitStringConcatenation (cognitive 18) pkg/front_end/lib/src/kernel/constant_evaluator.dart:2403— ConstantsTransformer.visitStringConcatenation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, 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.
DartScopeBuilder2._filterScopesWithArtificialNodes (cognitive 18) pkg/front_end/lib/src/kernel/dart_scope_calculator.dart:545— DartScopeBuilder2._filterScopesWithArtificialNodes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (4 pts) (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.
_DynamicModuleValidator._verifyCallable (cognitive 18) pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:906— _DynamicModuleValidator._verifyCallable has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, match/switch 1 (2 pts) (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.
ThisAccessGenerator.buildSelectorAccess (cognitive 18) pkg/front_end/lib/src/kernel/expression_generator.dart:6978— ThisAccessGenerator.buildSelectorAccess has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 1 (3 pts) (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.
ClassMembersNodeBuilder.inferSetterType (cognitive 18) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:390— ClassMembersNodeBuilder.inferSetterType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (3 pts) (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.
KernelTarget._makeMixinApplicationConstructor (cognitive 18) pkg/front_end/lib/src/kernel/kernel_target.dart:1021— KernelTarget._makeMixinApplicationConstructor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 3 (4 pts), boolean chains 3, ternaries 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.
DeclarationNameSpaceBuilder.buildNameSpace (cognitive 18) pkg/front_end/lib/src/source/name_space_builder.dart:41— DeclarationNameSpaceBuilder.buildNameSpace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (6 pts), ternaries 1 (2 pts), 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.
OutlineBuilder.beginMethod (cognitive 18) pkg/front_end/lib/src/source/outline_builder.dart:2297— OutlineBuilder.beginMethod has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), 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.
SourceDeclarationBuilderMixin._buildMember (cognitive 18) pkg/front_end/lib/src/source/source_builder_mixins.dart:277— SourceDeclarationBuilderMixin._buildMember has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (18 pts) (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.
SourceClassBuilder._checkTypes (cognitive 18) pkg/front_end/lib/src/source/source_class_builder.dart:1797— SourceClassBuilder._checkTypes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SourceLibraryBuilder.finishForwarders (cognitive 18) pkg/front_end/lib/src/source/source_library_builder.dart:1205— SourceLibraryBuilder.finishForwarders has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (7 pts) (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.
SourceLoader.resolveParts (cognitive 18) pkg/front_end/lib/src/source/source_loader.dart:1618— SourceLoader.resolveParts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 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.
SourceLoader.checkOverrides (cognitive 18) pkg/front_end/lib/src/source/source_loader.dart:2786— SourceLoader.checkOverrides has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (5 pts), 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.
InferenceVisitorImpl.visitIfNullSuperIndexSet (cognitive 18) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7066— InferenceVisitorImpl.visitIfNullSuperIndexSet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4, boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceVisitorImpl.visitCompoundIndexSet (cognitive 18) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8423— InferenceVisitorImpl.visitCompoundIndexSet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, ternaries 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.
FileInfoHelper.getContent (cognitive 18) pkg/front_end/lib/src/util/import_export_etc_helper.dart:31— FileInfoHelper.getContent has cognitive complexity 18 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 6 (nesting depth added 6). 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.
Printer.visitVariableDeclarationList (cognitive 18) pkg/js_ast/lib/src/printer.dart:843— Printer.visitVariableDeclarationList has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (2 pts) (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.
_Visitor.visitFormalParameterList (cognitive 18) pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart:40— _Visitor.visitFormalParameterList has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), 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.
_Visitor._offsetAndLengthForFragment (cognitive 18) pkg/linter/lib/src/rules/analyzer_public_api.dart:325— _Visitor._offsetAndLengthForFragment has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
_Visitor.visitPrimaryConstructorDeclaration (cognitive 18) pkg/linter/lib/src/rules/annotate_overrides.dart:74— _Visitor.visitPrimaryConstructorDeclaration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_ConstructorChecker._checkInitializer (cognitive 18) pkg/linter/lib/src/rules/prefer_initializing_formals.dart:142— _ConstructorChecker._checkInitializer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_Visitor._reportIfNeeded (cognitive 18) pkg/linter/lib/src/rules/simplify_variable_pattern.dart:88— _Visitor._reportIfNeeded has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
_Visitor._checkConstructor (cognitive 18) pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart:82— _Visitor._checkConstructor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_Visitor.afterLibrary (cognitive 18) pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart:54— _Visitor.afterLibrary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 pts), match/switch 1 (3 pts) (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.
StackTraceHeader.writeToStringBuffer (cognitive 18) pkg/native_stack_traces/lib/src/convert.dart:295— StackTraceHeader.writeToStringBuffer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (2 pts), ternaries 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.
SetCommand.complete (cognitive 18) pkg/observatory/lib/src/elements/debugger.dart:731— SetCommand.complete has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), 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.
ClearCommand.run (cognitive 18) pkg/observatory/lib/src/elements/debugger.dart:866— ClearCommand.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (2 pts), ternaries 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.
DebuggerStackElement.updateStackFrames (cognitive 18) pkg/observatory/lib/src/elements/debugger.dart:2384— DebuggerStackElement.updateStackFrames has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 4 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 6). 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.
DebuggerInputElement._onKeyDown (cognitive 18) pkg/observatory/lib/src/elements/debugger.dart:3258— DebuggerInputElement._onKeyDown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (4 pts), match/switch 2 (3 pts) (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.
CodeSection.deserialize (cognitive 18) pkg/wasm_builder/lib/src/serialize/sections.dart:715— CodeSection.deserialize has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 8). 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.
DataSection.deserialize (cognitive 18) pkg/wasm_builder/lib/src/serialize/sections.dart:826— DataSection.deserialize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, 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.
Printer.writeMetadata (cognitive 18) pkg/kernel/lib/text/ast_to_text.dart:731— Printer.writeMetadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (2 pts) (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.
Printer.writeFunction (cognitive 18) pkg/kernel/lib/text/ast_to_text.dart:825— Printer.writeFunction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 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.
_TreeShakerPass2.calculateRemovedLibraryDeps (cognitive 18) pkg/vm/lib/transformations/type_flow/transformer.dart:2172— _TreeShakerPass2.calculateRemovedLibraryDeps has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (4 pts) (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.
SetType.intersection (cognitive 18) pkg/vm/lib/transformations/type_flow/types.dart:784— SetType.intersection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (2 pts) (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.
PRESUBMIT._CheckFormat (cognitive 18) PRESUBMIT.py:56— PRESUBMIT._CheckFormat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (3 pts), 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.
embedder_layering_check.CheckFile (cognitive 18) runtime/tools/embedder_layering_check.py:28— embedder_layering_check.CheckFile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (16 pts), 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.
build_devtools.main (cognitive 18) tools/build_devtools.py:17— build_devtools.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), error handling 5 (6 pts) (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.
DartiumBackend._AddGetter (cognitive 18) tools/dom/scripts/systemnative.py:558— DartiumBackend._AddGetter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Document.outerHtml (cognitive 17) pkg/analyzer_utilities/lib/html_dom.dart:17— Document.outerHtml has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (6 pts), boolean chains 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.
FieldDeclaration.toString (cognitive 17) pkg/dart2bytecode/lib/declarations.dart:491— FieldDeclaration.toString has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17. 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.
_Allocator._enterScope (cognitive 17) pkg/dart2bytecode/lib/local_vars.dart:707— _Allocator._enterScope has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts), ternaries 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.
ConstructorAllocatorCodeGenerator.generateConstructorAllocator (cognitive 17) pkg/dart2wasm/lib/code_generator.dart:4696— ConstructorAllocatorCodeGenerator.generateConstructorAllocator has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 4 (6 pts) (nesting depth added 7). 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.
DryRunSummarizer._analyzeImports (cognitive 17) pkg/dart2wasm/lib/dry_run.dart:134— DryRunSummarizer._analyzeImports has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), 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.
Translator.translate (cognitive 17) pkg/dart2wasm/lib/translator.dart:526— Translator.translate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5, 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.
Types.classForType (cognitive 17) pkg/dart2wasm/lib/types.dart:140— Types.classForType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (17 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RuntimeTypeInformation._buildTypeRules (cognitive 17) pkg/dart2wasm/lib/types.dart:1239— RuntimeTypeInformation._buildTypeRules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), 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.
Analysis.variableLengthOf (cognitive 17) pkg/heap_snapshot/lib/analysis.dart:571— Analysis.variableLengthOf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (4 pts), boolean chains 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.
ClosedWorldClassHierarchy._initializeTopologicallySortedClasses (cognitive 17) pkg/kernel/lib/class_hierarchy.dart:1489— ClosedWorldClassHierarchy._initializeTopologicallySortedClasses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts) (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.
Configuration.toString (cognitive 17) pkg/smith/lib/configuration.dart:640— Configuration.toString has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, boolean chains 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.
MethodParser.parseInto (cognitive 17) pkg/vm_service/tool/dart/generate_dart_common.dart:1325— MethodParser.parseInto has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 3 (7 pts), boolean chains 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.
DartFuzz.emitMethodCall (cognitive 17) runtime/tools/dartfuzz/dartfuzz.dart:2467— DartFuzz.emitMethodCall has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 1 (2 pts) (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.
_HttpHeaders._add (cognitive 17) sdk/lib/_http/http_headers.dart:314— _HttpHeaders._add has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
_HttpClient._openUrl (cognitive 17) sdk/lib/_http/http_impl.dart:2976— _HttpClient._openUrl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_WebSocketPerMessageDeflate.processOutgoingMessage (cognitive 17) sdk/lib/_http/websocket_impl.dart:913— _WebSocketPerMessageDeflate.processOutgoingMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 2 (3 pts) (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.
_Utf8Decoder.convertSingle (cognitive 17) sdk/lib/_internal/wasm/common/convert_patch.dart:2205— _Utf8Decoder.convertSingle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts) (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.
_Utf8Decoder.decode8 (cognitive 17) sdk/lib/_internal/wasm/common/convert_patch.dart:2579— _Utf8Decoder.decode8 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, 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.
int._parseBlock (cognitive 17) sdk/lib/_internal/wasm/common/int_patch.dart:197— int._parseBlock has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), 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.
SubtypeTestCacheStub._generate (cognitive 17) pkg/native_compiler/lib/back_end/arm64/stub_code_generator.dart:475— SubtypeTestCacheStub._generate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (5 pts) (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.
_JsonUtf8Stringifier.writeStringSlice (cognitive 17) sdk/lib/convert/json.dart:1134— _JsonUtf8Stringifier.writeStringSlice has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_AcceptStructuredClone.walk (cognitive 17) sdk/lib/html/html_common/conversions.dart:223— _AcceptStructuredClone.walk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_FileStream._readBlock (cognitive 17) sdk/lib/io/file_impl.dart:93— _FileStream._readBlock has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
FileSystemEntity._absoluteWindowsPath (cognitive 17) sdk/lib/io/file_system_entity.dart:585— FileSystemEntity._absoluteWindowsPath has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
Loop.addBody (cognitive 17) pkg/cfg/lib/ir/loops.dart:47— Loop.addBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), 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.
RuntimeFinalizer.generateJsMethods (cognitive 17) pkg/dart2wasm/lib/js/runtime_generator.dart:60— RuntimeFinalizer.generateJsMethods has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), match/switch 1 (2 pts) (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.
_FfiDefinitionTransformer.visitClass (cognitive 17) pkg/vm/lib/modular/transformations/ffi/definitions.dart:269— _FfiDefinitionTransformer.visitClass has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, loops 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.
ConstantPropagation.transform (cognitive 17) pkg/cfg/lib/passes/constant_propagation.dart:674— ConstantPropagation.transform has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (7 pts) (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.
ConstantPropagation._transformPhis (cognitive 17) pkg/cfg/lib/passes/constant_propagation.dart:717— ConstantPropagation._transformPhis has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (7 pts) (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.
Unboxing._findUnboxedInput (cognitive 17) pkg/native_compiler/lib/passes/unboxing.dart:120— Unboxing._findUnboxedInput has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), 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.
SpaceCreator.createCastSpace (cognitive 17) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/shared.dart:700— SpaceCreator.createCastSpace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (3 pts), 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.
FlowModel.rebaseForward (cognitive 17) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart:3896— FlowModel.rebaseForward has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 1 (2 pts), loops 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.
FlowLinkReader._diffCore (cognitive 17) pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_link.dart:215— FlowLinkReader._diffCore has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 6 (7 pts) (nesting depth added 7). 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.
Parser.parseExpression (cognitive 17) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:6938— Parser.parseExpression has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (6 pts), boolean chains 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.
JsUtilOptimizer._treatmentForProcedure (cognitive 17) pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart:254— JsUtilOptimizer._treatmentForProcedure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), 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.
DartUnitHoverComputer._getTypeOfDeclarationOrReference (cognitive 17) pkg/analysis_server/lib/src/computer/computer_hover.dart:389— DartUnitHoverComputer._getTypeOfDeclarationOrReference has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 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.
CodeActionComputer._computeActions (cognitive 17) pkg/analysis_server/lib/src/lsp/handlers/code_actions/code_action_computer.dart:207— CodeActionComputer._computeActions has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 7, boolean chains 2 (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.
WorkspaceFlutterWidgetPreviewsHandler.handle (cognitive 17) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_get_widget_previews.dart:109— WorkspaceFlutterWidgetPreviewsHandler.handle has cognitive complexity 17 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 2 (7 pts) (nesting depth added 10). 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.
HoverHandler.toHover (cognitive 17) pkg/analysis_server/lib/src/lsp/handlers/handler_hover.dart:59— HoverHandler.toHover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (2 pts) (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.
InitializeMessageHandler.handle (cognitive 17) pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart:22— InitializeMessageHandler.handle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (3 pts) (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.
SuggestionBuilder.suggestConstructor (cognitive 17) pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart:164— SuggestionBuilder.suggestConstructor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 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.
BulkFixProcessor._formatCode (cognitive 17) pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart:947— BulkFixProcessor._formatCode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (7 pts), 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.
AddMissingEnumCaseClauses._importPrefix (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_case_clauses.dart:123— AddMissingEnumCaseClauses._importPrefix has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BindToField._whetherToCreateNewField (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/bind_to_field.dart:206— BindToField._whetherToCreateNewField has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
ConvertFlutterChild.compute (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/convert_flutter_child.dart:25— ConvertFlutterChild.compute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 1 (3 pts), 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.
CreateConstructorForFinalFields._fieldsToWrite (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart:111— CreateConstructorForFinalFields._fieldsToWrite has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 pts), 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.
FlutterWrap.producers (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/flutter_wrap.dart:21— FlutterWrap.producers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 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.
_ImportLibraryCombinatorMultiple.compute (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/import_library.dart:975— _ImportLibraryCombinatorMultiple.compute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (2 pts), ternaries 1 (2 pts), 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.
JoinIfWithOuter.compute (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/join_if_with_outer.dart:25— JoinIfWithOuter.compute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (17 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ReplaceFinalWithConst.compute (cognitive 17) pkg/analysis_server/lib/src/services/correction/dart/replace_final_with_const.dart:26— ReplaceFinalWithConst.compute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (2 pts) (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.
_WidgetDescriptionComputer._toValue (cognitive 17) pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart:513— _WidgetDescriptionComputer._toValue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 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.
_AvailableWithDeclaration.hasSelectedFormalParametersToConvertToNamed (cognitive 17) pkg/analysis_server/lib/src/services/refactoring/agnostic/change_method_signature.dart:445— _AvailableWithDeclaration.hasSelectedFormalParametersToConvertToNamed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
ExtractLocalRefactoringImpl._declarationKeywordAndType (cognitive 17) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_local.dart:79— ExtractLocalRefactoringImpl._declarationKeywordAndType has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 6, boolean chains 3 (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.
ExtractMethodRefactoringImpl._initializeReturnType (cognitive 17) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:830— ExtractMethodRefactoringImpl._initializeReturnType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), 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.
ExtractWidgetRefactoringImpl._replaceInvocationsWithInstantiations (cognitive 17) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_widget.dart:386— ExtractWidgetRefactoringImpl._replaceInvocationsWithInstantiations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), 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.
YamlNodeLocator._searchWithin (cognitive 17) pkg/analysis_server/lib/src/utilities/yaml_node_locator.dart:36— YamlNodeLocator._searchWithin has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), 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.
PluginServer._computeDiagnosticsFromPlugin (cognitive 17) pkg/analysis_server_plugin/lib/src/plugin_server.dart:545— PluginServer._computeDiagnosticsFromPlugin has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 5 (6 pts) (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.
_ParsedOptionalChecksData.parse (cognitive 17) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1416— _ParsedOptionalChecksData.parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 3 (6 pts), loops 1 (2 pts) (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.
_ContextLocator._createContextRoots (cognitive 17) pkg/analyzer/lib/src/dart/analysis/context_locator.dart:310— _ContextLocator._createContextRoots has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 1 (3 pts), ternaries 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.
ContextRootImpl._includedFilesInFolder (cognitive 17) pkg/analyzer/lib/src/dart/analysis/context_root.dart:100— ContextRootImpl._includedFilesInFolder has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts), 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.
ConstantVisitor.visitSetOrMapLiteral (cognitive 17) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1331— ConstantVisitor.visitSetOrMapLiteral has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, ternaries 1 (2 pts) (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.
_ConstantTypeChecker._checkGenericFunctionType (cognitive 17) pkg/analyzer/lib/src/dart/constant/potentially_constant.dart:598— _ConstantTypeChecker._checkGenericFunctionType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), 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.
InterfaceLeastUpperBoundHelper.compute (cognitive 17) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:24— InterfaceLeastUpperBoundHelper.compute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), 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.
RuntimeTypeEqualityVisitor.visitFunctionType (cognitive 17) pkg/analyzer/lib/src/dart/element/runtime_type_equality.dart:41— RuntimeTypeEqualityVisitor.visitFunctionType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), 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.
AssignmentExpressionResolver.resolveDirect (cognitive 17) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:317— AssignmentExpressionResolver.resolveDirect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), 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.
MethodInvocationResolver._rewriteAsCallInvocation (cognitive 17) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:1827— MethodInvocationResolver._rewriteAsCallInvocation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (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.
ResolutionVisitor._lookupBreakOrContinueTarget (cognitive 17) pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart:1125— ResolutionVisitor._lookupBreakOrContinueTarget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 1 (2 pts) (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.
AnnotationVerifier._checkAwaitNotRequired (cognitive 17) pkg/analyzer/lib/src/error/annotation_verifier.dart:78— AnnotationVerifier._checkAwaitNotRequired has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 2 (4 pts), boolean chains 3 (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.
ConstArgumentsVerifier._isTearOff (cognitive 17) pkg/analyzer/lib/src/error/const_argument_verifier.dart:258— ConstArgumentsVerifier._isTearOff has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ImportsVerifier.addImports (cognitive 17) pkg/analyzer/lib/src/error/imports_verifier.dart:59— ImportsVerifier.addImports has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), 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.
DocCommentBuilder._endBlockDocDirectiveTag (cognitive 17) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:168— DocCommentBuilder._endBlockDocDirectiveTag has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 2 (6 pts) (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.
_CharacterSequenceFromMultiLineComment.next (cognitive 17) pkg/analyzer/lib/src/fasta/doc_comment_builder.dart:997— _CharacterSequenceFromMultiLineComment.next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ErrorVerifier._checkForDeferredPrefixCollisions (cognitive 17) pkg/analyzer/lib/src/generated/error_verifier.dart:5012— ErrorVerifier._checkForDeferredPrefixCollisions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ErrorVerifier._checkForUndefinedConstructorInInitializerImplicit (cognitive 17) pkg/analyzer/lib/src/generated/error_verifier.dart:7792— ErrorVerifier._checkForUndefinedConstructorInInitializerImplicit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 1 (2 pts) (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.
FfiVerifier._validateAsFunction (cognitive 17) pkg/analyzer/lib/src/generated/ffi_verifier.dart:1546— FfiVerifier._validateAsFunction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, ternaries 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.
SwitchExhaustiveness.visitSwitchMember (cognitive 17) pkg/analyzer/lib/src/generated/resolver.dart:6479— SwitchExhaustiveness.visitSwitchMember has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
IgnoreInfo.isIgnoreComment (cognitive 17) pkg/analyzer/lib/src/ignore_comments/ignore_info.dart:214— IgnoreInfo.isIgnoreComment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ResolutionSink.writeType (cognitive 17) pkg/analyzer/lib/src/summary2/bundle_writer.dart:1004— ResolutionSink.writeType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (17 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BlazeWorkspacePackage.isInTestDirectory (cognitive 17) pkg/analyzer/lib/src/workspace/blaze.dart:635— BlazeWorkspacePackage.isInTestDirectory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 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.
BlazeFileWatcherIsolate.handleRequest (cognitive 17) pkg/analyzer/lib/src/workspace/blaze_watcher.dart:177— BlazeFileWatcherIsolate.handleRequest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts) (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.
DartEditBuilderImpl._getVisibleType (cognitive 17) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:1422— DartEditBuilderImpl._getVisibleType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (2 pts) (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.
CompletionTarget.dotTarget (cognitive 17) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:297— CompletionTarget.dotTarget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (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.
CompletionTarget.executableElement (cognitive 17) pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart:330— CompletionTarget.executableElement has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 pts) (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.
PubPackageResolutionTest.assertDiagnosticsIn (cognitive 17) pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart:269— PubPackageResolutionTest.assertDiagnosticsIn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (3 pts), loops 2 (3 pts), 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.
PubPackageResolutionTest.unexpectedMessage (cognitive 17) pkg/analyzer_testing/lib/src/analysis_rule/pub_package_resolution.dart:503— PubPackageResolutionTest.unexpectedMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), match/switch 1 (4 pts) (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.
InferrerEngine._updateSideEffects (cognitive 17) pkg/compiler/lib/src/inferrer/engine.dart:160— InferrerEngine._updateSideEffects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), 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.
InferrerEngine.typeOfNativeBehavior (cognitive 17) pkg/compiler/lib/src/inferrer/engine.dart:194— InferrerEngine.typeOfNativeBehavior has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MapTypeInformation.computeType (cognitive 17) pkg/compiler/lib/src/inferrer/type_graph_nodes.dart:2167— MapTypeInformation.computeType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 1 (2 pts) (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.
RecordTypeMask._isNonTriviallyDisjoint (cognitive 17) pkg/compiler/lib/src/inferrer/typemasks/record_type_mask.dart:280— RecordTypeMask._isNonTriviallyDisjoint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts), 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.
FragmentEmitter.emitConstructor (cognitive 17) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:943— FragmentEmitter.emitConstructor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FragmentEmitter.emitInstanceMethod (cognitive 17) pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart:1167— FragmentEmitter.emitInstanceMethod has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
JsKernelToElementMap.readFromDataSource (cognitive 17) pkg/compiler/lib/src/js_model/element_map_impl.dart:275— JsKernelToElementMap.readFromDataSource has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4, boolean chains 2, match/switch 1 (2 pts) (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.
KLibraryEnv._ensureMemberMaps (cognitive 17) pkg/compiler/lib/src/kernel/env.dart:87— KLibraryEnv._ensureMemberMaps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts) (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.
SsaCodeGenerator.define (cognitive 17) pkg/compiler/lib/src/ssa/codegen.dart:781— SsaCodeGenerator.define has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7 (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.
SsaCodeGenerator.sequentializeCopies (cognitive 17) pkg/compiler/lib/src/ssa/codegen.dart:1440— SsaCodeGenerator.sequentializeCopies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (6 pts), boolean chains 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.
SsaInstructionSimplifier.visitInvokeDynamicGetter (cognitive 17) pkg/compiler/lib/src/ssa/optimize.dart:2021— SsaInstructionSimplifier.visitInvokeDynamicGetter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
SsaRedundantPhiEliminator.visitGraph (cognitive 17) pkg/compiler/lib/src/ssa/optimize.dart:3655— SsaRedundantPhiEliminator.visitGraph has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts), 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.
ValueSet.kill (cognitive 17) pkg/compiler/lib/src/ssa/value_set.dart:53— ValueSet.kill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 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.
ResolutionWorldBuilder.registerStaticUse (cognitive 17) pkg/compiler/lib/src/universe/resolution_world_builder.dart:577— ResolutionWorldBuilder.registerStaticUse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, 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.
Setlet.removeWhere (cognitive 17) pkg/compiler/lib/src/util/setlet.dart:213— Setlet.removeWhere has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (2 pts), 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.
ThreadInfo.resolveUrisToPathsBatch (cognitive 17) pkg/dap_adapters/lib/src/isolate_manager.dart:1521— ThreadInfo.resolveUrisToPathsBatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (4 pts), error handling 1 (2 pts) (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.
EvalPackageResolver.collectDependencies (cognitive 17) pkg/dartdev/lib/src/eval_packages.dart:42— EvalPackageResolver.collectDependencies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 2 (7 pts), loops 2 (3 pts) (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.
_Workspace._listDirectory (cognitive 17) pkg/dartpad_worker/lib/src/worker.dart:349— _Workspace._listDirectory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
MiniJsParser.getDelimited (cognitive 17) pkg/dev_compiler/lib/src/js_ast/builder.dart:676— MiniJsParser.getDelimited has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 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.
MiniJsParser.parseFun (cognitive 17) pkg/dev_compiler/lib/src/js_ast/builder.dart:1019— MiniJsParser.parseFun has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts) (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.
Printer.out (cognitive 17) pkg/dev_compiler/lib/src/js_ast/printer.dart:150— Printer.out has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
ProgramCompiler._initializeFields (cognitive 17) pkg/dev_compiler/lib/src/kernel/compiler.dart:2368— ProgramCompiler._initializeFields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
ProgramCompiler._emitTopLevelFields (cognitive 17) pkg/dev_compiler/lib/src/kernel/compiler.dart:3025— ProgramCompiler._emitTopLevelFields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (2 pts) (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.
ProgramCompiler._emitArgumentInitializers (cognitive 17) pkg/dev_compiler/lib/src/kernel/compiler.dart:4296— ProgramCompiler._emitArgumentInitializers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 2 (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.
ProgramCompiler._parentMasksToWidth (cognitive 17) pkg/dev_compiler/lib/src/kernel/compiler.dart:6264— ProgramCompiler._parentMasksToWidth has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LibraryCompiler._emitArgumentInitializers (cognitive 17) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4892— LibraryCompiler._emitArgumentInitializers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 2 (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.
LibraryCompiler._parentMasksToWidth (cognitive 17) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6953— LibraryCompiler._parentMasksToWidth has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExpressionCompilerWorker._collectTransitiveDependencies (cognitive 17) pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart:575— ExpressionCompilerWorker._collectTransitiveDependencies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (5 pts) (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.
Modules.initialize (cognitive 17) pkg/dwds/lib/src/debugging/modules.dart:41— Modules.initialize has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 3 (8 pts) (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.
MetadataBuilder.buildAnnotations (cognitive 17) pkg/front_end/lib/src/builder/metadata_builder.dart:74— MetadataBuilder.buildAnnotations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), 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.
TypeLabeler.visitTypedefTearOffConstant (cognitive 17) pkg/front_end/lib/src/codes/type_labeler.dart:566— TypeLabeler.visitTypedefTearOffConstant has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), 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.
BodyBuilderImpl.endArguments (cognitive 17) pkg/front_end/lib/src/kernel/body_builder.dart:2916— BodyBuilderImpl.endArguments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), match/switch 1 (2 pts), 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.
_DynamicCallValidator._DynamicCallValidator (cognitive 17) pkg/front_end/lib/src/kernel/dynamic_module_validator.dart:1117— _DynamicCallValidator._DynamicCallValidator has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (3 pts), 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.
ExplicitExtensionInstanceAccessGenerator.fromBuilder (cognitive 17) pkg/front_end/lib/src/kernel/expression_generator.dart:3130— ExplicitExtensionInstanceAccessGenerator.fromBuilder has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), 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.
KernelTarget.installForwardingConstructors (cognitive 17) pkg/front_end/lib/src/kernel/kernel_target.dart:920— KernelTarget.installForwardingConstructors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), 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.
ComputeDefaultTypeContext.computeDefaultTypesForVariables (cognitive 17) pkg/front_end/lib/src/kernel/type_algorithms.dart:973— ComputeDefaultTypeContext.computeDefaultTypesForVariables has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 5 (7 pts), boolean chains 2 (nesting depth added 7). 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.
OutlineBuilder.beginFields (cognitive 17) pkg/front_end/lib/src/source/outline_builder.dart:4072— OutlineBuilder.beginFields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
InferenceVisitorImpl.visitMapOrSetLiteral (cognitive 17) pkg/front_end/lib/src/type_inference/inference_visitor.dart:5260— InferenceVisitorImpl.visitMapOrSetLiteral has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, loops 2 (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.
InferenceVisitorImpl.visitIfNullIndexSet (cognitive 17) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821— InferenceVisitorImpl.visitIfNullIndexSet has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (17 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceVisitorImpl.visitCompoundSuperIndexSet (cognitive 17) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8671— InferenceVisitorImpl.visitCompoundSuperIndexSet has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 3, ternaries 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.
InferenceVisitorImpl.visitExtensionCompoundIndexSet (cognitive 17) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8856— InferenceVisitorImpl.visitExtensionCompoundIndexSet has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 1, ternaries 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.
MiniJsParser.getRegExp (cognitive 17) pkg/js_ast/lib/src/builder.dart:554— MiniJsParser.getRegExp has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 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.
ReplacementVisitor.visitFunctionType (cognitive 17) pkg/kernel/lib/src/replacement_visitor.dart:15— ReplacementVisitor.visitFunctionType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 5 (7 pts), 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.
_Visitor.visitPrimaryConstructorBody (cognitive 17) pkg/linter/lib/src/rules/initialize_in_field_declaration.dart:59— _Visitor.visitPrimaryConstructorBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 pts), 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.
_Visitor.visitFunctionExpression (cognitive 17) pkg/linter/lib/src/rules/unnecessary_lambdas.dart:153— _Visitor.visitFunctionExpression has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5 (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.
_Visitor.checkMethodCallback (cognitive 17) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:1207— _Visitor.checkMethodCallback has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2, ternaries 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.
_Visitor.visitPrimaryConstructorDeclaration (cognitive 17) pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart:170— _Visitor.visitPrimaryConstructorDeclaration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 1 (2 pts) (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.
_Visitor.visitInstanceCreationExpression (cognitive 17) pkg/linter/lib/src/rules/valid_regexps.dart:34— _Visitor.visitInstanceCreationExpression has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, error handling 1 (4 pts) (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.
InstanceRef.toJson (cognitive 17) pkg/vm_service/lib/src/vm_service.dart:5166— InstanceRef.toJson has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17. 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.
BinaryenInlineHintSection.deserialize (cognitive 17) pkg/wasm_builder/lib/src/serialize/sections.dart:1235— BinaryenInlineHintSection.deserialize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), 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.
UnaryOperation.apply (cognitive 17) pkg/vm/lib/transformations/type_flow/summary.dart:812— UnaryOperation.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
SummaryCollector._mergeVariableValues (cognitive 17) pkg/vm/lib/transformations/type_flow/summary_collector.dart:1207— SummaryCollector._mergeVariableValues has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
list_dart_files_as_depfile.main (cognitive 17) tools/list_dart_files_as_depfile.py:20— list_dart_files_as_depfile.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), 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.
utils.HostArchitectures (cognitive 17) tools/utils.py:265— utils.HostArchitectures has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), 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.
showTables (cognitive 17) runtime/tools/graphexplorer/graphexplorer.js:1835— showTables has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 7 function items inside it that branch ((anonymous), (anonymous), onchange, …). 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.
JsInteropChecks._isAllowedExternalType (cognitive 16) pkg/_js_interop_checks/lib/js_interop_checks.dart:985— JsInteropChecks._isAllowedExternalType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AbstractScanner.tokenize (cognitive 16) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:938— AbstractScanner.tokenize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), 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.
CodeShapeMetricsComputer._computeInContext (cognitive 16) pkg/analysis_server/tool/code_completion/code_metrics.dart:1296— CodeShapeMetricsComputer._computeInContext has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (6 pts), error handling 1 (3 pts) (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.
FlutterMetricsComputer._computeInContext (cognitive 16) pkg/analysis_server/tool/code_completion/flutter_metrics.dart:182— FlutterMetricsComputer._computeInContext has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (6 pts), error handling 1 (3 pts) (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.
_ConcreteAstVisitorGenerator._writeGeneralizing (cognitive 16) pkg/analyzer/tool/ast/generate.dart:305— _ConcreteAstVisitorGenerator._writeGeneralizing has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
_Generator._generateSnapshot (cognitive 16) pkg/dart2native/lib/generate.dart:258— _Generator._generateSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, ternaries 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.
AstCodeGenerator.visitVariable (cognitive 16) pkg/dart2wasm/lib/code_generator.dart:795— AstCodeGenerator.visitVariable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 1 (3 pts) (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.
AstCodeGenerator.visitStringConcatenation (cognitive 16) pkg/dart2wasm/lib/code_generator.dart:2937— AstCodeGenerator.visitStringConcatenation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 2 (4 pts), 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.
ConstantCreator.visitAuxiliaryConstant (cognitive 16) pkg/dart2wasm/lib/constants.dart:1650— ConstantCreator.visitAuxiliaryConstant has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstructorInfo.ConstructorInfo (cognitive 16) pkg/dart2wasm/lib/constructor_info.dart:35— ConstructorInfo.ConstructorInfo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
Translator.translateExternalType (cognitive 16) pkg/dart2wasm/lib/translator.dart:1216— Translator.translateExternalType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
Translator._filterInferredType (cognitive 16) pkg/dart2wasm/lib/translator.dart:2163— Translator._filterInferredType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 2, ternaries 1 (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.
Types.emitAsCheck (cognitive 16) pkg/dart2wasm/lib/types.dart:529— Types.emitAsCheck has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_AstIndexerAndIgnoreCollectorBody._recordIfIsCallToNotExpectedCoverage (cognitive 16) pkg/front_end/tool/coverage_merger.dart:1300— _AstIndexerAndIgnoreCollectorBody._recordIfIsCallToNotExpectedCoverage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 3 (4 pts) (nesting depth added 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.
_SnapshotGraph._buildOwnedSizes (cognitive 16) pkg/observatory/lib/object_graph.dart:1266— _SnapshotGraph._buildOwnedSizes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (5 pts), boolean chains 3 (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.
DartFuzz.emitLiteral (cognitive 16) runtime/tools/dartfuzz/dartfuzz.dart:2026— DartFuzz.emitLiteral has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (16 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_HttpHeaders._addContentLength (cognitive 16) sdk/lib/_http/http_headers.dart:371— _HttpHeaders._addContentLength has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (2 pts), 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.
_WebSocketImpl.connect (cognitive 16) sdk/lib/_http/websocket_impl.dart:1356— _WebSocketImpl.connect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, loops 1, ternaries 1 (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.
CustomHashMap.putIfAbsent (cognitive 16) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:160— CustomHashMap.putIfAbsent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts) (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.
JSNumber.compareTo (cognitive 16) sdk/lib/_internal/js_runtime/lib/js_number.dart:33— JSNumber.compareTo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (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.
Expando.[]= (cognitive 16) sdk/lib/_internal/vm/lib/expando_patch.dart:51— Expando.[]= has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 1, 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.
_OneByteString.indexOf (cognitive 16) sdk/lib/_internal/vm/lib/string_patch.dart:1087— _OneByteString.indexOf has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, loops 1 (3 pts) (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. This shape REPEATS in the file: one other method here (_OneByteString.contains) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_OneByteString.contains (cognitive 16) sdk/lib/_internal/vm/lib/string_patch.dart:1110— _OneByteString.contains has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, loops 1 (3 pts) (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. This shape REPEATS in the file: one other method here (_OneByteString.indexOf) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_Utf8Decoder.decode16 (cognitive 16) sdk/lib/_internal/wasm/common/convert_patch.dart:2659— _Utf8Decoder.decode16 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 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.
_FunctionType.== (cognitive 16) sdk/lib/_internal/wasm/common/type.dart:464— _FunctionType.== has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
_StreamController._recordCancel (cognitive 16) sdk/lib/async/stream_controller.dart:722— _StreamController._recordCancel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 1 (3 pts), 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.
SplayTreeMap.update (cognitive 16) sdk/lib/collection/splay_tree.dart:562— SplayTreeMap.update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (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.
_Base64Decoder._trimPaddingChars (cognitive 16) sdk/lib/convert/base64.dart:803— _Base64Decoder._trimPaddingChars has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, 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.
_Uri._Uri (cognitive 16) sdk/lib/core/uri.dart:1933— _Uri._Uri has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 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.
UriData.contentAsBytes (cognitive 16) sdk/lib/core/uri.dart:4148— UriData.contentAsBytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
AstToIr.visitTryCatch (cognitive 16) pkg/cfg/lib/front_end/ast_to_ir.dart:1389— AstToIr.visitTryCatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2, 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.
_ScopeBuilder._visitFunction (cognitive 16) pkg/cfg/lib/front_end/computed_scopes.dart:127— _ScopeBuilder._visitFunction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (2 pts) (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.
ListIterable.join (cognitive 16) sdk/lib/internal/iterable.dart:155— ListIterable.join has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts) (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.
_FfiDefinitionTransformer._checkCompoundClass (cognitive 16) pkg/vm/lib/modular/transformations/ffi/definitions.dart:350— _FfiDefinitionTransformer._checkCompoundClass has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5 (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.
_FfiUseSiteTransformer._extendsOrImplementsSealedClass (cognitive 16) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:1949— _FfiUseSiteTransformer._extendsOrImplementsSealedClass has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), loops 1 (nesting depth added 3). 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.
_FfiUseSiteTransformer._replaceNativeCall (cognitive 16) pkg/vm/lib/modular/transformations/ffi/use_sites.dart:2106— _FfiUseSiteTransformer._replaceNativeCall has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FormattedMessage.toJson (cognitive 16) pkg/_fe_analyzer_shared/lib/src/messages/codes.dart:302— FormattedMessage.toJson has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts) (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.
ForCondition.computeNext (cognitive 16) pkg/_fe_analyzer_shared/lib/src/parser/literal_entry_info_impl.dart:93— ForCondition.computeNext has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 4, boolean chains 3 (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.
Parser.parseSuperInitializerExpression (cognitive 16) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:4917— Parser.parseSuperInitializerExpression has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (16 pts) (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.parsePrecedenceExpression (cognitive 16) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7056— Parser.parsePrecedenceExpression has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), 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.
Parser.parseExpressionStatementOrDeclaration (cognitive 16) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:9791— Parser.parseExpressionStatementOrDeclaration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5 (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.
_StringCanonicalizer.canonicalizeBytes (cognitive 16) pkg/_fe_analyzer_shared/lib/src/scanner/string_canonicalizer.dart:194— _StringCanonicalizer.canonicalizeBytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), 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.
Utf8BytesScanner.passIdentifierCharAllowDollar (cognitive 16) pkg/_fe_analyzer_shared/lib/src/scanner/utf8_bytes_scanner.dart:157— Utf8BytesScanner.passIdentifierCharAllowDollar has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 2 (4 pts), loops 2 (nesting depth added 2). 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.
JsUtilOptimizer._lowerToCallUnchecked (cognitive 16) pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart:908— JsUtilOptimizer._lowerToCallUnchecked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts) (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.
StaticInteropMockValidator._implements (cognitive 16) pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart:252— StaticInteropMockValidator._implements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DartDocumentationComputer.compute (cognitive 16) pkg/analysis_server/lib/src/computer/computer_documentation.dart:15— DartDocumentationComputer.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 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.
LegacyAnalysisServer.updateContent (cognitive 16) pkg/analysis_server/lib/src/legacy_analysis_server.dart:1121— LegacyAnalysisServer.updateContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MigrationSummaryBuilder._writeStepFixes (cognitive 16) pkg/analysis_server/lib/src/lsp/handlers/custom/migration/migration_summary_builder.dart:72— MigrationSummaryBuilder._writeStepFixes has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), ternaries 4 (7 pts), if/else 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.
CompletionHandler.handle (cognitive 16) pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart:103— CompletionHandler.handle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DeclarationHelper.addParametersFromSuperConstructor (cognitive 16) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:624— DeclarationHelper.addParametersFromSuperConstructor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1 (2 pts) (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.
DeclarationHelper._suggestTopLevelFunction (cognitive 16) pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart:2819— DeclarationHelper._suggestTopLevelFunction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 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.
InScopeCompletionPass.visitEmptyStatement (cognitive 16) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1075— InScopeCompletionPass.visitEmptyStatement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
InScopeCompletionPass.visitFieldFormalParameter (cognitive 16) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:1447— InScopeCompletionPass.visitFieldFormalParameter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 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.
InScopeCompletionPass._suggestRecordLiteralNamedFields (cognitive 16) pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart:4499— InScopeCompletionPass._suggestRecordLiteralNamedFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), 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.
FilePathProducer.suggestions (cognitive 16) pkg/analysis_server/lib/src/services/completion/yaml/producer.dart:56— FilePathProducer.suggestions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, ternaries 1 (4 pts), loops 1 (3 pts), error handling 1 (2 pts), 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.
AddMissingEnumLikeCaseClauses.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart:30— AddMissingEnumLikeCaseClauses.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts) (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.
AddMissingEnumLikeCaseClauses._caseValues (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/add_missing_enum_like_case_clauses.dart:91— AddMissingEnumLikeCaseClauses._caseValues has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), 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.
AddSuperConstructorInvocation.producers (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/add_super_constructor_invocation.dart:18— AddSuperConstructorInvocation.producers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (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.
ChangeTypeAnnotation.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/change_type_annotation.dart:32— ChangeTypeAnnotation.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 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.
ConvertIntoForIndex.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/convert_into_for_index.dart:26— ConvertIntoForIndex.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, ternaries 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.
ConvertToIfNull._useToConvertNullsToBools (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/convert_to_if_null.dart:106— ConvertToIfNull._useToConvertNullsToBools has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (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.
ConvertToPrimaryConstructor.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/convert_to_primary_constructor.dart:49— ConvertToPrimaryConstructor.compute has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. 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.
ConvertToSuperParameters._findConstructor (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/convert_to_super_parameters.dart:314— ConvertToSuperParameters._findConstructor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (16 pts) (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.
CreateMethodOrFunction.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart:80— CreateMethodOrFunction.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4 (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.
ImportLibrary._namesForExtensionMember (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/import_library.dart:534— ImportLibrary._namesForExtensionMember has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RemoveComparison.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/remove_comparison.dart:57— RemoveComparison.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RemoveTypeAnnotation.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart:38— RemoveTypeAnnotation.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
RenameMethodParameter.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart:32— RenameMethodParameter.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SortChildPropertyLast.compute (cognitive 16) pkg/analysis_server/lib/src/services/correction/dart/sort_child_property_last.dart:33— SortChildPropertyLast.compute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 1 (2 pts), 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.
MemberSorter._sortClassMembers (cognitive 16) pkg/analysis_server/lib/src/services/correction/sort_members.dart:111— MemberSorter._sortClassMembers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
_WidgetDescriptionComputer._addProperties (cognitive 16) pkg/analysis_server/lib/src/services/flutter/widget_descriptions.dart:263— _WidgetDescriptionComputer._addProperties has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts) (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.
_ExtractMethodAnalyzer.visitSimpleIdentifier (cognitive 16) pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart:1151— _ExtractMethodAnalyzer.visitSimpleIdentifier has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
RenameRefactoring.create (cognitive 16) pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart:457— RenameRefactoring.create has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15 (16 pts) (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.
RenameImportRefactoringImpl.buildChange (cognitive 16) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_import.dart:62— RenameImportRefactoringImpl.buildChange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
_BaseUnitMemberValidator._validateWillShadow (cognitive 16) pkg/analysis_server/lib/src/services/refactoring/legacy/rename_unit_member.dart:250— _BaseUnitMemberValidator._validateWillShadow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (3 pts), ternaries 1 (3 pts), 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.
VisibleRangesComputer._patternVariableRange (cognitive 16) pkg/analysis_server/lib/src/services/refactoring/legacy/visible_ranges_computer.dart:143— VisibleRangesComputer._patternVariableRange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (6 pts), match/switch 2 (5 pts), ternaries 1 (4 pts), 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.
SurveyManager.checkForSurveys (cognitive 16) pkg/analysis_server/lib/src/services/user_prompts/survey_manager.dart:56— SurveyManager.checkForSurveys has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
AstWriter._getName (cognitive 16) pkg/analysis_server/lib/src/status/utilities/ast_writer.dart:138— AstWriter._getName has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15 (16 pts) (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.
PluginServer._canUseParsedResult (cognitive 16) pkg/analysis_server_plugin/lib/src/plugin_server.dart:513— PluginServer._canUseParsedResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts) (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.
_ParsedErrorProcessorsData.parse (cognitive 16) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:541— _ParsedErrorProcessorsData.parse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 pts), 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.
_ContextLocator._loadWorkspaceDetailsFromPubspec (cognitive 16) pkg/analyzer/lib/src/dart/analysis/context_locator.dart:662— _ContextLocator._loadWorkspaceDetailsFromPubspec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AnalysisDriver.dispose2 (cognitive 16) pkg/analyzer/lib/src/dart/analysis/driver.dart:734— AnalysisDriver.dispose2 has cognitive complexity 16 (threshold 15). Drivers by points: loops 11 (16 pts) (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.
AnalysisDriver.getLibraryByUri (cognitive 16) pkg/analyzer/lib/src/dart/analysis/driver.dart:896— AnalysisDriver.getLibraryByUri has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), 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.
_DiscoverAvailableFilesJob._discoverChildren (cognitive 16) pkg/analyzer/lib/src/dart/analysis/driver.dart:3170— _DiscoverAvailableFilesJob._discoverChildren has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
EvictingFileByteStore._cleanUpFolder (cognitive 16) pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart:153— EvictingFileByteStore._cleanUpFolder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 3 (6 pts), 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.
FileKind.collectTransitive (cognitive 16) pkg/analyzer/lib/src/dart/analysis/file_state.dart:352— FileKind.collectTransitive has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts) (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.
AstNodeImpl._containsOffset (cognitive 16) pkg/analyzer/lib/src/dart/ast/ast.dart:3578— AstNodeImpl._containsOffset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 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.
ChildEntities.syntacticEntities (cognitive 16) pkg/analyzer/lib/src/dart/ast/ast.dart:7526— ChildEntities.syntacticEntities has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), 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.
ConstantVerifier.visitConstantPattern (cognitive 16) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:135— ConstantVerifier.visitConstantPattern has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (16 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantVerifier._validateSwitchStatement_nullSafety (cognitive 16) pkg/analyzer/lib/src/dart/constant/constant_verifier.dart:1171— ConstantVerifier._validateSwitchStatement_nullSafety has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), 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.
DartObjectComputer.typeInstantiate (cognitive 16) pkg/analyzer/lib/src/dart/constant/evaluation.dart:2880— DartObjectComputer.typeInstantiate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (16 pts) (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FunctionState.isIdentical (cognitive 16) pkg/analyzer/lib/src/dart/constant/value.dart:1467— FunctionState.isIdentical has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (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.
ElementDisplayStringBuilder._writeFormalParameters (cognitive 16) pkg/analyzer/lib/src/dart/element/display_string_builder.dart:406— ElementDisplayStringBuilder._writeFormalParameters has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4, boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TypeParameterElementImpl.computeVarianceInType (cognitive 16) pkg/analyzer/lib/src/dart/element/element.dart:11503— TypeParameterElementImpl.computeVarianceInType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (6 pts), 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.
LeastUpperBoundHelper._futureOr (cognitive 16) pkg/analyzer/lib/src/dart/element/least_upper_bound.dart:796— LeastUpperBoundHelper._futureOr has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5, ternaries 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.
ElementNameUnion.contains (cognitive 16) pkg/analyzer/lib/src/dart/element/name_union.dart:54— ElementNameUnion.contains has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), boolean chains 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.
SubtypeHelper._interfaceArguments (cognitive 16) pkg/analyzer/lib/src/dart/element/subtype.dart:44— SubtypeHelper._interfaceArguments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
AstRewriter.parsedAssignmentTarget (cognitive 16) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:222— AstRewriter.parsedAssignmentTarget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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.
AstRewriter.propertyAccess (cognitive 16) pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart:581— AstRewriter.propertyAccess has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ExitDetector.visitSwitchStatement (cognitive 16) pkg/analyzer/lib/src/dart/resolver/exit_detector.dart:568— ExitDetector.visitSwitchStatement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 2, loops 1 (2 pts) (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.
IncrementOrDecrementResolver._resolveResult (cognitive 16) pkg/analyzer/lib/src/dart/resolver/increment_or_decrement_resolver.dart:290— IncrementOrDecrementResolver._resolveResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MethodInvocationResolver.resolveImportPrefixed (cognitive 16) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:266— MethodInvocationResolver.resolveImportPrefixed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), 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.
MethodInvocationResolver._resolveQualifiedInvocation (cognitive 16) pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart:1227— MethodInvocationResolver._resolveQualifiedInvocation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TypedLiteralResolver._computeSetOrMapResolution (cognitive 16) pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart:249— TypedLiteralResolver._computeSetOrMapResolution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MustCallSuperVerifier.checkMethodDeclaration (cognitive 16) pkg/analyzer/lib/src/error/must_call_super_verifier.dart:19— MustCallSuperVerifier.checkMethodDeclaration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), 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.
TypeArgumentsVerifier._checkInvocationTypeArguments (cognitive 16) pkg/analyzer/lib/src/error/type_arguments_verifier.dart:558— TypeArgumentsVerifier._checkInvocationTypeArguments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
AstBuilder.buildInitializerTargetExpressionRecovery (cognitive 16) pkg/analyzer/lib/src/fasta/ast_builder.dart:764— AstBuilder.buildInitializerTargetExpressionRecovery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), loops 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.
LibraryManifestBuilder._computeHashForRequirements (cognitive 16) pkg/analyzer/lib/src/fine/library_manifest.dart:1158— LibraryManifestBuilder._computeHashForRequirements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), 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.
ManifestNode.match (cognitive 16) pkg/analyzer/lib/src/fine/manifest_ast.dart:137— ManifestNode.match has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 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.
ErrorVerifier.visitSuperFormalParameter (cognitive 16) pkg/analyzer/lib/src/generated/error_verifier.dart:2307— ErrorVerifier.visitSuperFormalParameter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (2 pts), 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.
ErrorVerifier._checkForConstConstructorWithNonConstSuper (cognitive 16) pkg/analyzer/lib/src/generated/error_verifier.dart:4570— ErrorVerifier._checkForConstConstructorWithNonConstSuper has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ErrorVerifier._checkForFunctionBodyCompleteness (cognitive 16) pkg/analyzer/lib/src/generated/error_verifier.dart:5864— ErrorVerifier._checkForFunctionBodyCompleteness has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 2 (5 pts), boolean chains 2 (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.
_WhyNotPromotedVisitor.visitPropertyNotPromotedForNonInherentReason (cognitive 16) pkg/analyzer/lib/src/generated/resolver.dart:6617— _WhyNotPromotedVisitor.visitPropertyNotPromotedForNonInherentReason has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 5 (7 pts) (nesting depth added 8). 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.
_InfoBuilder._buildConstantOffsets (cognitive 16) pkg/analyzer/lib/src/summary2/informative_data.dart:702— _InfoBuilder._buildConstantOffsets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 4 (8 pts) (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.
_MixinInference._inferSingle (cognitive 16) pkg/analyzer/lib/src/summary2/types_builder.dart:552— _MixinInference._inferSingle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), 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.
_OpTypeAstVisitor.visitFieldDeclaration (cognitive 16) pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart:780— _OpTypeAstVisitor.visitFieldDeclaration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Compiler.computeTimings (cognitive 16) pkg/compiler/lib/src/compiler.dart:1103— Compiler.computeTimings has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (9 pts), loops 3 (5 pts), if/else 1 (2 pts) (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.
_DartTypeToStringVisitor.run (cognitive 16) pkg/compiler/lib/src/elements/types.dart:1527— _DartTypeToStringVisitor.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (7 pts), 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.
KernelTypeGraphBuilder.visitConstructor (cognitive 16) pkg/compiler/lib/src/inferrer/builder.dart:311— KernelTypeGraphBuilder.visitConstructor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5 (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.
KernelTypeGraphBuilder.visitSwitchStatement (cognitive 16) pkg/compiler/lib/src/inferrer/builder.dart:615— KernelTypeGraphBuilder.visitSwitchStatement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts) (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.
InferrerEngine._addOverrideTypeInputs (cognitive 16) pkg/compiler/lib/src/inferrer/engine.dart:1104— InferrerEngine._addOverrideTypeInputs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), 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.
KernelGlobalTypeInferenceElementData.compress (cognitive 16) pkg/compiler/lib/src/inferrer/engine.dart:1903— KernelGlobalTypeInferenceElementData.compress has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (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.
RecordTypeMask.containsMask (cognitive 16) pkg/compiler/lib/src/inferrer/typemasks/record_type_mask.dart:252— RecordTypeMask.containsMask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts) (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.
ScopeModelBuilder.computeModel (cognitive 16) pkg/compiler/lib/src/ir/scope_visitor.dart:86— ScopeModelBuilder.computeModel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ScopeModelBuilder.attachCapturedScopeVariables (cognitive 16) pkg/compiler/lib/src/ir/scope_visitor.dart:187— ScopeModelBuilder.attachCapturedScopeVariables has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), 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.
InstantiationStubGenerator.generateStubs (cognitive 16) pkg/compiler/lib/src/js_emitter/instantiation_stub_generator.dart:149— InstantiationStubGenerator.generateStubs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts) (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.
FieldVisitor.visitFields (cognitive 16) pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart:36— FieldVisitor.visitFields has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts) (nesting depth added 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.
ProgramBuilder._buildFields (cognitive 16) pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart:1177— ProgramBuilder._buildFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (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.
RuntimeTypeGenerator.generateIsTests (cognitive 16) pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart:109— RuntimeTypeGenerator.generateIsTests has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
JsKernelToElementMap.getFunctionType (cognitive 16) pkg/compiler/lib/src/js_model/element_map_impl.dart:861— JsKernelToElementMap.getFunctionType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
JsKernelToElementMap._computeClosureName (cognitive 16) pkg/compiler/lib/src/js_model/element_map_impl.dart:2142— JsKernelToElementMap._computeClosureName has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
JClosedWorld.needsNoSuchMethod (cognitive 16) pkg/compiler/lib/src/js_model/js_world.dart:369— JClosedWorld.needsNoSuchMethod has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KernelToElementMap.getFunctionType (cognitive 16) pkg/compiler/lib/src/kernel/element_map_impl.dart:559— KernelToElementMap.getFunctionType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KernelToElementMap.getLocalFunction (cognitive 16) pkg/compiler/lib/src/kernel/element_map_impl.dart:1607— KernelToElementMap.getLocalFunction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts) (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.
KernelSsaGraphBuilder._buildInitializers (cognitive 16) pkg/compiler/lib/src/ssa/builder.dart:1151— KernelSsaGraphBuilder._buildInitializers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KernelSsaGraphBuilder._buildExternalNativeFunctionNode (cognitive 16) pkg/compiler/lib/src/ssa/builder.dart:2107— KernelSsaGraphBuilder._buildExternalNativeFunctionNode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
KernelSsaGraphBuilder._handleSwitch (cognitive 16) pkg/compiler/lib/src/ssa/builder.dart:3829— KernelSsaGraphBuilder._handleSwitch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), 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.
SsaValueRangeAnalyzer.visitBoundsCheck (cognitive 16) pkg/compiler/lib/src/ssa/value_range_analyzer.dart:908— SsaValueRangeAnalyzer.visitBoundsCheck has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (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.
MemberUsage.MemberUsage (cognitive 16) pkg/compiler/lib/src/universe/member_usage.dart:49— MemberUsage.MemberUsage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MemberUsage.dataEquals (cognitive 16) pkg/compiler/lib/src/universe/member_usage.dart:251— MemberUsage.dataEquals has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 16. 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.
IsolateManager._resume (cognitive 16) pkg/dap_adapters/lib/src/isolate_manager.dart:327— IsolateManager._resume has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DartRuntimeServiceRpcs.registerRpcsWithPeer (cognitive 16) pkg/dart_runtime_service/lib/src/dart_runtime_service_rpcs.dart:75— DartRuntimeServiceRpcs.registerRpcsWithPeer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (4 pts), 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.
EventStreamManager.streamListen (cognitive 16) pkg/dart_runtime_service/lib/src/event_streams.dart:297— EventStreamManager.streamListen has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts) (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.
InstallCommand._installExecutablesOnPath (cognitive 16) pkg/dartdev/lib/src/commands/install.dart:447— InstallCommand._installExecutablesOnPath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 1 (4 pts), boolean chains 2, 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.
Printer.ifOut (cognitive 16) pkg/dev_compiler/lib/src/js_ast/printer.dart:342— Printer.ifOut has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Printer.nameSpecifierOut (cognitive 16) pkg/dev_compiler/lib/src/js_ast/printer.dart:1577— Printer.nameSpecifierOut has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (8 pts) (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SourceMapPrintingContext.exitNode (cognitive 16) pkg/dev_compiler/lib/src/js_ast/source_map_printer.dart:109— SourceMapPrintingContext.exitNode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (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.
ProgramCompiler._emitArgumentGroups (cognitive 16) pkg/dev_compiler/lib/src/kernel/compiler.dart:7165— ProgramCompiler._emitArgumentGroups has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3, ternaries 3, boolean chains 2 (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.
LibraryCompiler._initializeFields (cognitive 16) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:2689— LibraryCompiler._initializeFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts) (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.
LibraryCompiler._rewriteInvocationWithHotReloadChecks (cognitive 16) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7787— LibraryCompiler._rewriteInvocationWithHotReloadChecks has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (7 pts), if/else 4 (6 pts), boolean chains 2, ternaries 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.
LibraryCompiler._emitArgumentGroups (cognitive 16) pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8032— LibraryCompiler._emitArgumentGroups has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3, ternaries 3, boolean chains 2 (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.
DevCompilerConstants.getFieldValueFromAnnotation (cognitive 16) pkg/dev_compiler/lib/src/kernel/constants.dart:27— DevCompilerConstants.getFieldValueFromAnnotation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (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.
DTDClient._streamListen (cognitive 16) pkg/dtd_impl/lib/src/dtd_client.dart:96— DTDClient._streamListen has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 2 (4 pts), error handling 1 (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.
MetadataProvider._processMetadata (cognitive 16) pkg/dwds/lib/src/debugging/metadata/provider.dart:164— MetadataProvider._processMetadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 1 (4 pts), loops 1 (3 pts), 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.
ComputedMutableNameSpaceImpl.addLocalMember (cognitive 16) pkg/front_end/lib/src/base/name_space.dart:55— ComputedMutableNameSpaceImpl.addLocalMember has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, ternaries 1 (2 pts) (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.
FunctionTypeBuilderImpl.FunctionTypeBuilderImpl (cognitive 16) pkg/front_end/lib/src/builder/function_type_builder.dart:52— FunctionTypeBuilderImpl.FunctionTypeBuilderImpl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 2, ternaries 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.
FunctionTypeBuilderImpl.buildAliased (cognitive 16) pkg/front_end/lib/src/builder/function_type_builder.dart:165— FunctionTypeBuilderImpl.buildAliased has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), 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.
TypeAliasBuilderImpl.unaliasTypeArguments (cognitive 16) pkg/front_end/lib/src/builder/type_alias_builder.dart:539— TypeAliasBuilderImpl.unaliasTypeArguments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), 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.
BodyBuilderImpl.endMetadata (cognitive 16) pkg/front_end/lib/src/kernel/body_builder.dart:4817— BodyBuilderImpl.endMetadata has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (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.
BodyBuilderImpl._buildForLoopVariableDeclarations (cognitive 16) pkg/front_end/lib/src/kernel/body_builder.dart:10988— BodyBuilderImpl._buildForLoopVariableDeclarations has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BodyBuilderImpl._computeForInElement (cognitive 16) pkg/front_end/lib/src/kernel/body_builder.dart:11069— BodyBuilderImpl._computeForInElement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (16 pts) (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.
BodyBuilderImpl._prepareInitializers (cognitive 16) pkg/front_end/lib/src/kernel/body_builder.dart:11340— BodyBuilderImpl._prepareInitializers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConstantEvaluator.visitInstanceCreation (cognitive 16) pkg/front_end/lib/src/kernel/constant_evaluator.dart:3686— ConstantEvaluator.visitInstanceCreation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (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.
DelayedAssignment.handleAssignment (cognitive 16) pkg/front_end/lib/src/kernel/expression_generator.dart:6080— DelayedAssignment.handleAssignment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. 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.
InternalSwitchStatementCase.toTextInternal (cognitive 16) pkg/front_end/lib/src/kernel/internal_ast.dart:193— InternalSwitchStatementCase.toTextInternal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts) (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. This shape REPEATS in the file: one other method here (InternalPatternSwitchCase.toTextInternal) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
InternalPatternSwitchCase.toTextInternal (cognitive 16) pkg/front_end/lib/src/kernel/internal_ast.dart:7476— InternalPatternSwitchCase.toTextInternal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts) (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. This shape REPEATS in the file: one other method here (InternalSwitchStatementCase.toTextInternal) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NominalParameterNameSpace.addTypeParameters (cognitive 16) pkg/front_end/lib/src/source/nominal_parameter_name_space.dart:15— NominalParameterNameSpace.addTypeParameters has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
OutlineBuilder.beginClassDeclaration (cognitive 16) pkg/front_end/lib/src/source/outline_builder.dart:1080— OutlineBuilder.beginClassDeclaration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
InferredMapOrSetElementInferenceContext.inferElementType (cognitive 16) pkg/front_end/lib/src/type_inference/element_inference.dart:529— InferredMapOrSetElementInferenceContext.inferElementType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts) (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.
InferenceVisitorImpl.visitIndexSet (cognitive 16) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6350— InferenceVisitorImpl.visitIndexSet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceVisitorImpl.visitExtensionIfNullIndexSet (cognitive 16) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7257— InferenceVisitorImpl.visitExtensionIfNullIndexSet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (16 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InferenceVisitorImpl.dispatchPatternSchema (cognitive 16) pkg/front_end/lib/src/type_inference/inference_visitor.dart:11359— InferenceVisitorImpl.dispatchPatternSchema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 1 (3 pts), ternaries 1 (3 pts), match/switch 1 (2 pts), 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.
InferenceVisitorImpl.visitObjectPattern (cognitive 16) pkg/front_end/lib/src/type_inference/inference_visitor.dart:12652— InferenceVisitorImpl.visitObjectPattern has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3, match/switch 1 (2 pts), 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.
InferenceVisitorImpl.visitMapPattern (cognitive 16) pkg/front_end/lib/src/type_inference/inference_visitor.dart:13050— InferenceVisitorImpl.visitMapPattern has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 1, ternaries 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.
ExtensionAccessCandidate.isMoreSpecificThan (cognitive 16) pkg/front_end/lib/src/type_inference/object_access_target.dart:1463— ExtensionAccessCandidate.isMoreSpecificThan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (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.
IncrementalJavaScriptBundler.invalidate (cognitive 16) pkg/frontend_server/lib/src/javascript_bundle.dart:107— IncrementalJavaScriptBundler.invalidate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (6 pts), boolean chains 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.
ResidentFrontendServer._getResidentCompilerForEntrypoint (cognitive 16) pkg/frontend_server/lib/src/resident_frontend_server.dart:401— ResidentFrontendServer._getResidentCompilerForEntrypoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (3 pts) (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.
Printer.visitObjectInitializer (cognitive 16) pkg/js_ast/lib/src/printer.dart:1599— Printer.visitObjectInitializer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, 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.
StringToSource.writeString (cognitive 16) pkg/js_ast/lib/src/strings.dart:75— StringToSource.writeString has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 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.
TypedefTearOffConstant.== (cognitive 16) pkg/kernel/lib/src/ast/constants.dart:1054— TypedefTearOffConstant.== has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 pts) (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.
Types.areTypeArgumentsOfSubtypeKernel (cognitive 16) pkg/kernel/lib/src/types.dart:1214— Types.areTypeArgumentsOfSubtypeKernel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
_Visitor.visitRegularFormalParameter (cognitive 16) pkg/linter/lib/src/rules/always_specify_types.dart:134— _Visitor.visitRegularFormalParameter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4 (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.
_Visitor.visitComment (cognitive 16) pkg/linter/lib/src/rules/comment_references.dart:41— _Visitor.visitComment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), 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.
_Visitor.visitConditionalExpression (cognitive 16) pkg/linter/lib/src/rules/prefer_null_aware_operators.dart:36— _Visitor.visitConditionalExpression has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DependOnReferencedPackages.registerNodeProcessors (cognitive 16) pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart:26— DependOnReferencedPackages.registerNodeProcessors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), 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.
_Visitor.checkMethods (cognitive 16) pkg/linter/lib/src/rules/public_member_api_docs.dart:73— _Visitor.checkMethods has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3, 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.
_Visitor.parametersMatch (cognitive 16) pkg/linter/lib/src/rules/unnecessary_lambdas.dart:107— _Visitor.parametersMatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 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.
DebuggerLocation._parseScriptLine (cognitive 16) pkg/observatory/lib/src/debugger/debugger_location.dart:77— DebuggerLocation._parseScriptLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AllocationProfileElement.render (cognitive 16) pkg/observatory/lib/src/elements/allocation_profile.dart:104— AllocationProfileElement.render has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 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.
DebuggerFrameElement.render (cognitive 16) pkg/observatory/lib/src/elements/debugger.dart:2572— DebuggerFrameElement.render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SampleProfileLoadingProgress._run (cognitive 16) pkg/observatory/lib/src/repositories/sample_profile.dart:47— SampleProfileLoadingProgress._run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 1 (3 pts), boolean chains 1, error handling 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.
SampleProfile.buildFunctionTrie (cognitive 16) pkg/observatory/lib/src/sample_profile/sample_profile.dart:1233— SampleProfile.buildFunctionTrie has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts) (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. This shape REPEATS in the file: one other method here (SampleProfile.buildCodeTrie) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SampleProfile.buildCodeTrie (cognitive 16) pkg/observatory/lib/src/sample_profile/sample_profile.dart:1288— SampleProfile.buildCodeTrie has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts) (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. This shape REPEATS in the file: one other method here (SampleProfile.buildFunctionTrie) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_TokenIterator.moveNextPattern (cognitive 16) runtime/tools/heapsnapshot/lib/src/expression.dart:481— _TokenIterator.moveNextPattern has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 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.
FlowGraph._collectInstructions (cognitive 16) pkg/vm/lib/testing/il_matchers.dart:42— FlowGraph._collectInstructions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (4 pts), 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.
_DispatchableInvocation._collectTargetsForConcreteType (cognitive 16) pkg/vm/lib/transformations/type_flow/analysis.dart:762— _DispatchableInvocation._collectTargetsForConcreteType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (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.
_DispatchableInvocation._collectTargetsForDynamicallyExtendableType (cognitive 16) pkg/vm/lib/transformations/type_flow/analysis.dart:862— _DispatchableInvocation._collectTargetsForDynamicallyExtendableType has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), 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.
ConeType.intersection (cognitive 16) pkg/vm/lib/transformations/type_flow/types.dart:908— ConeType.intersection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), 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.
ConcreteType.== (cognitive 16) pkg/vm/lib/transformations/type_flow/types.dart:1346— ConcreteType.== has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 1 (3 pts), 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.
PRESUBMIT.CheckNodeTextExpectationsCollectorUpdatingIsDisabled (cognitive 16) pkg/analyzer/PRESUBMIT.py:74— PRESUBMIT.CheckNodeTextExpectationsCollectorUpdatingIsDisabled has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts) (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.
DatabaseBuilder._sign (cognitive 16) tools/dom/scripts/databasebuilder.py:267— DatabaseBuilder._sign has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), 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.
LibraryLoader.load (cognitive 16) REDACTED:214— LibraryLoader.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D4 · Code Duplication· Near-duplicate member family (6 members, 47 shared lines) · ×1
Near-duplicate member family (6 members, 47 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1382— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1382-1461 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1463-1539 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1725-1915 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1917-2005 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2007-2115 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2309-2471 — These 6 members are variants of one another: a block of 47 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 22 shared lines) · ×1
Near-duplicate member family (4 members, 22 shared lines) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:534— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:534-600 | sdk/lib/_internal/js_runtime/lib/js_number.dart:625-690 | sdk/lib/_internal/vm/lib/integers.dart:444-511 | sdk/lib/_internal/wasm/common/boxed_int.dart:337-404 — These 4 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 151 shared lines) · ×1
Near-duplicate member family (3 members, 151 shared lines) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1504— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1504-1757 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1523-1775 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2112-2359 — These 3 members are variants of one another: a block of 151 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 131 shared lines) · ×1
Near-duplicate member family (3 members, 131 shared lines) sdk/lib/_internal/vm/lib/convert_patch.dart:1303— sdk/lib/_internal/vm/lib/convert_patch.dart:1303-1459 | sdk/lib/_internal/wasm/common/convert_patch.dart:1489-1645 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1181-1337 — These 3 members are variants of one another: a block of 131 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 66 shared lines) · ×1
Near-duplicate member family (3 members, 66 shared lines) pkg/front_end/lib/src/dill/dill_class_builder.dart:39— pkg/front_end/lib/src/dill/dill_class_builder.dart:39-225 | pkg/front_end/lib/src/dill/dill_extension_builder.dart:34-203 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:38-366 — These 3 members are variants of one another: a block of 66 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 18 shared lines) · ×1
Near-duplicate member family (3 members, 18 shared lines) pkg/wasm_builder/lib/src/serialize/sections.dart:1183— pkg/wasm_builder/lib/src/serialize/sections.dart:1183-1204 | pkg/wasm_builder/lib/src/serialize/sections.dart:1235-1263 | pkg/wasm_builder/lib/src/serialize/sections.dart:1291-1312 — These 3 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (318 shared lines) pkg/dev_compiler/lib/src/kernel/compiler.dart:6709— pkg/dev_compiler/lib/src/kernel/compiler.dart:6709-7041 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7398-7751 — These two members are variants of one another: 318 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (132 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7066— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7066-7255 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7257-7524 — These two members are variants of one another: 132 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (125 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8423— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8423-8669 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8856-9125 — These two members are variants of one another: 125 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (99 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8423— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8423-8669 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8671-8854 — These two members are variants of one another: 99 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (97 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8671— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8671-8854 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8856-9125 — These two members are variants of one another: 97 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (69 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6821-7064 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8423-8669 — These two members are variants of one another: 69 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (68 shared lines) pkg/compiler/lib/src/js_model/element_map_impl.dart:683— pkg/compiler/lib/src/js_model/element_map_impl.dart:683-796 | pkg/compiler/lib/src/kernel/element_map_impl.dart:355-466 — These two members are variants of one another: 68 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (51 shared lines) pkg/dev_compiler/lib/src/js_ast/builder.dart:1421— pkg/dev_compiler/lib/src/js_ast/builder.dart:1421-1502 | pkg/js_ast/lib/src/builder.dart:1236-1309 — These two members are variants of one another: 51 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (50 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6350— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6350-6477 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6479-6572 — These two members are variants of one another: 50 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (44 shared lines) pkg/analyzer/lib/src/summary2/library_builder.dart:454— pkg/analyzer/lib/src/summary2/library_builder.dart:454-520 | pkg/analyzer/lib/src/summary2/library_builder.dart:522-602 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (42 shared lines) pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:156— pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:156-315 | pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart:507-654 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (41 shared lines) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7066— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7066-7255 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8671-8854 — These two members are variants of one another: 41 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (39 shared lines) pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2539— pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2539-2582 | pkg/analysis_server/tool/code_completion/relevance_table_generator.dart:2615-2658 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (28 shared lines) pkg/front_end/testcases/general/constants/potentially_constant_type.dart:49— pkg/front_end/testcases/general/constants/potentially_constant_type.dart:49-106 | pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:33-69 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (26 shared lines) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1060— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1060-1093 | sdk/lib/_internal/wasm/common/compact_hash.dart:980-1013 — These two members are variants of one another: 26 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) pkg/observatory/lib/src/elements/heap_snapshot.dart:670— pkg/observatory/lib/src/elements/heap_snapshot.dart:670-966 | pkg/observatory/lib/src/elements/process_snapshot.dart:358-450 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×1
Edited copy of a member (31 corresponding lines) pkg/wasm_builder/lib/src/ir/type.dart:763— pkg/wasm_builder/lib/src/ir/type.dart:763-808 | pkg/wasm_builder/lib/src/ir/type.dart:810-857 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1608— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:1608-1617 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1896-1905 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) pkg/kernel/lib/src/ast/expressions.dart:1603— pkg/kernel/lib/src/ast/expressions.dart:1603-1627 | pkg/kernel/lib/src/ast/expressions.dart:4870-4894 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (16 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (16 members, 50+ identical tokens) sdk/lib/internal/internal.dart:215— sdk/lib/internal/internal.dart:215-223 | sdk/lib/internal/internal.dart:225-234 | sdk/lib/internal/internal.dart:236-255 | sdk/lib/internal/internal.dart:257-278 | sdk/lib/internal/internal.dart:280-303 | sdk/lib/internal/internal.dart:305-330 | sdk/lib/internal/internal.dart:332-359 | sdk/lib/internal/internal.dart:361-390 | sdk/lib/internal/internal.dart:392-423 | sdk/lib/internal/internal.dart:425-458 | sdk/lib/internal/internal.dart:460-495 | sdk/lib/internal/internal.dart:497-534 | sdk/lib/internal/internal.dart:536-575 | sdk/lib/internal/internal.dart:577-618 | sdk/lib/internal/internal.dart:620-663 | sdk/lib/internal/internal.dart:665-710 — These 16 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 16 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 16 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:157— pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:157-176 | pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:178-197 | pkg/observatory/lib/src/elements/heap_snapshot.dart:968-993 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1049-1065 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1067-1092 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1108-1129 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1131-1146 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1148-1172 | pkg/observatory/lib/src/elements/process_snapshot.dart:454-470 | pkg/observatory/lib/src/elements/process_snapshot.dart:472-497 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
Duplicated block (125–128 lines × 2) pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1151— pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart:1151-1278 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart:478-602 — before extracting anything, compare `pkg/_fe_analyzer_shared/lib/src/scanner/abstract_scanner.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/files/copy_me/copy_me.dart` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 867 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (123–124 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6911— pkg/dev_compiler/lib/src/kernel/compiler.dart:6911-7033 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7598-7721 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (119 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:2693— pkg/dev_compiler/lib/src/kernel/compiler.dart:2693-2811 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:3003-3121 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (117 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6341— pkg/dev_compiler/lib/src/kernel/compiler.dart:6341-6457 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7030-7146 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (116 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6709— pkg/dev_compiler/lib/src/kernel/compiler.dart:6709-6824 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7398-7513 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (88 lines × 2) pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:156— pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:156-243 | pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart:466-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (82 lines × 2) pkg/front_end/parser_testcases/patterns/const_patterns.dart:36— pkg/front_end/parser_testcases/patterns/const_patterns.dart:36-117 | pkg/front_end/testcases/patterns/const_patterns.dart:42-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (78–79 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6828— pkg/dev_compiler/lib/src/kernel/compiler.dart:6828-6906 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:7517-7594 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (68–71 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7186— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7186-7253 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7448-7518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (68–69 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:7758— pkg/dev_compiler/lib/src/kernel/compiler.dart:7758-7825 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8625-8693 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (66 lines × 2) pkg/compiler/lib/src/js/size_estimator.dart:732— pkg/compiler/lib/src/js/size_estimator.dart:732-797 | pkg/js_ast/lib/src/printer.dart:1107-1172 — before extracting anything, compare `pkg/compiler/lib/src/js/size_estimator.dart` and `pkg/js_ast/lib/src/printer.dart` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (65 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_number.dart:536— sdk/lib/_internal/js_dev_runtime/private/js_number.dart:536-600 | sdk/lib/_internal/js_runtime/lib/js_number.dart:626-690 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_number.dart` and `sdk/lib/_internal/js_runtime/lib/js_number.dart` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (62 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:6011— pkg/dev_compiler/lib/src/kernel/compiler.dart:6011-6072 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6700-6761 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (59–60 lines × 2) pkg/front_end/lib/src/fragment/field/encoding.dart:1254— pkg/front_end/lib/src/fragment/field/encoding.dart:1254-1313 | pkg/front_end/lib/src/fragment/field/encoding.dart:1820-1878 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (56–60 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8562— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8562-8617 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9019-9078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (50–57 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:8597— pkg/front_end/lib/src/type_inference/inference_visitor.dart:8597-8647 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8794-8843 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9054-9110 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (57 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4668— pkg/dev_compiler/lib/src/kernel/compiler.dart:4668-4724 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:5278-5334 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (55 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:4055— pkg/dev_compiler/lib/src/kernel/compiler.dart:4055-4109 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:4651-4705 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (53–54 lines × 2) pkg/analyzer/lib/src/fasta/ast_builder.dart:238— pkg/analyzer/lib/src/fasta/ast_builder.dart:238-291 | pkg/analyzer/lib/src/fasta/ast_builder.dart:510-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (52 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:5215— pkg/front_end/lib/src/kernel/body_builder.dart:5215-5266 | pkg/front_end/lib/src/source/outline_builder.dart:3747-3798 — before extracting anything, compare `pkg/front_end/lib/src/kernel/body_builder.dart` and `pkg/front_end/lib/src/source/outline_builder.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (51 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1665— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1665-1715 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1683-1733 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2267-2317 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (39–48 lines × 2) pkg/dart2wasm/lib/list_factory_specializer.dart:113— pkg/dart2wasm/lib/list_factory_specializer.dart:113-160 | pkg/vm/lib/modular/specializer/list_factory_specializer.dart:135-173 — before extracting anything, compare `pkg/dart2wasm/lib/list_factory_specializer.dart` and `pkg/vm/lib/modular/specializer/list_factory_specializer.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (45 lines × 2) pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:292— pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:292-336 | pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart:753-797 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28–44 lines × 2) pkg/analyzer/lib/src/error/error_handler_verifier.dart:337— pkg/analyzer/lib/src/error/error_handler_verifier.dart:337-364 | pkg/analyzer/lib/src/error/error_handler_verifier.dart:370-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (44 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:8088— pkg/dev_compiler/lib/src/kernel/compiler.dart:8088-8131 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:8957-9000 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (41 lines × 2) pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:168— pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:168-208 | pkg/analyzer/lib/src/dart/element/replacement_visitor.dart:274-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (39–40 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6835— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6835-6873 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8437-8476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (36–38 lines × 2) sdk/lib/_internal/wasm/js/string_patch.dart:154— sdk/lib/_internal/wasm/js/string_patch.dart:154-191 | sdk/lib/_internal/wasm/standalone/string_patch.dart:112-147 — `sdk/lib/_internal/wasm/js/string_patch.dart` and `sdk/lib/_internal/wasm/standalone/string_patch.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (37–38 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4007— pkg/front_end/lib/src/kernel/constant_evaluator.dart:4007-4044 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:4068-4104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (36–37 lines × 3) pkg/front_end/lib/src/source/fragment_factory_impl.dart:1873— pkg/front_end/lib/src/source/fragment_factory_impl.dart:1873-1908 | pkg/front_end/lib/src/source/fragment_factory_impl.dart:1948-1983 | pkg/front_end/lib/src/source/fragment_factory_impl.dart:2027-2063 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (35–36 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:697— pkg/front_end/lib/src/fragment/getter/encoding.dart:697-732 | pkg/front_end/lib/src/fragment/method/encoding.dart:698-732 | pkg/front_end/lib/src/fragment/setter/encoding.dart:723-758 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (35 lines × 6) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1384— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1384-1418 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1465-1499 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1727-1761 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1919-1953 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2009-2043 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2311-2345 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (27–35 lines × 2) pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:1240— pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:1240-1266 | pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart:1320-1354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (31–35 lines × 2) pkg/front_end/lib/src/fragment/constructor/declaration.dart:853— pkg/front_end/lib/src/fragment/constructor/declaration.dart:853-883 | pkg/front_end/lib/src/fragment/constructor/declaration.dart:1338-1372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34–35 lines × 2) pkg/front_end/lib/src/kernel/body_builder.dart:9413— pkg/front_end/lib/src/kernel/body_builder.dart:9413-9446 | pkg/front_end/lib/src/kernel/body_builder.dart:9535-9569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24–34 lines × 5) pkg/analyzer/tool/ast/generate.dart:420— pkg/analyzer/tool/ast/generate.dart:420-447 | pkg/analyzer/tool/ast/generate.dart:494-517 | pkg/analyzer/tool/ast/generate.dart:571-603 | pkg/analyzer/tool/ast/generate.dart:658-686 | pkg/analyzer/tool/ast/generate.dart:746-779 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (32–33 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6938— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6938-6970 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7141-7172 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7400-7432 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (20–33 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:1628— pkg/front_end/lib/src/kernel/constant_evaluator.dart:1628-1660 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:2178-2197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32–33 lines × 2) pkg/front_end/lib/src/kernel/resolver.dart:385— pkg/front_end/lib/src/kernel/resolver.dart:385-417 | pkg/front_end/lib/src/kernel/resolver.dart:673-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30–31 lines × 2) pkg/front_end/lib/src/base/incremental_compiler.dart:3240— pkg/front_end/lib/src/base/incremental_compiler.dart:3240-3270 | pkg/front_end/lib/src/base/incremental_compiler.dart:3606-3635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–31 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7093— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7093-7121 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7347-7377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24–30 lines × 3) pkg/analyzer/tool/ast/generate.dart:381— pkg/analyzer/tool/ast/generate.dart:381-404 | pkg/analyzer/tool/ast/generate.dart:616-640 | pkg/analyzer/tool/ast/generate.dart:704-733 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (29 lines × 3) sdk/lib/_internal/vm/lib/convert_patch.dart:1431— sdk/lib/_internal/vm/lib/convert_patch.dart:1431-1459 | sdk/lib/_internal/wasm/common/convert_patch.dart:1617-1645 | sdk/lib/_internal/wasm/js_compatibility/convert_patch.dart:1309-1337 — before extracting anything, compare `sdk/lib/_internal/vm/lib/convert_patch.dart` and `sdk/lib/_internal/wasm/common/convert_patch.dart` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 214 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (28–29 lines × 2) pkg/front_end/lib/src/builder/type_parameter_builder.dart:283— pkg/front_end/lib/src/builder/type_parameter_builder.dart:283-310 | pkg/front_end/lib/src/builder/type_parameter_builder.dart:542-570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (28 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:525— pkg/front_end/lib/src/fragment/getter/encoding.dart:525-552 | pkg/front_end/lib/src/fragment/method/encoding.dart:530-557 | pkg/front_end/lib/src/fragment/setter/encoding.dart:542-569 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (26–28 lines × 2) pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7215— pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7215-7240 | pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart:7440-7467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–28 lines × 2) pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1430— pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1430-1457 | pkg/analyzer/lib/src/analysis_options/analysis_options_parse_model.dart:1856-1880 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27–28 lines × 2) pkg/compiler/lib/src/ssa/builder.dart:4164— pkg/compiler/lib/src/ssa/builder.dart:4164-4190 | pkg/compiler/lib/src/ssa/builder.dart:4250-4277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–28 lines × 2) pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart:150— pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart:150-170 | pkg/dds/lib/src/devtools/memory_profile.dart:173-200 — before extracting anything, compare `pkg/dart_runtime_service/lib/src/devtools/memory_profile.dart` and `pkg/dds/lib/src/devtools/memory_profile.dart` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (26–27 lines × 6) pkg/front_end/lib/src/fragment/getter/encoding.dart:245— pkg/front_end/lib/src/fragment/getter/encoding.dart:245-270 | pkg/front_end/lib/src/fragment/getter/encoding.dart:512-538 | pkg/front_end/lib/src/fragment/method/encoding.dart:188-213 | pkg/front_end/lib/src/fragment/method/encoding.dart:517-543 | pkg/front_end/lib/src/fragment/setter/encoding.dart:243-269 | pkg/front_end/lib/src/fragment/setter/encoding.dart:529-555 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (24–27 lines × 2) pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart:57— pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_edit_argument.dart:57-83 | pkg/analysis_server/lib/src/lsp/handlers/custom/editable_arguments/handler_editable_arguments.dart:48-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (25–27 lines × 2) pkg/linter/lib/src/rules/use_build_context_synchronously.dart:350— pkg/linter/lib/src/rules/use_build_context_synchronously.dart:350-374 | pkg/linter/lib/src/rules/use_build_context_synchronously.dart:378-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–26 lines × 4) pkg/analysis_server/lib/src/status/pages/assists_page.dart:27— pkg/analysis_server/lib/src/status/pages/assists_page.dart:27-52 | pkg/analysis_server/lib/src/status/pages/code_completion_page.dart:28-52 | pkg/analysis_server/lib/src/status/pages/fixes_page.dart:27-52 | pkg/analysis_server/lib/src/status/pages/refactorings_page.dart:28-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (22–26 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1530— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1530-1555 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1548-1573 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2137-2158 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24–26 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7005— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7005-7028 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7205-7229 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7469-7494 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (25 lines × 6) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1596— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1596-1620 | sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1638-1662 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1614-1638 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1656-1680 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2198-2222 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:2240-2264 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24–25 lines × 4) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:91— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:91-115 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:313-337 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1331-1355 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1606-1629 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (25 lines × 3) sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1268— sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart:1268-1292 | sdk/lib/_internal/js_runtime/lib/bigint_patch.dart:1271-1295 | sdk/lib/_internal/vm_shared/lib/bigint_patch.dart:1731-1755 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/patch/bigint_patch.dart` and `sdk/lib/_internal/js_runtime/lib/bigint_patch.dart` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 537 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23–25 lines × 3) pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:60— pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:60-84 | pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:194-216 | pkg/analysis_server/lib/src/services/correction/dart/create_extension_member.dart:537-561 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (21–25 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2782— pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2782-2806 | pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:2935-2955 | pkg/front_end/lib/src/type_inference/inference_visitor_base.dart:3228-3252 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22–25 lines × 2) pkg/dart2wasm/lib/list_factory_specializer.dart:166— pkg/dart2wasm/lib/list_factory_specializer.dart:166-190 | pkg/vm/lib/modular/specializer/list_factory_specializer.dart:111-132 — before extracting anything, compare `pkg/dart2wasm/lib/list_factory_specializer.dart` and `pkg/vm/lib/modular/specializer/list_factory_specializer.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (24–25 lines × 2) pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:736— pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:736-759 | pkg/analyzer/lib/src/dart/resolver/element_binding_visitor.dart:1019-1043 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–25 lines × 2) pkg/dart_runtime_service/lib/src/devtools/vs_code.dart:84— pkg/dart_runtime_service/lib/src/devtools/vs_code.dart:84-106 | pkg/dds/lib/src/devtools/vs_code.dart:85-109 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (24 lines × 14) pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:157— pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:157-180 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:262-285 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:595-618 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:653-676 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:722-745 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:811-834 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:855-878 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:896-919 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:979-1002 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1029-1052 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1087-1110 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1229-1252 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1274-1297 | pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart:1428-1451 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (23–24 lines × 3) pkg/analyzer/lib/src/generated/error_verifier.dart:1381— pkg/analyzer/lib/src/generated/error_verifier.dart:1381-1403 | pkg/analyzer/lib/src/generated/error_verifier.dart:1742-1764 | pkg/analyzer/lib/src/generated/error_verifier.dart:2425-2448 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (24 lines × 3) pkg/front_end/lib/src/fragment/getter/encoding.dart:573— pkg/front_end/lib/src/fragment/getter/encoding.dart:573-596 | pkg/front_end/lib/src/fragment/method/encoding.dart:580-603 | pkg/front_end/lib/src/fragment/setter/encoding.dart:591-614 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (22–24 lines × 2) pkg/analyzer/lib/src/error/element_usage_detector.dart:432— pkg/analyzer/lib/src/error/element_usage_detector.dart:432-453 | pkg/analyzer/lib/src/error/element_usage_detector.dart:1020-1043 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 8) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1389— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1389-1411 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1470-1492 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1732-1754 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1924-1946 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2014-2036 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2316-2338 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6581-6603 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8863-8885 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22–23 lines × 7) pkg/front_end/lib/src/dill/dill_class_builder.dart:115— pkg/front_end/lib/src/dill/dill_class_builder.dart:115-136 | pkg/front_end/lib/src/dill/dill_class_builder.dart:198-219 | pkg/front_end/lib/src/dill/dill_extension_builder.dart:88-110 | pkg/front_end/lib/src/dill/dill_extension_builder.dart:121-143 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:98-120 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:203-225 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:237-259 — before extracting anything, compare `pkg/front_end/lib/src/dill/dill_class_builder.dart` and `pkg/front_end/lib/src/dill/dill_extension_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 4) sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart:295— sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart:295-317 | sdk/lib/_internal/js_runtime/lib/regexp_helper.dart:311-333 | sdk/lib/_internal/wasm/js_common/regexp_helper.dart:281-303 | sdk/lib/_internal/wasm/standalone/regexp.dart:197-219 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/regexp_helper.dart` and `sdk/lib/_internal/js_runtime/lib/regexp_helper.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22–23 lines × 4) pkg/front_end/lib/src/dill/dill_class_builder.dart:86— pkg/front_end/lib/src/dill/dill_class_builder.dart:86-107 | pkg/front_end/lib/src/dill/dill_extension_builder.dart:154-175 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:67-89 | pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart:272-293 — before extracting anything, compare `pkg/front_end/lib/src/dill/dill_class_builder.dart` and `pkg/front_end/lib/src/dill/dill_extension_builder.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20–23 lines × 2) pkg/analyzer/tool/ast/generate.dart:196— pkg/analyzer/tool/ast/generate.dart:196-218 | pkg/analyzer/tool/ast/generate.dart:1187-1206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–23 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:300— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:300-320 | sdk/lib/_internal/js_runtime/lib/js_array.dart:406-428 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21–22 lines × 4) pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:120— pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:120-141 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:224-245 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:273-294 | pkg/analysis_server/tool/benchmark_tools/single_benchmarks/lsp_type_in_big_file.dart:377-397 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18–22 lines × 2) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart:71— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart:71-92 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart:64-81 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15–22 lines × 2) pkg/front_end/testcases/general/constants/potentially_constant_type.dart:69— pkg/front_end/testcases/general/constants/potentially_constant_type.dart:69-90 | pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:46-60 — before extracting anything, compare `pkg/front_end/testcases/general/constants/potentially_constant_type.dart` and `pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16–22 lines × 2) pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart:93— pkg/analysis_server/lib/src/status/pages/legacy_plugins_page.dart:93-108 | pkg/analysis_server/lib/src/status/pages/plugins_page.dart:272-293 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13–22 lines × 2) pkg/wasm_builder/lib/src/builder/instructions.dart:2220— pkg/wasm_builder/lib/src/builder/instructions.dart:2220-2232 | pkg/wasm_builder/lib/src/builder/instructions.dart:2258-2279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 6) pkg/front_end/lib/src/fragment/getter/encoding.dart:372— pkg/front_end/lib/src/fragment/getter/encoding.dart:372-391 | pkg/front_end/lib/src/fragment/getter/encoding.dart:673-693 | pkg/front_end/lib/src/fragment/method/encoding.dart:303-322 | pkg/front_end/lib/src/fragment/method/encoding.dart:674-694 | pkg/front_end/lib/src/fragment/setter/encoding.dart:374-393 | pkg/front_end/lib/src/fragment/setter/encoding.dart:699-719 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (21 lines × 6) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1410— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1410-1430 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1491-1511 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1753-1773 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1945-1965 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2151-2171 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2337-2357 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18–21 lines × 4) pkg/observatory/lib/src/elements/heap_snapshot.dart:1069— pkg/observatory/lib/src/elements/heap_snapshot.dart:1069-1086 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1110-1127 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1150-1170 | pkg/observatory/lib/src/elements/process_snapshot.dart:474-491 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15–21 lines × 2) pkg/dart_runtime_service/lib/src/devtools/machine_mode_command_handler.dart:270— pkg/dart_runtime_service/lib/src/devtools/machine_mode_command_handler.dart:270-284 | pkg/dds/lib/src/devtools/machine_mode_command_handler.dart:372-392 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13–21 lines × 3) pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1023— pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1023-1043 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1047-1067 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:1068-1080 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–21 lines × 2) pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart:183— pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart:183-195 | pkg/linter/lib/src/rules/collection_methods_unrelated_type.dart:210-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–20 lines × 7) pkg/analyzer/lib/src/dart/ast/ast.dart:20485— pkg/analyzer/lib/src/dart/ast/ast.dart:20485-20503 | pkg/analyzer/lib/src/dart/ast/ast.dart:20509-20527 | pkg/analyzer/lib/src/dart/ast/ast.dart:22086-22105 | pkg/analyzer/lib/src/dart/ast/ast.dart:49654-49672 | pkg/analyzer/lib/src/dart/ast/ast.dart:49678-49696 | pkg/analyzer/lib/src/dart/ast/ast.dart:53133-53151 | pkg/analyzer/lib/src/dart/ast/ast.dart:53157-53175 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (20 lines × 6) pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:42— pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:42-61 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:75-94 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method.dart:108-127 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method_tearoff.dart:42-61 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method_tearoff.dart:75-94 | pkg/vm/testcases/transformations/type_flow/transformer/unboxed_instance_method_tearoff.dart:108-127 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (18–20 lines × 4) pkg/analyzer/tool/ast/generate.dart:636— pkg/analyzer/tool/ast/generate.dart:636-655 | pkg/analyzer/tool/ast/generate.dart:682-701 | pkg/analyzer/tool/ast/generate.dart:897-914 | pkg/analyzer/tool/ast/generate.dart:992-1009 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–20 lines × 2) pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:928— pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:928-947 | pkg/analyzer/lib/src/wolf/ir/ast_to_ir.dart:1359-1375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–20 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5918— pkg/dev_compiler/lib/src/kernel/compiler.dart:5918-5926 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6573-6592 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16–20 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7174— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7174-7193 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8781-8796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 5) sdk/lib/internal/internal.dart:498— sdk/lib/internal/internal.dart:498-516 | sdk/lib/internal/internal.dart:538-556 | sdk/lib/internal/internal.dart:580-598 | sdk/lib/internal/internal.dart:624-642 | sdk/lib/internal/internal.dart:670-688 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 4) pkg/analyzer/lib/src/fine/library_manifest.dart:350— pkg/analyzer/lib/src/fine/library_manifest.dart:350-368 | pkg/analyzer/lib/src/fine/library_manifest.dart:452-470 | pkg/analyzer/lib/src/fine/library_manifest.dart:535-553 | pkg/analyzer/lib/src/fine/library_manifest.dart:733-751 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–19 lines × 2) pkg/analyzer/lib/src/error/element_usage_frontier_detector.dart:48— pkg/analyzer/lib/src/error/element_usage_frontier_detector.dart:48-63 | pkg/analyzer/lib/src/error/element_usage_frontier_detector.dart:154-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–19 lines × 2) pkg/front_end/lib/src/kernel/constant_evaluator.dart:4180— pkg/front_end/lib/src/kernel/constant_evaluator.dart:4180-4198 | pkg/front_end/lib/src/kernel/constant_evaluator.dart:5197-5213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–18 lines × 8) pkg/analyzer/tool/ast/generate.dart:400— pkg/analyzer/tool/ast/generate.dart:400-417 | pkg/analyzer/tool/ast/generate.dart:443-460 | pkg/analyzer/tool/ast/generate.dart:477-491 | pkg/analyzer/tool/ast/generate.dart:513-527 | pkg/analyzer/tool/ast/generate.dart:554-568 | pkg/analyzer/tool/ast/generate.dart:599-613 | pkg/analyzer/tool/ast/generate.dart:729-743 | pkg/analyzer/tool/ast/generate.dart:775-789 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18 lines × 7) sdk/lib/internal/internal.dart:426— sdk/lib/internal/internal.dart:426-443 | sdk/lib/internal/internal.dart:462-479 | sdk/lib/internal/internal.dart:500-517 | sdk/lib/internal/internal.dart:540-557 | sdk/lib/internal/internal.dart:582-599 | sdk/lib/internal/internal.dart:626-643 | sdk/lib/internal/internal.dart:672-689 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18 lines × 6) pkg/front_end/lib/src/kernel/expression_generator.dart:1754— pkg/front_end/lib/src/kernel/expression_generator.dart:1754-1771 | pkg/front_end/lib/src/kernel/expression_generator.dart:1964-1981 | pkg/front_end/lib/src/kernel/expression_generator.dart:2185-2202 | pkg/front_end/lib/src/kernel/expression_generator.dart:3732-3749 | pkg/front_end/lib/src/kernel/expression_generator.dart:4189-4207 | pkg/front_end/lib/src/kernel/expression_generator.dart:5422-5439 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18 lines × 5) pkg/observatory/lib/src/elements/icdata_view.dart:114— pkg/observatory/lib/src/elements/icdata_view.dart:114-131 | pkg/observatory/lib/src/elements/library_view.dart:136-153 | pkg/observatory/lib/src/elements/singletargetcache_view.dart:122-139 | pkg/observatory/lib/src/elements/subtypetestcache_view.dart:119-136 | pkg/observatory/lib/src/elements/unlinkedcall_view.dart:118-135 — before extracting anything, compare `pkg/observatory/lib/src/elements/icdata_view.dart` and `pkg/observatory/lib/src/elements/singletargetcache_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 4) pkg/kernel/lib/src/tool/check_equivalence.dart:344— pkg/kernel/lib/src/tool/check_equivalence.dart:344-361 | pkg/kernel/lib/src/tool/check_equivalence.dart:436-453 | pkg/kernel/lib/src/tool/check_equivalence.dart:460-477 | pkg/kernel/lib/src/tool/check_equivalence.dart:484-501 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–18 lines × 3) pkg/front_end/lib/src/kernel/resolver.dart:388— pkg/front_end/lib/src/kernel/resolver.dart:388-405 | pkg/front_end/lib/src/kernel/resolver.dart:676-692 | pkg/front_end/lib/src/kernel/resolver.dart:832-848 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16–18 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6386— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6386-6403 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6493-6508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–18 lines × 2) pkg/kernel/lib/src/bounds_checks.dart:714— pkg/kernel/lib/src/bounds_checks.dart:714-731 | pkg/kernel/lib/src/replacement_visitor.dart:352-365 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 8) sdk/lib/internal/internal.dart:393— sdk/lib/internal/internal.dart:393-409 | sdk/lib/internal/internal.dart:427-443 | sdk/lib/internal/internal.dart:463-479 | sdk/lib/internal/internal.dart:501-517 | sdk/lib/internal/internal.dart:541-557 | sdk/lib/internal/internal.dart:583-599 | sdk/lib/internal/internal.dart:627-643 | sdk/lib/internal/internal.dart:673-689 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17 lines × 6) sdk/lib/_internal/vm/lib/typed_data_patch.dart:394— sdk/lib/_internal/vm/lib/typed_data_patch.dart:394-410 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:731-747 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1123-1139 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1466-1482 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1809-1825 | sdk/lib/_internal/wasm/common/typed_data.dart:2271-2287 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 4) pkg/analyzer/lib/src/summary2/bundle_reader.dart:510— pkg/analyzer/lib/src/summary2/bundle_reader.dart:510-526 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:592-608 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:665-681 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1119-1135 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–17 lines × 3) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:126— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:126-139 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart:81-97 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart:70-86 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15–17 lines × 3) pkg/analyzer/lib/src/dart/sdk/sdk.dart:90— pkg/analyzer/lib/src/dart/sdk/sdk.dart:90-106 | pkg/analyzer/lib/src/dart/sdk/sdk.dart:248-262 | pkg/analyzer/lib/src/dart/sdk/sdk.dart:515-529 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–17 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:241— pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:241-257 | pkg/analysis_server/lib/src/services/correction/dart/surround_with.dart:280-292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–17 lines × 2) pkg/front_end/lib/src/type_inference/inference_visitor.dart:7049— pkg/front_end/lib/src/type_inference/inference_visitor.dart:7049-7062 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8649-8665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 14) sdk/lib/internal/internal.dart:237— sdk/lib/internal/internal.dart:237-252 | sdk/lib/internal/internal.dart:259-274 | sdk/lib/internal/internal.dart:283-298 | sdk/lib/internal/internal.dart:309-324 | sdk/lib/internal/internal.dart:337-352 | sdk/lib/internal/internal.dart:367-382 | sdk/lib/internal/internal.dart:399-414 | sdk/lib/internal/internal.dart:433-448 | sdk/lib/internal/internal.dart:469-484 | sdk/lib/internal/internal.dart:507-522 | sdk/lib/internal/internal.dart:547-562 | sdk/lib/internal/internal.dart:589-604 | sdk/lib/internal/internal.dart:633-648 | sdk/lib/internal/internal.dart:679-694 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 6) pkg/front_end/lib/src/fragment/getter/encoding.dart:435— pkg/front_end/lib/src/fragment/getter/encoding.dart:435-450 | pkg/front_end/lib/src/fragment/getter/encoding.dart:765-780 | pkg/front_end/lib/src/fragment/method/encoding.dart:392-407 | pkg/front_end/lib/src/fragment/method/encoding.dart:794-809 | pkg/front_end/lib/src/fragment/setter/encoding.dart:452-467 | pkg/front_end/lib/src/fragment/setter/encoding.dart:807-822 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15–16 lines × 5) pkg/observatory/lib/src/elements/nav/notify_event.dart:91— pkg/observatory/lib/src/elements/nav/notify_event.dart:91-105 | pkg/observatory/lib/src/elements/nav/notify_event.dart:108-122 | pkg/observatory/lib/src/elements/nav/notify_event.dart:149-164 | pkg/observatory/lib/src/elements/nav/notify_event.dart:168-183 | pkg/observatory/lib/src/elements/nav/notify_event.dart:186-200 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–16 lines × 3) pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart:38— pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart:38-52 | pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart:44-59 | pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateless_widget.dart:37-50 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/flutter_stateful_widget_with_animation.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 8) pkg/front_end/lib/src/kernel/internal_ast.dart:2670— pkg/front_end/lib/src/kernel/internal_ast.dart:2670-2684 | pkg/front_end/lib/src/kernel/internal_ast.dart:2863-2877 | pkg/front_end/lib/src/kernel/internal_ast.dart:3193-3207 | pkg/front_end/lib/src/kernel/internal_ast.dart:4436-4450 | pkg/front_end/lib/src/kernel/internal_ast.dart:4592-4606 | pkg/front_end/lib/src/kernel/internal_ast.dart:4735-4749 | pkg/front_end/lib/src/kernel/internal_ast.dart:4879-4893 | pkg/front_end/lib/src/kernel/internal_ast.dart:5007-5021 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 6) pkg/analyzer/lib/src/lint/pub.dart:334— pkg/analyzer/lib/src/lint/pub.dart:334-348 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:239-253 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:985-999 | pkg/front_end/lib/src/fragment/constructor/encoding.dart:1083-1097 | pkg/front_end/lib/src/kernel/resolver.dart:1538-1552 | pkg/front_end/lib/src/source/source_compilation_unit.dart:215-229 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (12–15 lines × 3) pkg/dart2wasm/lib/dynamic_dispatchers.dart:103— pkg/dart2wasm/lib/dynamic_dispatchers.dart:103-117 | pkg/dart2wasm/lib/dynamic_dispatchers.dart:140-154 | pkg/dart2wasm/lib/dynamic_dispatchers.dart:184-195 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–15 lines × 2) pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:127— pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:127-139 | pkg/analysis_server/lib/src/services/correction/dart/convert_to_switch_expression.dart:216-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 7) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1413— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1413-1426 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1494-1507 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1756-1769 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1948-1961 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2154-2167 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2340-2353 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7276-7288 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–14 lines × 6) pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:135— pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_files_in_flutter_set_subscriptions.dart:135-147 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart:93-105 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart:82-94 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_typing_temporary_missing_end_brace.dart:114-127 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_completion_after_change.dart:118-130 | pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/lsp_typing_temporarily_missing_end_brace_in_string_interpolation.dart:89-101 — before extracting anything, compare `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_get_fixes_and_get_assists_requests.dart` and `pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 6) pkg/front_end/lib/src/fragment/getter/encoding.dart:393— pkg/front_end/lib/src/fragment/getter/encoding.dart:393-406 | pkg/front_end/lib/src/fragment/getter/encoding.dart:695-708 | pkg/front_end/lib/src/fragment/method/encoding.dart:324-337 | pkg/front_end/lib/src/fragment/method/encoding.dart:696-709 | pkg/front_end/lib/src/fragment/setter/encoding.dart:395-408 | pkg/front_end/lib/src/fragment/setter/encoding.dart:721-734 — `pkg/front_end/lib/src/fragment/getter/encoding.dart` and `pkg/front_end/lib/src/fragment/method/encoding.dart` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 272 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13–14 lines × 5) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types.dart:95— pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types.dart:95-107 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types.dart:204-217 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/list.dart:225-238 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/map.dart:69-82 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/types/record.dart:105-118 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (12–14 lines × 5) pkg/observatory/lib/src/elements/heap_snapshot.dart:1068— pkg/observatory/lib/src/elements/heap_snapshot.dart:1068-1081 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1109-1122 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1132-1143 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1149-1162 | pkg/observatory/lib/src/elements/process_snapshot.dart:473-486 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12–13 lines × 5) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1705— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1705-1716 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2453-2464 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8637-8649 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:8833-8845 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9100-9112 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–13 lines × 3) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:389— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:389-401 | sdk/lib/_internal/js_runtime/lib/js_array.dart:493-505 | sdk/lib/collection/list.dart:388-398 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10–13 lines × 3) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1748— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1748-1757 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2647-2659 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2736-2748 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–13 lines × 3) pkg/analyzer/lib/src/summary2/bundle_reader.dart:260— pkg/analyzer/lib/src/summary2/bundle_reader.dart:260-272 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:461-472 | pkg/analyzer/lib/src/summary2/bundle_reader.dart:1069-1081 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–13 lines × 2) sdk/lib/vmservice/running_isolates.dart:323— sdk/lib/vmservice/running_isolates.dart:323-335 | sdk/lib/vmservice/running_isolates.dart:490-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 7) pkg/front_end/lib/src/type_inference/inference_visitor.dart:1420— pkg/front_end/lib/src/type_inference/inference_visitor.dart:1420-1431 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1501-1512 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1763-1774 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:1955-1966 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2045-2056 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2161-2172 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:2347-2358 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–12 lines × 7) pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:161— pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:161-172 | pkg/observatory/lib/src/elements/cpu_profile/virtual_tree.dart:182-193 | pkg/observatory/lib/src/elements/heap_snapshot.dart:972-981 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1053-1062 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1080-1089 | pkg/observatory/lib/src/elements/process_snapshot.dart:458-467 | pkg/observatory/lib/src/elements/process_snapshot.dart:485-494 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 5) pkg/analyzer/lib/src/dart/ast/ast.dart:25646— pkg/analyzer/lib/src/dart/ast/ast.dart:25646-25657 | pkg/analyzer/lib/src/dart/ast/ast.dart:25668-25679 | pkg/analyzer/lib/src/dart/ast/ast.dart:36879-36890 | pkg/analyzer/lib/src/dart/ast/ast.dart:37227-37238 | pkg/analyzer/lib/src/dart/ast/ast.dart:37254-37265 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 5) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6424— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6424-6434 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6769-6780 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6960-6971 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7162-7173 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7422-7433 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–12 lines × 5) pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart:28— pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmentation.dart:28-39 | pkg/analysis_server/lib/src/lsp/handlers/custom/handler_augmented.dart:28-39 | pkg/analysis_server/lib/src/lsp/handlers/custom/handler_super.dart:31-42 | pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart:41-52 | pkg/analysis_server/lib/src/lsp/handlers/handler_signature_help.dart:60-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
Duplicated block (9–12 lines × 2) pkg/analyzer/lib/src/dart/constant/evaluation.dart:1103— pkg/analyzer/lib/src/dart/constant/evaluation.dart:1103-1114 | pkg/analyzer/lib/src/dart/constant/evaluation.dart:2428-2436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 10) pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:19— pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/do_statement.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/function_declaration.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/if_else_statement.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/switch_expression.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/switch_statement.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/try_catch_statement.dart:19-29 | pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart:19-29 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9–11 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:266— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:266-274 | sdk/lib/_internal/js_runtime/lib/js_array.dart:366-376 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (2–11 lines × 4) sdk/lib/_internal/wasm/common/typed_data.dart:670— sdk/lib/_internal/wasm/common/typed_data.dart:670-671 | sdk/lib/_internal/wasm/common/typed_data.dart:769-779 | sdk/lib/_internal/wasm/common/typed_data.dart:873-874 | sdk/lib/_internal/wasm/common/typed_data.dart:949-959 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6–11 lines × 3) pkg/cfg/lib/passes/pass.dart:118— pkg/cfg/lib/passes/pass.dart:118-128 | pkg/cfg/lib/passes/pass.dart:130-140 | pkg/cfg/lib/passes/pass.dart:141-146 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–10 lines × 9) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6428— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6428-6436 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6531-6540 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6774-6782 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6897-6906 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:6965-6973 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7105-7114 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7167-7175 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7361-7370 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7427-7435 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 7) sdk/lib/_internal/vm/lib/typed_data_patch.dart:532— sdk/lib/_internal/vm/lib/typed_data_patch.dart:532-541 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:875-884 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:993-1002 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1336-1345 | sdk/lib/_internal/vm/lib/typed_data_patch.dart:1679-1688 | sdk/lib/_internal/wasm/common/typed_data.dart:2084-2093 | sdk/lib/_internal/wasm/common/typed_data.dart:2439-2448 — before extracting anything, compare `sdk/lib/_internal/vm/lib/typed_data_patch.dart` and `sdk/lib/_internal/wasm/common/typed_data.dart` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–10 lines × 3) pkg/front_end/lib/src/type_inference/inference_visitor.dart:6808— pkg/front_end/lib/src/type_inference/inference_visitor.dart:6808-6816 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:7516-7522 | pkg/front_end/lib/src/type_inference/inference_visitor.dart:9112-9121 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–10 lines × 2) pkg/dart2wasm/lib/code_generator.dart:3298— pkg/dart2wasm/lib/code_generator.dart:3298-3307 | pkg/dart2wasm/lib/code_generator.dart:3316-3322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–10 lines × 2) sdk/lib/_internal/js_dev_runtime/private/js_array.dart:278— sdk/lib/_internal/js_dev_runtime/private/js_array.dart:278-285 | sdk/lib/_internal/js_runtime/lib/js_array.dart:380-389 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/js_array.dart` and `sdk/lib/_internal/js_runtime/lib/js_array.dart` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 9) sdk/lib/_internal/wasm/js_common/js_typed_array.dart:878— sdk/lib/_internal/wasm/js_common/js_typed_array.dart:878-886 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:995-1003 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1114-1122 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1225-1233 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1348-1356 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1473-1481 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1596-1604 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1792-1800 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1896-1904 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–9 lines × 5) pkg/dartpad_worker/lib/src/resource_provider/resource_provider_file.dart:782— pkg/dartpad_worker/lib/src/resource_provider/resource_provider_file.dart:782-789 | sdk/lib/_http/http_impl.dart:1120-1127 | sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart:102-109 | sdk/lib/_internal/wasm/standalone/string_buffer_patch.dart:45-53 | sdk/lib/io/io_sink.dart:298-305 — before extracting anything, compare `sdk/lib/_http/http_impl.dart` and `sdk/lib/io/io_sink.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–9 lines × 3) pkg/observatory/lib/src/elements/class_tree.dart:144— pkg/observatory/lib/src/elements/class_tree.dart:144-150 | pkg/observatory/lib/src/elements/heap_snapshot.dart:996-1004 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1023-1031 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 15) sdk/lib/internal/internal.dart:227— sdk/lib/internal/internal.dart:227-234 | sdk/lib/internal/internal.dart:248-255 | sdk/lib/internal/internal.dart:271-278 | sdk/lib/internal/internal.dart:296-303 | sdk/lib/internal/internal.dart:323-330 | sdk/lib/internal/internal.dart:352-359 | sdk/lib/internal/internal.dart:383-390 | sdk/lib/internal/internal.dart:416-423 | sdk/lib/internal/internal.dart:451-458 | sdk/lib/internal/internal.dart:488-495 | sdk/lib/internal/internal.dart:527-534 | sdk/lib/internal/internal.dart:568-575 | sdk/lib/internal/internal.dart:611-618 | sdk/lib/internal/internal.dart:656-663 | sdk/lib/internal/internal.dart:703-710 — all 15 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–8 lines × 15) sdk/lib/internal/internal.dart:226— sdk/lib/internal/internal.dart:226-232 | sdk/lib/internal/internal.dart:245-252 | sdk/lib/internal/internal.dart:267-274 | sdk/lib/internal/internal.dart:291-298 | sdk/lib/internal/internal.dart:317-324 | sdk/lib/internal/internal.dart:345-352 | sdk/lib/internal/internal.dart:375-382 | sdk/lib/internal/internal.dart:407-414 | sdk/lib/internal/internal.dart:441-448 | sdk/lib/internal/internal.dart:477-484 | sdk/lib/internal/internal.dart:515-522 | sdk/lib/internal/internal.dart:555-562 | sdk/lib/internal/internal.dart:597-604 | sdk/lib/internal/internal.dart:641-648 | sdk/lib/internal/internal.dart:687-694 — all 15 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–8 lines × 5) pkg/observatory/lib/src/elements/library_view.dart:211— pkg/observatory/lib/src/elements/library_view.dart:211-218 | pkg/observatory/lib/src/elements/library_view.dart:245-251 | pkg/observatory/lib/src/elements/library_view.dart:270-276 | pkg/observatory/lib/src/elements/library_view.dart:291-297 | pkg/observatory/lib/src/elements/library_view.dart:338-344 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–8 lines × 4) pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:91— pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:91-98 | pkg/front_end/lib/src/kernel/hierarchy/extension_type_members.dart:120-126 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:730-736 | pkg/front_end/lib/src/kernel/hierarchy/members_node.dart:752-758 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7–8 lines × 3) pkg/front_end/lib/src/source/outline_builder.dart:2088— pkg/front_end/lib/src/source/outline_builder.dart:2088-2094 | pkg/front_end/lib/src/source/outline_builder.dart:2419-2425 | pkg/front_end/lib/src/source/outline_builder.dart:2636-2643 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6–7 lines × 2) pkg/dev_compiler/lib/src/kernel/compiler.dart:5854— pkg/dev_compiler/lib/src/kernel/compiler.dart:5854-5860 | pkg/dev_compiler/lib/src/kernel/compiler_new.dart:6509-6514 — before extracting anything, compare `pkg/dev_compiler/lib/src/kernel/compiler.dart` and `pkg/dev_compiler/lib/src/kernel/compiler_new.dart` as WHOLE FILES: this scan already matched 155 separate duplicated blocks between them, totalling at least 3469 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5–6 lines × 14) pkg/observatory/lib/src/elements/allocation_profile.dart:106— pkg/observatory/lib/src/elements/allocation_profile.dart:106-111 | pkg/observatory/lib/src/elements/cpu_profile_table.dart:100-105 | pkg/observatory/lib/src/elements/heap_map.dart:100-105 | pkg/observatory/lib/src/elements/heap_snapshot.dart:513-517 | pkg/observatory/lib/src/elements/icdata_view.dart:92-96 | pkg/observatory/lib/src/elements/logging.dart:77-81 | pkg/observatory/lib/src/elements/megamorphiccache_view.dart:96-100 | pkg/observatory/lib/src/elements/metrics.dart:78-82 | pkg/observatory/lib/src/elements/object_view.dart:87-91 | pkg/observatory/lib/src/elements/objectpool_view.dart:94-98 | pkg/observatory/lib/src/elements/ports.dart:82-87 | pkg/observatory/lib/src/elements/singletargetcache_view.dart:97-101 | pkg/observatory/lib/src/elements/subtypetestcache_view.dart:94-98 | pkg/observatory/lib/src/elements/unlinkedcall_view.dart:93-97 — before extracting anything, compare `pkg/observatory/lib/src/elements/icdata_view.dart` and `pkg/observatory/lib/src/elements/singletargetcache_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 9) pkg/observatory/lib/src/elements/allocation_profile.dart:104— pkg/observatory/lib/src/elements/allocation_profile.dart:104-109 | pkg/observatory/lib/src/elements/class_tree.dart:74-79 | pkg/observatory/lib/src/elements/megamorphiccache_view.dart:94-99 | pkg/observatory/lib/src/elements/metrics.dart:76-81 | pkg/observatory/lib/src/elements/object_view.dart:85-90 | pkg/observatory/lib/src/elements/objectpool_view.dart:92-97 | pkg/observatory/lib/src/elements/script_view.dart:96-101 | pkg/observatory/lib/src/elements/subtypetestcache_view.dart:92-97 | pkg/observatory/lib/src/elements/unlinkedcall_view.dart:91-96 — before extracting anything, compare `pkg/observatory/lib/src/elements/megamorphiccache_view.dart` and `pkg/observatory/lib/src/elements/objectpool_view.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 8) sdk/lib/_internal/vm_shared/lib/compact_hash.dart:642— sdk/lib/_internal/vm_shared/lib/compact_hash.dart:642-647 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:680-685 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1097-1102 | sdk/lib/_internal/vm_shared/lib/compact_hash.dart:1125-1130 | sdk/lib/_internal/wasm/common/compact_hash.dart:607-612 | sdk/lib/_internal/wasm/common/compact_hash.dart:637-642 | sdk/lib/_internal/wasm/common/compact_hash.dart:1017-1022 | sdk/lib/_internal/wasm/common/compact_hash.dart:1046-1051 — before extracting anything, compare `sdk/lib/_internal/vm_shared/lib/compact_hash.dart` and `sdk/lib/_internal/wasm/common/compact_hash.dart` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 194 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 7) pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:28— pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart:28-33 | pkg/analysis_server/lib/src/services/snippets/dart/for_statement.dart:28-33 | pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart:28-33 | pkg/analysis_server/lib/src/services/snippets/dart/switch_expression.dart:28-33 | pkg/analysis_server/lib/src/services/snippets/dart/test_definition.dart:32-37 | pkg/analysis_server/lib/src/services/snippets/dart/test_group_definition.dart:30-35 | pkg/analysis_server/lib/src/services/snippets/dart/while_statement.dart:28-33 — before extracting anything, compare `pkg/analysis_server/lib/src/services/snippets/dart/class_declaration.dart` and `pkg/analysis_server/lib/src/services/snippets/dart/if_statement.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5–6 lines × 7) pkg/observatory/lib/src/elements/heap_snapshot.dart:1245— pkg/observatory/lib/src/elements/heap_snapshot.dart:1245-1249 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1272-1276 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1303-1307 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1341-1346 | pkg/observatory/lib/src/elements/heap_snapshot.dart:1373-1378 | pkg/observatory/lib/src/elements/process_snapshot.dart:509-513 | pkg/observatory/lib/src/elements/process_snapshot.dart:541-545 — before extracting anything, compare `pkg/observatory/lib/src/elements/heap_snapshot.dart` and `pkg/observatory/lib/src/elements/process_snapshot.dart` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 203 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (3–6 lines × 9) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:154— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:154-156 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:230-232 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:306-311 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:169-171 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:257-259 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:344-349 | sdk/lib/_internal/wasm/common/simd.dart:26-28 | sdk/lib/_internal/wasm/common/simd.dart:130-132 | sdk/lib/_internal/wasm/common/simd.dart:236-241 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 11) pkg/observatory/lib/src/elements/allocation_profile.dart:106— pkg/observatory/lib/src/elements/allocation_profile.dart:106-110 | pkg/observatory/lib/src/elements/class_tree.dart:76-80 | pkg/observatory/lib/src/elements/cpu_profile_table.dart:100-104 | pkg/observatory/lib/src/elements/heap_snapshot.dart:513-517 | pkg/observatory/lib/src/elements/logging.dart:77-81 | pkg/observatory/lib/src/elements/megamorphiccache_view.dart:96-100 | pkg/observatory/lib/src/elements/metrics.dart:78-82 | pkg/observatory/lib/src/elements/object_view.dart:87-91 | pkg/observatory/lib/src/elements/objectpool_view.dart:94-98 | pkg/observatory/lib/src/elements/subtypetestcache_view.dart:94-98 | pkg/observatory/lib/src/elements/unlinkedcall_view.dart:93-97 — before extracting anything, compare `pkg/observatory/lib/src/elements/megamorphiccache_view.dart` and `pkg/observatory/lib/src/elements/objectpool_view.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–5 lines × 14) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:157— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:157-161 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:198-201 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:233-237 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:274-277 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:172-176 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:213-216 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:260-264 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:301-304 | sdk/lib/_internal/wasm/common/simd.dart:29-33 | sdk/lib/_internal/wasm/common/simd.dart:66-69 | sdk/lib/_internal/wasm/common/simd.dart:133-137 | sdk/lib/_internal/wasm/common/simd.dart:170-173 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:1709-1712 | sdk/lib/_internal/wasm/js_common/js_typed_array.dart:2609-2612 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (29 lines × 6) pkg/observatory/lib/src/elements/context_view.dart:48— pkg/observatory/lib/src/elements/context_view.dart:48-76 | pkg/observatory/lib/src/elements/icdata_view.dart:45-73 | pkg/observatory/lib/src/elements/megamorphiccache_view.dart:48-76 | pkg/observatory/lib/src/elements/objectpool_view.dart:47-75 | pkg/observatory/lib/src/elements/subtypetestcache_view.dart:46-74 | pkg/observatory/lib/src/elements/unlinkedcall_view.dart:46-74 — before extracting anything, compare `pkg/observatory/lib/src/elements/icdata_view.dart` and `pkg/observatory/lib/src/elements/subtypetestcache_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (344 lines × 2) pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart:3— pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart:3-346 | pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods_2.dart:2-345 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (60 lines × 4) pkg/front_end/testcases/augmentations/class_declarations.dart:7— pkg/front_end/testcases/augmentations/class_declarations.dart:7-66 | pkg/front_end/testcases/augmentations/enum_declarations.dart:9-70 | pkg/front_end/testcases/augmentations/extension_type_declarations.dart:7-66 | pkg/front_end/testcases/augmentations/mixin_declarations.dart:7-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (19 lines × 6) pkg/front_end/testcases/dart2js/mixin_super/main.dart:16— pkg/front_end/testcases/dart2js/mixin_super/main.dart:16-34 | pkg/front_end/testcases/dart2js/mixin_super/main_lib.dart:6-44 | pkg/front_end/testcases/dartdevc/mixin_super/main.dart:16-34 | pkg/front_end/testcases/dartdevc/mixin_super/main_lib.dart:6-44 | pkg/front_end/testcases/general/mixin_super/main.dart:16-34 | pkg/front_end/testcases/general/mixin_super/main_lib.dart:6-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times.
Duplicated block (39 lines × 3) pkg/front_end/testcases/dart2js/mixin_super/main_lib.dart:6— pkg/front_end/testcases/dart2js/mixin_super/main_lib.dart:6-44 | pkg/front_end/testcases/dartdevc/mixin_super/main_lib.dart:6-44 | pkg/front_end/testcases/general/mixin_super/main_lib.dart:6-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (59 lines × 2) pkg/front_end/testcases/nnbd/null_shorting_explicit_extension.dart:6— pkg/front_end/testcases/nnbd/null_shorting_explicit_extension.dart:6-64 | pkg/front_end/testcases/nnbd/null_shorting_extension.dart:6-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (31 lines × 5) pkg/vm/testcases/transformations/dynamic_interface_annotator/lib1.dart:9— pkg/vm/testcases/transformations/dynamic_interface_annotator/lib1.dart:9-101 | pkg/vm/testcases/transformations/dynamic_interface_annotator/lib2.dart:9-81 | pkg/vm/testcases/transformations/dynamic_interface_annotator/lib3.dart:9-62 | pkg/vm/testcases/transformations/dynamic_interface_annotator/prefix/lib1.dart:9-39 | pkg/vm/testcases/transformations/dynamic_interface_annotator/prefix/lib2.dart:9-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
Duplicated block (5 lines × 6) sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:91— sdk/lib/_internal/js_dev_runtime/private/custom_hash_map.dart:91-95 | sdk/lib/_internal/js_runtime/lib/collection_patch.dart:119-123 | sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart:78-82 | sdk/lib/_internal/vm_shared/lib/collection_patch.dart:137-141 | sdk/lib/collection/maps.dart:39-43 | sdk/lib/collection/splay_tree.dart:612-616 — before extracting anything, compare `sdk/lib/_internal/js_runtime/lib/collection_patch.dart` and `sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 11) pkg/kernel/lib/src/ast/types.dart:481— pkg/kernel/lib/src/ast/types.dart:481-487 | pkg/kernel/lib/src/ast/types.dart:2703-2709 | pkg/kernel/lib/src/ast/variables.dart:218-224 | pkg/kernel/lib/src/ast/variables.dart:478-484 | pkg/kernel/lib/src/ast/variables.dart:745-751 | pkg/kernel/lib/src/ast/variables.dart:1010-1016 | pkg/kernel/lib/src/ast/variables.dart:1277-1283 | pkg/kernel/lib/src/ast/variables.dart:1734-1740 | pkg/kernel/lib/src/ast/variables.dart:1844-1850 | pkg/kernel/lib/src/ast/variables.dart:1927-1933 | pkg/kernel/lib/src/ast/variables.dart:2155-2161 — there are 11 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 11 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 10) sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:874— sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:874-878 | sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart:914-918 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1053-1057 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1101-1105 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1154-1158 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1207-1211 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1260-1264 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1316-1320 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1369-1373 | sdk/lib/_internal/js_runtime/lib/native_typed_data.dart:1498-1502 — before extracting anything, compare `sdk/lib/_internal/js_dev_runtime/private/native_typed_data.dart` and `sdk/lib/_internal/js_runtime/lib/native_typed_data.dart` as WHOLE FILES: this scan already matched 37 separate duplicated blocks between them, totalling at least 306 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 9) pkg/_fe_analyzer_shared/lib/src/exhaustiveness/key.dart:27— pkg/_fe_analyzer_shared/lib/src/exhaustiveness/key.dart:27-31 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/key.dart:66-70 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/key.dart:99-103 | pkg/_fe_analyzer_shared/lib/src/exhaustiveness/key.dart:175-179 | pkg/front_end/lib/src/type_inference/matching_cache.dart:757-761 | pkg/front_end/lib/src/type_inference/matching_cache.dart:777-781 | pkg/front_end/lib/src/type_inference/matching_cache.dart:797-801 | pkg/front_end/lib/src/type_inference/matching_cache.dart:860-864 | pkg/front_end/lib/src/type_inference/matching_cache.dart:880-884 — there are 9 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (14–15 lines × 4) pkg/compiler/tool/modular_test_suite_helper.dart:377— pkg/compiler/tool/modular_test_suite_helper.dart:377-391 | pkg/compiler/tool/modular_test_suite_helper.dart:443-456 | pkg/compiler/tool/modular_test_suite_helper.dart:506-519 | pkg/compiler/tool/modular_test_suite_helper.dart:571-584 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–14 lines × 2) pkg/test_runner/lib/src/browser_controller.dart:1191— pkg/test_runner/lib/src/browser_controller.dart:1191-1201 | pkg/test_runner/lib/src/browser_controller.dart:1216-1229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–11 lines × 3) pkg/test_runner/lib/src/command_output.dart:835— pkg/test_runner/lib/src/command_output.dart:835-843 | pkg/test_runner/lib/src/command_output.dart:1172-1182 | pkg/test_runner/lib/src/command_output.dart:1535-1545 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Coverage not measured — no coverage collector is wired up — Coverage NOT MEASURED: `--collect:"XPlat Code Coverage"` names a data collector that ships in the `coverlet.collector` package, and this repository wires up none — no test project references it and no runsettings declares one. The absence of coverage here is therefore not evidence about the suite or about our analyzer environment: without a collector, `--collect` produces nothing even from a suite that builds and passes. Add a `coverlet.collector` PackageReference to the test project(s) (or commit the Cobertura/OpenCover/lcov report your CI produces) and real coverage will be measured. It is excluded from the score rather than counted as a near-zero defect.
P3 · Security & performance tooling· SAST runs, but gates no merge · ×1
SAST runs, but gates no merge — `scorecards-analysis.yml` run(s) a static-analysis scan, but no workflow that runs one is triggered by a pull request (or a merge queue, or an unfiltered push) — the scan fires on a schedule or a manual dispatch only. A vulnerable change therefore merges clean and is reported on the next scheduled run, by which time it is on the default branch and the only remedy is a follow-up fix. Add the pull-request trigger to the workflow that runs the scan so the finding arrives before the merge rather than after it.
Wholesale file copy (189 identical lines × 3 files) sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js:10— sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js:10 · sdk/lib/_internal/js_runtime/lib/preambles/d8.js:10 · sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js:7 — these 3 files are line-for-line copies of one another — 189 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (36 matched lines × 2 locations) · ×1
Duplicated block with local edits (36 matched lines × 2 locations) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:387— pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:387 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:572 — the two spans are one implementation copied and then locally edited — 324 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (20 lines × 2 locations) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:884— pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:884 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication· Duplicated block with local edits (16 matched lines × 2 locations) · ×1
Duplicated block with local edits (16 matched lines × 2 locations) REDACTED:388— REDACTED:388 · REDACTED:428 — the two spans are one implementation copied and then locally edited — 82 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (16 lines × 2 locations) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:500— pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:500 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:1768— runtime/tools/graphexplorer/graphexplorer.js:1768 · runtime/tools/graphexplorer/graphexplorer.js:1813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) REDACTED:879— REDACTED:879 · REDACTED:1246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:1446— runtime/tools/graphexplorer/graphexplorer.js:1446 · runtime/tools/graphexplorer/graphexplorer.js:1943 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:521— pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:521 · pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 3 locations) runtime/tools/graphexplorer/graphexplorer.js:1682— runtime/tools/graphexplorer/graphexplorer.js:1682 · runtime/tools/graphexplorer/graphexplorer.js:1695 · runtime/tools/graphexplorer/graphexplorer.js:1709 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 6 locations) runtime/tools/graphexplorer/graphexplorer.js:326— runtime/tools/graphexplorer/graphexplorer.js:326 · runtime/tools/graphexplorer/graphexplorer.js:378 · runtime/tools/graphexplorer/graphexplorer.js:573 · runtime/tools/graphexplorer/graphexplorer.js:699 · +2 more site(s) not listed — all 6 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (8 lines × 3 locations) REDACTED:405— REDACTED:405 · REDACTED:879 · REDACTED:1246 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:1212— runtime/tools/graphexplorer/graphexplorer.js:1212 · runtime/tools/graphexplorer/graphexplorer.js:1224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2 locations) runtime/tools/graphexplorer/graphexplorer.js:1797— runtime/tools/graphexplorer/graphexplorer.js:1797 · runtime/tools/graphexplorer/graphexplorer.js:1805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Complex function loadDartHeapSnapshot (cyclomatic 21, cognitive 23) runtime/tools/graphexplorer/graphexplorer.js:155— loadDartHeapSnapshot has cyclomatic complexity 21 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function rewriteEdgesForOwners (cyclomatic 19, cognitive 29) runtime/tools/graphexplorer/graphexplorer.js:381— rewriteEdgesForOwners has cyclomatic complexity 19 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function onRcpMessage (cyclomatic 18, cognitive 27) REDACTED:58— onRcpMessage has cyclomatic complexity 18 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function createTreemapTile (cyclomatic 17, cognitive 34) runtime/tools/graphexplorer/graphexplorer.js:1279— createTreemapTile has cyclomatic complexity 17 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _clone (cyclomatic 17, cognitive 28) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:286— _clone has cyclomatic complexity 17 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function hotRestart (cyclomatic 17, cognitive 22) REDACTED:481— hotRestart has cyclomatic complexity 17 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _showInfoBox (cyclomatic 16, cognitive 29) pkg/vm_snapshot_analysis/lib/src/assets/D3SymbolTreeMap.js:774— _showInfoBox has cyclomatic complexity 16 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function start (cyclomatic 15, cognitive 26) REDACTED:652— start has cyclomatic complexity 15 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function load (cyclomatic 12, cognitive 14) REDACTED:214— load has cyclomatic complexity 12 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function computeDominators (cyclomatic 11, cognitive 23) runtime/tools/graphexplorer/graphexplorer.js:576— computeDominators has cyclomatic complexity 11 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function computeOwnedSizes (cyclomatic 11, cognitive 20) runtime/tools/graphexplorer/graphexplorer.js:702— computeOwnedSizes has cyclomatic complexity 11 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Dead file (~2336 LoC) REDACTED— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~502 LoC) REDACTED— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~349 LoC) sdk/lib/_internal/js_dev_runtime/private/preambles/d8.js— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~108 LoC) pkg/sourcemap_testing/lib/src/js/inspector.js— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~62 LoC) pkg/dartpad_worker/lib/src/asset/sandbox_flutter_patch.js— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~29 LoC) pkg/dartpad_worker/lib/src/asset/worker.js— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~22 LoC) pkg/dev_compiler/lib/js/common/run.js— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~19 LoC) sdk/lib/_internal/js_dev_runtime/private/preambles/jsshell.js— no import path from any entry point (8 application, 0 tooling, 4 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Third-party script without Subresource Integrity pkg/front_end/tool/benchmark_visualiser.html:4— `https://www.gstatic.com/charts/loader.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 3 such include(s) across the repository's markup.
Documentation: no installation or build instructions README.md— The Dart SDK build guide is present but not a standalone install/installation document; users must visit dart.dev to learn how to get and set up Dart. Add an Install/Setup section covering cloning the repo, running 'dart pub get', and setting environment variables.
Documentation: no usage examples README.md— The Using Dart section links to dart.dev but does not give a concrete runnable example of how to run the docs site. Add an 'How to Run This Documentation Site' snippet showing the exact command that starts the web server.
Documentation: no architecture or design documentation README.md— The Dart SDK is documented in a README but no architecture or design document exists among the 168 architecture/Docs markdown files. Create an Architecture/Design doc covering target-platform selection, the native compiler pipeline, and how the VM embedder interacts with kernel snapshots.
Documentation: no installation or build instructions runtime/docs/README.md— There are no installation/build/run commands for a reader who lands on this page. Add an Install section covering how to get the VM, build from source (dart pub get and dart pub run), and run a simple test.
Documentation: no usage examples runtime/docs/README.md— There are no usage examples for any of the packages described. Add Usage sections for each package showing how to import, initialize, and call its API with code samples.
No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P1 · CI/CD gates· CI build step not evidenced · ×1
CI build step not evidenced — A CI pipeline exists but no build step was matched — changes may merge without the build ever running. A build step may be invoked directly as a command, or declared as a task that a runner named in the pipeline resolves.
Subsumed condition operand pkg/front_end/test/utils/kernel_chain.dart:311— `message.startsWith("error in strong mode")` can never decide this `||` — every value satisfying `message.startsWith("error in strong mode")` also satisfies `message.startsWith("error in ")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — 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 Dart pubspec.yaml — not scanned yet).
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
runtime-hardening: not applicable — 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.
runtime-hardening: not applicable — 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.
runtime-hardening: not applicable — 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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — 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 Dart pubspec.yaml — not scanned yet).
0
—
Run 01a0cfa2-acb0-7cc3-a599-0b9de3786ef4 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 13 · Warnings: 15507 · Recommendations: 18 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 23-09-2026 @ 18:58 UTC.
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.