Public report of Aaalice233/Aaalice_NAI_Launcher, published 16 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 16 November 2026, 20:47 UTC · Survey ID cd_272e111cd63c4fb9b068ee1e7b77e9f6
Aaalice233/Aaalice_NAI_Launcher
Measured 16 November 2026, 20:46 UTC, at code version cd83d7b
First survey, so nothing to compare with yet
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 486,727 lines of product code in 8 projects, tests not counted · Estimated rebuild effort: about 6.8 person-years · Weakest lens: Production Readiness, 45.3
Findings by how serious they are
99 critical2612 serious91 minor
15 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
16 November 2026, 20:46 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
44of 44 dimensions measured by tools.
2789of 2802 findings point to an exact file and line, so you can open each one in the code. The other 13 concern the repository as a whole, such as missing documentation.
44dimensions across 8 lenses, read from 486,727 lines of product code in 8 projects.
Aaalice233/Aaalice_NAI_Launcher falls short of our standard for production because five passwords or keys sit in the current code and we found no automated security scanning of the code, its secrets or its dependencies. It scores 52.0 out of 100 and is rated Adequate, and 57 of its 99 critical findings are security problems.
Production Readiness, at 45.3, is the weakest lens and counts most in the score. The best first step is replacing the five exposed passwords or keys and switching the old ones off, worth about 5.8 points. Adding automated security scanning comes next, worth about 5.1 points. Raising Production Readiness to 70 would lift the score to about 57.2.
Forty-six pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Six passwords or keys in the code's history and five in the code are open to anyone who can read the repository. Pinning each tool to an exact version and replacing each exposed password or key would close both risks. Giving the shared object a factory instead of the short-lived one would take care of the 40 shared objects holding on to short-lived ones.
The product code is 486,727 lines, about €990,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 45.3 to 70, the lowest score rated Strong, the score would rise from 52.0 to about 57.2.
Code composition: what the lines of code are
Business logic 0%Supporting code 0%Tests 100%
Rebuild cost: about €990,000 · Estimate
Cost to rebuild
€330,000 to €1,600,000, for 5,455 to 17,307 hours of work, about 6.8 person-years for 4 to 13 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 52. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 486,727 lines of product code
Comment lines
The estimate prices 486,616 lines. Comment lines count towards the size of 486,727 lines but aren't priced as work.
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 5 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (3), REDACTED, REDACTED.
Raises the score by about 5.8 points · Low effort · REDACTED Scanning
2
Add a SAST step to CI running what this repository's stack ships: the Dart analyzer's security lints plus `semgrep --config=auto` — so a security regression fails the build instead of landing.
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Raises the score by about 3.5 points · Medium effort · Observability
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €990,000 to build again, about 6.8 person-years of work. Its weakest lens is Production Readiness, at 45.3 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 5 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 5.8 points for low effort, because it clears the 5 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 1,059,862 lines over the last 90 days, which is about 4,298,329 lines a year. At that pace, the extra work comes to an estimated 295.6 to 1773.8 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
28 modules, with 14 dependencies between them. One loop runs through 2 of the modules, marked above the diagonal.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
krita_plugin uses krita_plugin.acceptance_report, so a change to krita_plugin.acceptance_report can break krita_plugin, while a change to krita_plugin can't break krita_plugin.acceptance_report.
Position
Below the diagonal: krita_plugin uses a module listed above it, which is the healthy direction.
krita_plugin uses krita_plugin.install_plugin, so a change to krita_plugin.install_plugin can break krita_plugin, while a change to krita_plugin can't break krita_plugin.install_plugin.
Position
Below the diagonal: krita_plugin uses a module listed above it, which is the healthy direction.
krita_plugin.nai_launcher_bridge uses krita_plugin.nai_launcher_bridge.discovery, so a change to krita_plugin.nai_launcher_bridge.discovery can break krita_plugin.nai_launcher_bridge, while a change to krita_plugin.nai_launcher_bridge can't break krita_plugin.nai_launcher_bridge.discovery.
Position
Below the diagonal: krita_plugin.nai_launcher_bridge uses a module listed above it, which is the healthy direction.
krita_plugin.nai_launcher_bridge uses krita_plugin.nai_launcher_bridge.fallback_websocket, so a change to krita_plugin.nai_launcher_bridge.fallback_websocket can break krita_plugin.nai_launcher_bridge, while a change to krita_plugin.nai_launcher_bridge can't break krita_plugin.nai_launcher_bridge.fallback_websocket.
Position
Below the diagonal: krita_plugin.nai_launcher_bridge uses a module listed above it, which is the healthy direction.
24→25 repository.data uses repository.corepart of a loop✕
Connections
79 pairs of types, where a type in repository.data uses a type in repository.core. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository.data uses repository.core, so a change to repository.core can break repository.data, while a change to repository.data can't break repository.core.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
repository.core uses repository.l10n, so a change to repository.l10n can break repository.core, while a change to repository.core can't break repository.l10n.
Position
Below the diagonal: repository.core uses a module listed above it, which is the healthy direction.
81 pairs of types, where a type in repository.core uses a type in repository.data. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository.core uses repository.data, so a change to repository.data can break repository.core, while a change to repository.core can't break repository.data.
Position
Below the diagonal: repository.core uses a module listed above it, which is the healthy direction.
repository.domain uses repository.data, so a change to repository.data can break repository.domain, while a change to repository.domain can't break repository.data.
Position
Below the diagonal: repository.domain uses a module listed above it, which is the healthy direction.
repository.domain uses repository.core, so a change to repository.core can break repository.domain, while a change to repository.domain can't break repository.core.
Position
Below the diagonal: repository.domain uses a module listed above it, which is the healthy direction.
52 pairs of types, where a type in repository.presentation uses a type in repository.l10n. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository.presentation uses repository.l10n, so a change to repository.l10n can break repository.presentation, while a change to repository.presentation can't break repository.l10n.
Position
Below the diagonal: repository.presentation uses a module listed above it, which is the healthy direction.
628 pairs of types, where a type in repository.presentation uses a type in repository.data. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository.presentation uses repository.data, so a change to repository.data can break repository.presentation, while a change to repository.presentation can't break repository.data.
Position
Below the diagonal: repository.presentation uses a module listed above it, which is the healthy direction.
425 pairs of types, where a type in repository.presentation uses a type in repository.core. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository.presentation uses repository.core, so a change to repository.core can break repository.presentation, while a change to repository.presentation can't break repository.core.
Position
Below the diagonal: repository.presentation uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 53.4 · Adequate · gated by X5 ·
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
A05:2025 — Injection
50
High / Critical
A07:2025 — Authentication Failures
12
High / Critical
A03:2025 — Software Supply Chain Failures
6
Medium
Roadmap
Top priorities: Resolve the 5 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (3), REDACTED, REDACTED; Add a SAST step to CI running what this repository's stack ships: the Dart analyzer's security lints plus `semgrep --config=auto` — so a security regression fails the build instead of landing; Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 5 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (3), REDACTED, REDACTED.
Add a SAST step to CI running what this repository's stack ships: the Dart analyzer's security lints plus `semgrep --config=auto` — so a security regression fails the build instead of landing.
Put every file in a nullable-enabled context — `#nullable enable` at its top, or commit a project file with <Nullable>enable</Nullable> — and resolve warnings rather than suppressing with `!`.
Dart: await the async dart:io API (readAsString, writeAsString, Process.run, Future.delayed) instead of the *Sync variant or sleep(), or move heavy synchronous work to another isolate with Isolate.run.
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 — 99
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 — 2612
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 — 91
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
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
This survey 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. All 44 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two 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. 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.
What we checked — 44 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, 2789 of 2802 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 or a scanner, 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.
D8 Code Coverage — not measured this run — We 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. Coverage NOT MEASURED: this repository's production source spans .cs, .py, .dart, and our analyzer cannot run the .dart test suite(s) — so no coverage was collected for the repository as a whole. The Python half did build and run, and its own line coverage came back at 82.8% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero.
D11 Test Reliability — not measured this run — We 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 (.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 — We 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 — 2 Maven/Gradle manifest(s) were read, stating a version for 1 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Gradle build (build.gradle/build.gradle.kts), but the licence verdict published here was taken over its pub package dependencies. Nothing was read about its Gradle dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D22 Internal API Consistency — not measured this run — We 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.
D24 Comment Value — not measured this run — We 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. D24 compares a comment's words with the identifiers, literals and constructs of the code it annotates, using English function-word and rationale lexicons. Comments in another script or language were left unread rather than counted as clean.
D24 Comment Value — not measured this run — We 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. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — not measured this run — We 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. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We 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. `android/app/src/main/kotlin/com/aaalice/nai_launcher/AgentQuestionNotifications.kt` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AX1 Captive dependencies — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 3 further occurrence(s) are not listed individually; the score already reflects all 43.
AXB1 Runtime evidence locked — no reproducible boot — not measured this run — We 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. Subject: 2 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
IC1 Incompleteness & stubs — not measured this run — We 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
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.
P8 Schema migrations — not measured this run — We 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 schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
X10 Duplicated predicate — not measured this run — We 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. 137 further occurrence(s) are not listed individually; the score already reflects all 177.
X12 Unreachable branch — not measured this run — We 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X13 Undrained process stream — not measured this run — We 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X27 Collection changed while being enumerated — not measured this run — We 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 C# was parsed (it ships no .sln or .csproj, so it was read as syntax-only projects), but this check proves its findings from resolved symbols and a reference-free parse resolves none. It abstained rather than report a clean bill it could not earn. That is a gap in this analyzer's reach into build-less repositories — not a finding that the repository is free of what this check looks for.
X3 Exception handling — not measured this run — We 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do 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.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
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.
D13 REDACTED Scanning: REDACTED 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").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
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 publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
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.
371 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was OnlineGalleryPaginationService.load at 95. A further 10 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 DefaultShortcuts.getContext at 74 — they are counted neither in the figure above nor in this dimension's score. 6 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: lib/core/shortcuts/default_shortcuts.dart (DefaultShortcuts.getContext at 74), lib/presentation/screens/vibe_library/vibe_library_screen.dart (_VibeLibraryScreenState._handleCommand at 32), lib/presentation/widgets/gallery/local_image_context_menu.dart (LocalImageContextMenu.idFor at 21), lib/core/save_naming/save_name_context.dart (SaveNameContext.valueOf at 20), lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart (_EffectsPreviewDialogState._effectIcon at 17), and 1 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.
+ 366 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 7 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with OnlineGalleryPaginationService.load (cyclomatic 95), OnlineGalleryRandomLoaderService.load (cyclomatic 76), OnlineGalleryFavoritesLoaderService.load (cyclomatic 74). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 7 together lifts Cyclomatic Complexity from 6.1 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
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.
+ 616 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 6 bodies over 120 down to 120 or less in Cognitive Complexity — start with ImageGenerationCoordinator.execute (cognitive 236), OnlineGalleryPaginationService.load (cognitive 192), OnlineGalleryFavoritesLoaderService.load (cognitive 145). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 6 together lifts Cognitive Complexity from 4.2 to about 5.1/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.0 / 10Adequate✓ 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 169 MethodTooLong finding(s) in God Classes — start with danbooru_post_card.dart (3), agent_chat_composer.dart (3), agent_chat_messages.dart (2). — One of this dimension's main actionable groups (169 warning-level).
Resolve the 138 FileTooLong finding(s) in God Classes — start with prompt_assistant_models.dart, inpaint_mask_operations.dart, agent_chat_notifier.dart. — One of this dimension's main actionable groups (138 warning-level).
Resolve the 118 ClassTooLong finding(s) in God Classes — start with vibe_card.dart (2), inpaint_mask_operations.dart, agent_chat_notifier.dart. — One of this dimension's main actionable groups (118 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
369 duplicated block group(s) detected. 5.1 % of the production lines (24,547 of 483,681) are in a reported copy. A further 417 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.
+ 200 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 28 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with editorial_palette.dart (2), data_source.dart, file_explorer_utils.dart. — One of this dimension's main actionable groups (28 warning-level).
Resolve the 25 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with session_jsonl_codec.dart (2), openai_chat_completions_adapter.dart (2), gallery_favorite_tag_repository.dart. — One of this dimension's main actionable groups (25 warning-level).
Resolve the 23 Edited copy of a member (14 corresponding lines) finding(s) in Code Duplication — start with artist_chain_parser.dart, gallery_category_repository.dart, online_gallery_masonry_layout.dart. — One of this dimension's main actionable groups (23 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
8 production modules (Gradle+pub+CMake), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 0 module(s) off the main sequence, with abstractness counted on 3 of the 8 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
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 83 Low cohesion finding(s) in Cohesion (LCOM4) — start with app_cloud_sync_adapters.dart (3), cloud_sync_benchmark.dart (2), cloud_sync_production_benchmark.dart (2). — One of this dimension's main actionable groups (83 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 5 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (3), REDACTED, REDACTED. — One of this dimension's main actionable groups (5 issue-level).
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 230 resolved pub package(s) use a banned license. Licences were read from pub.dev's analysis of each package's licence file, over every package this repository's pubspec.lock resolves from pub.dev, direct and transitive, at the locked version; the 14 package(s) the lock marks direct dev are excluded, and SDK, path and git packages have no registry release to read. pub.dev analyses only recent releases, so for 36 package(s) locked at an older version the licence read is that of the package's latest analysed release, not of the locked one. 1 of them carry no licence pub.dev recognises; that is missing data, not a violation, and none of them is charged. ★ COVERAGE OF THIS VERDICT: it grades this repository's pub package dependencies and nothing else. The repository also declares a Gradle build (build.gradle/build.gradle.kts), and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: lib/presentation/widgets/danbooru_post_card.dart (39×62=2418); lib/presentation/providers/image_generation_provider.dart (43×29=1247); lib/presentation/screens/generation/widgets/image_preview.dart (41×30=1230) Repeated repair below the complexity floor: lib/presentation/widgets/prompt/random_manager/tag_group_card.dart (12 of 20 changes were fixes); lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart (10 of 17 changes were fixes); lib/presentation/adaptive/adaptive_presenter.dart (10 of 16 changes were fixes)
Resolve the 151 Hotspot finding(s) in Churn × Complexity Hotspots — start with danbooru_post_card.dart, image_generation_provider.dart, image_preview.dart. — One of this dimension's main actionable groups (151 warning-level).
Resolve the 71 Repeated repair finding(s) in Churn × Complexity Hotspots — start with tag_group_card.dart, add_tag_group_dialog.dart, adaptive_presenter.dart. — One of this dimension's main actionable groups (71 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.0 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
321 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is tool/ole_drag_inspector/windows/Program.cs. Counted over 1565 of the 2118 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×3
What to do
Resolve the 3 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
1 deducted task-comment markers across 483681 LoC (0.0/KLoC) → score 10.0. 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.
Resolve the 1 TodoComment finding(s) in Explicit Debt — start with prompt_search_utils.dart. — One of this dimension's main actionable groups (1 warning-level).
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: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 22 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.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: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
No ADRs foundmacos/Runner.xcodeproj/project.pbxproj:1
What to do
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
2 naming inconsistencies among 40 declarations measured against a convention their peers follow.
`testNovelAIConnection` spells `AI` where 20 names in the project spell it `Ai`lib/core/network/proxy_service.dart:219
`hasNAISyntax` spells `NAI` where 18 names in the project spell it `Nai`lib/core/utils/sd_to_nai_converter.dart:78
What to do
Resolve the 1 `testNovelAIConnection` spells `AI` where 20 names in the project spell… finding(s) in Naming Consistency — start with proxy_service.dart. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `hasNAISyntax` spells `NAI` where 18 names in the project spell it `Nai` finding(s) in Naming Consistency — start with sd_to_nai_converter.dart. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
6 finding(s): 0 critical, 6 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 6 REDACTED finding(s) in Secrets (history) — start with REDACTED (6). — One of this dimension's main actionable groups (6 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
50 finding(s): 0 critical, 46 high, 4 medium, 0 low. 43 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 1 file(s) — `packages/nai_png_codec/src/nai_png_codec.c` (line 12, line 14, line 20, …) — 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 4 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
What to do
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 3 REDACTED finding(s) charged to Static Analysis (SAST) — the other 43 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (46 issue-level, 3 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
10 of 1565 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is tool/metadata/check_metadata_extraction.dart. Counted over 1565 of the 2118 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 10 Change coupling finding(s) in Change Coupling — start with data_source_cache_provider.dart (2), gallery_album_tree_view.dart, global_drop_handler.dart. — One of this dimension's main actionable groups (10 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 1 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — Whether any singleton service captures a scoped/transient dependency — a silent lifetime/threading bug.
Method: Roslyn scan: DI registrations parsed from AddSingleton/Scoped/Transient; each singleton checked for captured shorter-lifetime dependencies. Exhaustive, deterministic.
`derivativeCopySaverProvider` is a keep-alive Riverpod provider and calls `ref.read(systemGalleryPublisherProvider…)`, which is declared auto-dispose (lib/presentation/providers/image_save_settings_provider.dart:113). Read in build, `systemGalleryPublisherProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `derivativeCopySaverProvider` keeps that value for the life of the ProviderContainer. Mark `systemGalleryPublisherProvider` keepAlive too, make `derivativeCopySaverProvider` auto-dispose, or read it per use outside build. — lib/presentation/screens/derivatives/derivative_copy_saver.dart:49
`derivativeCopySaverProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `derivativeCopySaverProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `derivativeCopySaverProvider` auto-dispose, or read it per use outside build. — lib/presentation/screens/derivatives/derivative_copy_saver.dart:51
`bulkOperationNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(bulkOperationServiceProvider…)`, which is declared auto-dispose (lib/presentation/providers/bulk_operation_provider.dart:185). Read in build, `bulkOperationServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `bulkOperationNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `bulkOperationServiceProvider` keepAlive too, make `bulkOperationNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/bulk_operation_provider.dart:198
`characterPromptNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(characterPromptRepositoryProvider…)`, which is declared auto-dispose (lib/data/repositories/character_prompt_repository.dart:83). Read in build, `characterPromptRepositoryProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `characterPromptNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `characterPromptRepositoryProvider` keepAlive too, make `characterPromptNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/character_prompt_provider.dart:38
`compositionGuideNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `compositionGuideNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `compositionGuideNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/composition_guide_provider.dart:22
`dlssProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `dlssProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `dlssProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/dlss_provider.dart:55
`fixedTagsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `fixedTagsNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/fixed_tags_provider.dart:408
`historyClickBehaviorNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `historyClickBehaviorNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `historyClickBehaviorNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/history_click_behavior_provider.dart:26
`imageComparisonFollowMouseProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `imageComparisonFollowMouseProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/image_comparison_preferences_provider.dart:14
`imageSaveSettingsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `imageSaveSettingsNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `imageSaveSettingsNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/image_save_settings_provider.dart:60
`notificationSettingsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `notificationSettingsNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `notificationSettingsNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/notification_settings_provider.dart:36
`onlineGalleryLocalFavoritesRepositoryProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `onlineGalleryLocalFavoritesRepositoryProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/online_gallery_local_favorites_provider.dart:50
`previewTransparencyNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `previewTransparencyNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `previewTransparencyNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/preview_transparency_provider.dart:16
`promptTokenUsageProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentQualityEntryProvider…)`, which is declared auto-dispose (lib/presentation/providers/quality_preset_provider.dart:214). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentQualityEntryProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentQualityEntryProvider` keepAlive too, make `promptTokenUsageProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/prompt_token_counter_provider.dart:78
`promptTokenUsageProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentUcEntryProvider…)`, which is declared auto-dispose (lib/presentation/providers/uc_preset_provider.dart:159). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentUcEntryProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentUcEntryProvider` keepAlive too, make `promptTokenUsageProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/prompt_token_counter_provider.dart:79
`queueExecutionNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(queueStateStorageProvider…)`, which is declared auto-dispose (lib/core/storage/queue_state_storage.dart:150). Read in build, `queueStateStorageProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `queueExecutionNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `queueStateStorageProvider` keepAlive too, make `queueExecutionNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/queue_execution_provider.dart:184
`quickTagCloudUserServiceProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `quickTagCloudUserServiceProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/quick_tag_cloud_gallery_provider.dart:17
`replicationQueueNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(replicationQueueStorageProvider…)`, which is declared auto-dispose (lib/core/storage/replication_queue_storage.dart:61). Read in build, `replicationQueueStorageProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `replicationQueueNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `replicationQueueStorageProvider` keepAlive too, make `replicationQueueNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/replication_queue_provider.dart:99
`replicationQueueNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(queueStateStorageProvider…)`, which is declared auto-dispose (lib/core/storage/queue_state_storage.dart:150). Read in build, `queueStateStorageProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `replicationQueueNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `queueStateStorageProvider` keepAlive too, make `replicationQueueNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/replication_queue_provider.dart:100
`startupInitializationTasksProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `startupInitializationTasksProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `startupInitializationTasksProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/startup_initialization_provider.dart:75
`startupInitializationTasksProvider` is a keep-alive Riverpod provider and calls `ref.read(layoutStateNotifierProvider…)`, which is declared auto-dispose (lib/presentation/providers/layout_state_provider.dart:81). Read in build, `layoutStateNotifierProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `startupInitializationTasksProvider` keeps that value for the life of the ProviderContainer. Mark `layoutStateNotifierProvider` keepAlive too, make `startupInitializationTasksProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/startup_initialization_provider.dart:215
`anlasBalanceWatcherProvider` is a keep-alive Riverpod provider and calls `ref.watch(anlasBalanceProvider…)`, which is declared auto-dispose (lib/presentation/providers/subscription_provider.dart:600). The keep-alive provider listens to it for the life of the ProviderContainer, so `anlasBalanceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `anlasBalanceProvider` keepAlive too, make `anlasBalanceWatcherProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/subscription_provider.dart:614
`tagLibraryPageNotifierProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `tagLibraryPageNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/tag_library_page_provider.dart:197
`kritaBridgeNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `kritaBridgeNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `kritaBridgeNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/krita/krita_bridge_notifier.dart:114
`generationParamsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `generationParamsNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `generationParamsNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/generation/generation_params_notifier.dart:94
`comfyUISettingsProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `comfyUISettingsProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `comfyUISettingsProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/comfyui/comfyui_provider.dart:21
`cloudSyncApplicationServiceProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `cloudSyncApplicationServiceProvider` auto-dispose, or read it per use outside build. — lib/presentation/providers/cloud_sync/cloud_sync_provider_wiring.dart:86
`promptAssistantDioProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentProxyAddressProvider…)`, which is declared auto-dispose (lib/core/network/proxy_settings_provider.dart:92). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentProxyAddressProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentProxyAddressProvider` keepAlive too, make `promptAssistantDioProvider` auto-dispose, or read it per use outside build. — lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:24
`webAccessDioProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentProxyAddressProvider…)`, which is declared auto-dispose (lib/core/network/proxy_settings_provider.dart:92). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentProxyAddressProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentProxyAddressProvider` keepAlive too, make `webAccessDioProvider` auto-dispose, or read it per use outside build. — lib/presentation/prompt_assistant/providers/web_access_provider.dart:116
`webReaderDioProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentProxyAddressProvider…)`, which is declared auto-dispose (lib/core/network/proxy_settings_provider.dart:92). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentProxyAddressProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentProxyAddressProvider` keepAlive too, make `webReaderDioProvider` auto-dispose, or read it per use outside build. — lib/presentation/prompt_assistant/providers/web_access_provider.dart:126
`webAccessGatewayProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentProxyAddressProvider…)`, which is declared auto-dispose (lib/core/network/proxy_settings_provider.dart:92). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentProxyAddressProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentProxyAddressProvider` keepAlive too, make `webAccessGatewayProvider` auto-dispose, or read it per use outside build. — lib/presentation/prompt_assistant/providers/web_access_provider.dart:139
`mcpServerNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `mcpServerNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `mcpServerNotifierProvider` auto-dispose, or read it per use outside build. — lib/presentation/mcp/providers/mcp_server_notifier.dart:230
`agentChatDockProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `agentChatDockProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `agentChatDockProvider` auto-dispose, or read it per use outside build. — lib/presentation/agent_chat/providers/agent_chat_dock_provider.dart:29
`discordShareServiceProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `discordShareServiceProvider` auto-dispose, or read it per use outside build. — lib/data/services/discord_share_service.dart:615
`localOnnxModelServiceProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `localOnnxModelServiceProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `localOnnxModelServiceProvider` auto-dispose, or read it per use outside build. — lib/data/services/local_onnx_model_service.dart:49
`metadataImportSelectionStoreProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `metadataImportSelectionStoreProvider` auto-dispose, or read it per use outside build. — lib/data/services/metadata_import_selection_store.dart:11
`onlineGalleryBlacklistRepositoryProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `onlineGalleryBlacklistRepositoryProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `onlineGalleryBlacklistRepositoryProvider` auto-dispose, or read it per use outside build. — lib/data/repositories/online_gallery_blacklist_repository.dart:125
`naiImageGenerationApiServiceProvider` is a keep-alive Riverpod provider and calls `ref.watch(naiImageEnhancementApiServiceProvider…)`, which is declared auto-dispose (lib/data/datasources/remote/nai_image_enhancement_api_service.dart:374). The keep-alive provider listens to it for the life of the ProviderContainer, so `naiImageEnhancementApiServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `naiImageEnhancementApiServiceProvider` keepAlive too, make `naiImageGenerationApiServiceProvider` auto-dispose, or read it per use outside build. — lib/data/datasources/remote/nai_image_generation_api_service.dart:395
`_updateCheckServiceFutureProvider` is a keep-alive Riverpod provider and calls `ref.watch(gitHubApiServiceProvider…)`, which is declared auto-dispose (lib/data/datasources/remote/github_api_service.dart:442). The keep-alive provider listens to it for the life of the ProviderContainer, so `gitHubApiServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `gitHubApiServiceProvider` keepAlive too, make `_updateCheckServiceFutureProvider` auto-dispose, or read it per use outside build. — lib/core/services/update_check_service.dart:448
`_updateCheckServiceFutureProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `_updateCheckServiceFutureProvider` auto-dispose, or read it per use outside build. — lib/core/services/update_check_service.dart:449
What to do
Riverpod: a keepAlive provider must only watch, listen to or read in build other keepAlive providers — mark the dependency @Riverpod(keepAlive: true) (or drop .autoDispose), make the consumer auto-dispose too, or read the dependency per use from a Notifier method instead of in build (riverpod_lint: only_use_keep_alive_inside_keep_alive).
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.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`FileSystem` declares 18 abstract methods: `cwd`, `absolutePath`, `joinPath`, `readTextFile`, `readTextLines`, `readBinaryFile`, `writeFile`, `appendFile`, `renameFile`, `fileInfo`, `listDir`, `canonicalPath`, `exists`, `createDir`, `remove`, `createTempDir`, `createTempFile`, `cleanup`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/core/agent/harness/harness_types.dart:231
`SessionStorage` declares 17 abstract methods: `getMetadata`, `getLanes`, `createLane`, `moveLane`, `appendEntry`, `appendRecord`, `getEntry`, `findEntries`, `findEntriesOnBranch`, `findRecords`, `findOpenOperations`, `getLog`, `getName`, `setName`, `getLabel`, `setLabel`, `getStats`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/core/agent/harness/session/session_types.dart:623
`GalleryAlbumRepository` declares 17 abstract methods: `createAlbum`, `renameAlbum`, `updateAlbumDescription`, `moveAlbum`, `updateAlbumCover`, `deleteAlbum`, `getAlbums`, `addImagesToAlbum`, `removeImagesFromAlbum`, `getAlbumImageIdsWithDescendants`, `getAlbumFilePathsWithDescendants`, `getAllAlbumMemberPaths`, `clearAllAlbums`, `importAlbums`, `applyCloudSyncAlbums`, `rebindPendingPaths`, `moveAlbumToSlot`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/core/database/datasources/gallery_album_repository.dart:16
`LocalGalleryService` declares 24 abstract methods: `isInitialized`, `initialize`, `getPage`, `queryPage`, `getImageIdByPath`, `applyFilter`, `toggleFavorite`, `isFavorite`, `getFavoriteCount`, `getMetadata`, `refresh`, `addNewImageImmediately`, `removeDeletedImagesImmediately`, `filteredCount`, `totalCount`, `currentFilter`, `setSearchQuery`, `setDateRange`, `setShowFavoritesOnly`, `setPageSize`, `clearFilters`, `dispose`, `getRecordsByPaths`, `getFilteredImagePaths`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/data/services/gallery/local_gallery_service.dart:24
`VibeLibraryRepositoryProtocol` declares 27 abstract methods: `init`, `ensureInit`, `readEntry`, `putEntry`, `deleteEntry`, `clearEntries`, `readAllEntries`, `forEachEntry`, `firstEntryWhere`, `containsEntry`, `readDisplayEntries`, `replaceDisplayEntries`, `upsertDisplayEntryIfReady`, `deleteDisplayEntryIfReady`, `readThumbnail`, `putThumbnail`, `deleteThumbnail`, `clearThumbnails`, `isDisplayCacheReady`, `setDisplayCacheReady`, `readCategories`, `readCategory`, `putCategory`, `putCategories`, `deleteCategory`, `clearCategories`, `close`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/data/services/vibe_library_storage_protocol.dart:6
`AppLocalizations` declares 4672 abstract methods: `sidebarSort_title`, `sidebarSort_saveAfterMoveFailed`, `sidebarSort_original`, `sidebarSort_nameAscending`, `sidebarSort_nameDescending`, `sidebarSort_countDescending`, `sidebarSort_countAscending`, `gallery_resizeSidebar`, `cardAction_singleScope`, `cardDrag_preparingCount`, `cardDrop_unsupported`, `cardAction_batchFailed`, `generation_enhancementFailed`, `generation_enhancementRetryHint`, `generation_enhancementPreparing`, `generation_enhancementRunning`, `generation_enhancementFinalizing`, `app_title`, `app_subtitle`, `desktopWindow_minimize`, `desktopWindow_maximize`, `desktopWindow_restore`, `desktopWindow_close`, `common_cancel`, `common_confirm`, `common_continue`, `common_selectAll`, `common_deselectAll`, `common_save`, `common_delete`, `common_edit`, `common_close`, `common_clear`, `common_copy`, `common_copied`, `common_export`, `common_import`, `common_loading`, `common_error`, `common_secureStorageUnavailable`, and 4632 more. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/l10n/app_localizations.dart:14
`CloudSyncUiPort` declares 22 abstract methods: `testConnection`, `detectRemote`, `connect`, `authorizeCloudDrive`, `cancelCloudDriveAuthorization`, `discardCloudDriveAuthorization`, `pushNow`, `pullNow`, `applyPendingPreview`, `pause`, `resume`, `cancel`, `previewRestoreSnapshot`, `confirmRestoreSnapshot`, `refreshHistory`, `deleteRemoteNamespace`, `updateContentSelection`, `rebuildCompactBackup`, `disconnect`, `resolveConflict`, `resolveAllConflicts`, `respondToFfdkjInstallIntent`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — lib/presentation/providers/cloud_sync/cloud_sync_ui_provider.dart:376
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
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.
Do you agree with this assessment?
DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether domain entities own their behaviour — a data-only entity with public mutable state whose logic lives in a foreign service is anemic. Rich models enforce their own invariants; an immutable `@freezed`/`@immutable` value class is rich by construction.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
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.
Other · Event-Driven — Whether state changes and message publishes are atomic (a transactional outbox) rather than a crash-unsafe dual write.
Method: Roslyn semantic scan (event-driven gated): event-handler methods scanned for DB-save plus bus-publish without a transactional outbox reference. Deterministic, semantic-resolved.
`ConnectionPool.release` performs two independent DURABLE writes — `_evictingConnections` (a durable store) and `_evictingStartTimes` (a second durable store) — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox). — lib/core/database/connection_pool.dart:225
`ConnectionPool._startEvictionTimer` performs two independent DURABLE writes — `_evictingConnections` (a durable store) and `_evictingStartTimes` (a second durable store) — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox). — lib/core/database/connection_pool.dart:419
What to do
Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.
Other · Code Health — Unreviewed-generation residue: shipped members still throwing NotImplementedException, and placeholder string literals left in non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
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
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
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 your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Only 1/4 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `macos`, `packages/nai_png_codec`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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.
No static application security testing detected. For this repository's stack, add the Dart analyzer's security lints plus `semgrep --config=auto` as a CI step. What was searched, so you can tell an absence from a miss: the 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:4
`android/app/build.gradle` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — android/app/build.gradle:73
What to do
Add a SAST step to CI running what this repository's stack ships: the Dart analyzer's security lints plus `semgrep --config=auto` — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`_listAll` is async and calls listSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs. — lib/core/agent/harness/session/jsonl/session_jsonl_repository.dart:31
`delete` is async and calls deleteSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs. — lib/core/agent/harness/session/jsonl/session_jsonl_repository.dart:116
`_loadCustomTemplates` is async and calls listSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs. — lib/core/comfyui/workflow_template_manager.dart:214
`cleanupOrphanedAvatars` is async and calls listSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs. — lib/core/services/avatar_service.dart:206
`fromNaiV4VibeFile` is async and calls readAsBytesSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs. — lib/core/utils/vibe_file_parser.dart:599
`fromBundleFile` is async and calls readAsBytesSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs. — lib/core/utils/vibe_file_parser.dart:822
What to do
Dart: await the async dart:io API (readAsString, writeAsString, Process.run, Future.delayed) instead of the *Sync variant or sleep(), or move heavy synchronous work to another isolate with Isolate.run.
Other · Code Health — Whether nullable reference types are enabled and not undermined by heavy `!` suppression.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
0/1 C# file(s) are in a nullable-enabled context. This repository commits no project file, so nothing sets <Nullable>enable</Nullable> for it: a file is enabled only by its own `#nullable enable`, by a Unity `csc.rsp` with `-nullable:enable` for its assembly, or as a file-based app (`#:` directives) whose `#:property Nullable` does not turn it off. NRTs catch a whole class of null-deref bugs at compile time.
What to do
Put every file in a nullable-enabled context — `#nullable enable` at its top, or commit a project file with <Nullable>enable</Nullable> — and resolve warnings rather than suppressing with `!`.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 2 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.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 18 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 76 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 — Frontend below the scale floor (18 DOM element(s) < 25) — too little surface to assess accessibility.
AC2 Forms & labels — Frontend below the scale floor (18 DOM element(s) < 25) — too little surface to assess accessibility.
AC3 Page structure — Frontend below the scale floor (18 DOM element(s) < 25) — too little surface to assess accessibility.
AC4 Keyboard semantics — Frontend below the scale floor (18 DOM element(s) < 25) — too little surface to assess accessibility.
AC5 ARIA correctness — Frontend below the scale floor (18 DOM element(s) < 25) — too little surface to assess accessibility.
AC6 Visual & motion safety — Frontend below the scale floor (18 DOM element(s) < 25) — too little surface to assess accessibility.
AX2 Stateful singletons — no singleton implementations detected
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
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C2 Access Controls — No access-control surface detected in the analyzed source — no web/app surface to authorize (no HTTP API or web-UI project) and no authorization code at all (no [Authorize]/policies, no imperative guard methods). Access control is therefore N/A here — this is a library/CLI, which is authorized by its CALLER, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C4 Data Retention — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C5 Data-Subject Rights — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
D10 Test Quality — ~301778 lines of test source are present (.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 — Not scored — 2 Maven/Gradle manifest(s) were read, stating a version for 1 dependency(ies) and leaving 0 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
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 — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. 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 — 34 of 35 comment blocks were not judged (34 in a non-Latin script): redundancy is judged by word overlap with the code's identifiers, which cannot be measured across languages.
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 — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.dart), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
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) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
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 — polyglot repository, one half has no runner
DM1 Aggregate boundaries — no aggregates detected — aggregate-boundary check not applicable
DM2 Strongly-typed ids — no in-repo typed-id idiom — primitive-obsession recorded as advisory DM8, DM2 not gated
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. 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 — no mutating command handlers or message consumers detected — idempotency check not applicable (this repository commits no MSBuild project, so its C# was read as syntax-only projects — a handler marked ONLY by an interface from a package is not visible without a build)
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
IC1 Incompleteness & stubs — IC1 reached only 0% of this repository's production lines — dart (476,854 lines), python (4,180 lines), cpp (1,543 lines), javascript (1,222 lines), kotlin (1,019 lines), c (281 lines), swift (95 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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'.
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — sqflite is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
P9 Domain vs controller coverage — coverage data present for 11 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF1 Benchmark discipline — Performance is assessed only for perf-relevant repos — a packaged library, one that ships benchmarks, or one already using allocation-aware APIs. This repo isn't one, so the Performance lens is not applicable and is excluded from the score.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
S1 Web-Security Posture — No web surface detected in the analyzed source — no HTTP API or web-UI project (no controllers/minimal-API endpoints, no Razor/Blazor views) and no web middleware (HTTPS redirection, HSTS, security headers, cookies). Transport security, security headers, secure cookies, CSRF/input-validation and middleware-order controls are therefore N/A here — this is a library/CLI/worker, not a web app. Crypto hygiene was still checked and found nothing to flag. If this codebase becomes web-facing, the dimension reactivates automatically.
X1 Async correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X12 Unreachable branch — X12 reached only 0% of this repository's production lines — dart (476,854 lines), python (4,180 lines), cpp (1,543 lines), javascript (1,222 lines), kotlin (1,019 lines), c (281 lines), swift (95 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — X13 reached only 0% of this repository's production lines — dart (476,854 lines), python (4,180 lines), cpp (1,543 lines), javascript (1,222 lines), kotlin (1,019 lines), c (281 lines), swift (95 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 0% of this repository's production lines — dart (476,854 lines), python (4,180 lines), cpp (1,543 lines), javascript (1,222 lines), kotlin (1,019 lines), c (281 lines), swift (95 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no async method does work a token could cancel
X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — This check needs a compiled C# program and this repository commits no project file to compile, so only its syntax could be read. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X3 Exception handling — X3 reached only 0% of this repository's production lines — dart (476,854 lines), python (4,180 lines), cpp (1,543 lines), javascript (1,222 lines), kotlin (1,019 lines), c (281 lines), swift (95 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X4 Structured logging — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
Captive dependency: keepAlive provider derivativeCopySaverProvider captures autoDispose systemGalleryPublisherProvider lib/presentation/screens/derivatives/derivative_copy_saver.dart:49— `derivativeCopySaverProvider` is a keep-alive Riverpod provider and calls `ref.read(systemGalleryPublisherProvider…)`, which is declared auto-dispose (lib/presentation/providers/image_save_settings_provider.dart:113). Read in build, `systemGalleryPublisherProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `derivativeCopySaverProvider` keeps that value for the life of the ProviderContainer. Mark `systemGalleryPublisherProvider` keepAlive too, make `derivativeCopySaverProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider derivativeCopySaverProvider captures autoDispose localStorageServiceProvider lib/presentation/screens/derivatives/derivative_copy_saver.dart:51— `derivativeCopySaverProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `derivativeCopySaverProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `derivativeCopySaverProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider bulkOperationNotifierProvider captures autoDispose bulkOperationServiceProvider lib/presentation/providers/bulk_operation_provider.dart:198— `bulkOperationNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(bulkOperationServiceProvider…)`, which is declared auto-dispose (lib/presentation/providers/bulk_operation_provider.dart:185). Read in build, `bulkOperationServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `bulkOperationNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `bulkOperationServiceProvider` keepAlive too, make `bulkOperationNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider characterPromptNotifierProvider captures autoDispose characterPromptRepositoryProvider lib/presentation/providers/character_prompt_provider.dart:38— `characterPromptNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(characterPromptRepositoryProvider…)`, which is declared auto-dispose (lib/data/repositories/character_prompt_repository.dart:83). Read in build, `characterPromptRepositoryProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `characterPromptNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `characterPromptRepositoryProvider` keepAlive too, make `characterPromptNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider compositionGuideNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/composition_guide_provider.dart:22— `compositionGuideNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `compositionGuideNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `compositionGuideNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider dlssProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/dlss_provider.dart:55— `dlssProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `dlssProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `dlssProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider fixedTagsNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/fixed_tags_provider.dart:408— `fixedTagsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `fixedTagsNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider historyClickBehaviorNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/history_click_behavior_provider.dart:26— `historyClickBehaviorNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `historyClickBehaviorNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `historyClickBehaviorNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider imageComparisonFollowMouseProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/image_comparison_preferences_provider.dart:14— `imageComparisonFollowMouseProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `imageComparisonFollowMouseProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider imageSaveSettingsNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/image_save_settings_provider.dart:60— `imageSaveSettingsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `imageSaveSettingsNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `imageSaveSettingsNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider notificationSettingsNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/notification_settings_provider.dart:36— `notificationSettingsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `notificationSettingsNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `notificationSettingsNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider onlineGalleryLocalFavoritesRepositoryProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/online_gallery_local_favorites_provider.dart:50— `onlineGalleryLocalFavoritesRepositoryProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `onlineGalleryLocalFavoritesRepositoryProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider previewTransparencyNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/preview_transparency_provider.dart:16— `previewTransparencyNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `previewTransparencyNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `previewTransparencyNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider promptTokenUsageProvider captures autoDispose currentQualityEntryProvider lib/presentation/providers/prompt_token_counter_provider.dart:78— `promptTokenUsageProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentQualityEntryProvider…)`, which is declared auto-dispose (lib/presentation/providers/quality_preset_provider.dart:214). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentQualityEntryProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentQualityEntryProvider` keepAlive too, make `promptTokenUsageProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider promptTokenUsageProvider captures autoDispose currentUcEntryProvider lib/presentation/providers/prompt_token_counter_provider.dart:79— `promptTokenUsageProvider` is a keep-alive Riverpod provider and calls `ref.watch(currentUcEntryProvider…)`, which is declared auto-dispose (lib/presentation/providers/uc_preset_provider.dart:159). The keep-alive provider listens to it for the life of the ProviderContainer, so `currentUcEntryProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `currentUcEntryProvider` keepAlive too, make `promptTokenUsageProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider queueExecutionNotifierProvider captures autoDispose queueStateStorageProvider lib/presentation/providers/queue_execution_provider.dart:184— `queueExecutionNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(queueStateStorageProvider…)`, which is declared auto-dispose (lib/core/storage/queue_state_storage.dart:150). Read in build, `queueStateStorageProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `queueExecutionNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `queueStateStorageProvider` keepAlive too, make `queueExecutionNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider quickTagCloudUserServiceProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/quick_tag_cloud_gallery_provider.dart:17— `quickTagCloudUserServiceProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `quickTagCloudUserServiceProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider replicationQueueNotifierProvider captures autoDispose replicationQueueStorageProvider lib/presentation/providers/replication_queue_provider.dart:99— `replicationQueueNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(replicationQueueStorageProvider…)`, which is declared auto-dispose (lib/core/storage/replication_queue_storage.dart:61). Read in build, `replicationQueueStorageProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `replicationQueueNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `replicationQueueStorageProvider` keepAlive too, make `replicationQueueNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider replicationQueueNotifierProvider captures autoDispose queueStateStorageProvider lib/presentation/providers/replication_queue_provider.dart:100— `replicationQueueNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(queueStateStorageProvider…)`, which is declared auto-dispose (lib/core/storage/queue_state_storage.dart:150). Read in build, `queueStateStorageProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `replicationQueueNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `queueStateStorageProvider` keepAlive too, make `replicationQueueNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider startupInitializationTasksProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/startup_initialization_provider.dart:75— `startupInitializationTasksProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `startupInitializationTasksProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `startupInitializationTasksProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider startupInitializationTasksProvider captures autoDispose layoutStateNotifierProvider lib/presentation/providers/startup_initialization_provider.dart:215— `startupInitializationTasksProvider` is a keep-alive Riverpod provider and calls `ref.read(layoutStateNotifierProvider…)`, which is declared auto-dispose (lib/presentation/providers/layout_state_provider.dart:81). Read in build, `layoutStateNotifierProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `startupInitializationTasksProvider` keeps that value for the life of the ProviderContainer. Mark `layoutStateNotifierProvider` keepAlive too, make `startupInitializationTasksProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider anlasBalanceWatcherProvider captures autoDispose anlasBalanceProvider lib/presentation/providers/subscription_provider.dart:614— `anlasBalanceWatcherProvider` is a keep-alive Riverpod provider and calls `ref.watch(anlasBalanceProvider…)`, which is declared auto-dispose (lib/presentation/providers/subscription_provider.dart:600). The keep-alive provider listens to it for the life of the ProviderContainer, so `anlasBalanceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `anlasBalanceProvider` keepAlive too, make `anlasBalanceWatcherProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider tagLibraryPageNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/tag_library_page_provider.dart:197— `tagLibraryPageNotifierProvider` is a keep-alive Riverpod provider and calls `ref.watch(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). The keep-alive provider listens to it for the life of the ProviderContainer, so `localStorageServiceProvider` is never disposed — the auto-dispose lifetime it declares never happens, and whatever it holds (a socket, a controller, a stale value) is kept for every later reader. Mark `localStorageServiceProvider` keepAlive too, make `tagLibraryPageNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider kritaBridgeNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/krita/krita_bridge_notifier.dart:114— `kritaBridgeNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `kritaBridgeNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `kritaBridgeNotifierProvider` auto-dispose, or read it per use outside build.
Captive dependency: keepAlive provider generationParamsNotifierProvider captures autoDispose localStorageServiceProvider lib/presentation/providers/generation/generation_params_notifier.dart:94— `generationParamsNotifierProvider` is a keep-alive Riverpod provider and calls `ref.read(localStorageServiceProvider…)`, which is declared auto-dispose (lib/core/storage/local_storage_service.dart:1233). Read in build, `localStorageServiceProvider` has no listener once the read returns, so it is disposed at once — its ref.onDispose closes what it handed out — while `generationParamsNotifierProvider` keeps that value for the life of the ProviderContainer. Mark `localStorageServiceProvider` keepAlive too, make `generationParamsNotifierProvider` auto-dispose, or read it per use outside build.
Dual write (no outbox): ConnectionPool.release lib/core/database/connection_pool.dart:225— `ConnectionPool.release` performs two independent DURABLE writes — `_evictingConnections` (a durable store) and `_evictingStartTimes` (a second durable store) — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox).
Dual write (no outbox): ConnectionPool._startEvictionTimer lib/core/database/connection_pool.dart:419— `ConnectionPool._startEvictionTimer` performs two independent DURABLE writes — `_evictingConnections` (a durable store) and `_evictingStartTimes` (a second durable store) — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox).
MethodTooLong: GenerationToolDefinitions.tools lib/presentation/agent_chat/services/generation_tool_definitions.dart:34— MethodTooLong — tools runs 392 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 292 over it, 3.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: OnlineGalleryPaginationService.load lib/presentation/providers/online_gallery_pagination_service.dart:90— MethodTooLong — load runs 340 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 240 over it, 3.40× 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: OnlineGalleryFavoritesLoaderService.load lib/presentation/providers/online_gallery_favorites_loader_service.dart:89— MethodTooLong — load runs 325 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 225 over it, 3.25× 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: _PrivacySettingsSectionState.build lib/presentation/screens/settings/sections/privacy_settings_section.dart:94— MethodTooLong — build runs 318 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 218 over it, 3.18× 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: WatermarkEditorControls.build lib/presentation/screens/watermark/watermark_editor_controls.dart:38— MethodTooLong — build runs 303 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× 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: _DanbooruPostCardState._buildCard lib/presentation/widgets/danbooru_post_card.dart:559— MethodTooLong — _buildCard runs 285 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 185 over it, 2.85× 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: PromptToolbox.tools lib/presentation/agent_chat/services/prompt_toolbox.dart:35— MethodTooLong — tools runs 276 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 176 over it, 2.76× 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: GenerationPreparationService.prepareForKind lib/presentation/agent_chat/services/generation_preparation_service.dart:140— MethodTooLong — prepareForKind runs 263 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 163 over it, 2.63× 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: AgentChatMessages._messageTile lib/presentation/agent_chat/widgets/agent_chat_messages.dart:374— MethodTooLong — _messageTile runs 242 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 142 over it, 2.42× 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: _Img2ImgUpscaleSectionState.build lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:99— MethodTooLong — build runs 225 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× 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: _PromptLibraryEntryDialogState.build lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:208— MethodTooLong — build runs 222 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 122 over it, 2.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: OnlineGalleryRandomLoaderService.load lib/presentation/providers/online_gallery_random_loader_service.dart:107— MethodTooLong — load runs 218 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× 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: _GenerationSettingsSectionState.build lib/presentation/screens/settings/sections/generation_settings_section.dart:115— MethodTooLong — build runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× 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: _DetailTopBarActions._buildActions lib/presentation/widgets/common/image_detail/components/detail_top_bar.dart:196— MethodTooLong — _buildActions runs 205 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 105 over it, 2.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.
MethodTooLong: GalleryDetailInfoPanel.build lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:30— MethodTooLong — build runs 205 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 105 over it, 2.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.
MethodTooLong: ResumableSnapshotUploader.resume lib/core/cloud_sync/snapshot_uploader.dart:33— MethodTooLong — resume runs 201 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× 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: _MetadataImportDialogState._buildPromptSection lib/presentation/widgets/metadata/metadata_import_dialog.dart:264— MethodTooLong — _buildPromptSection runs 194 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 94 over it, 1.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: ImageGenerationCoordinator.execute lib/presentation/providers/generation/image_generation_coordinator.dart:81— MethodTooLong — execute runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.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: _CollapsibleImagePanelState.build lib/presentation/widgets/common/collapsible_image_panel.dart:278— MethodTooLong — build runs 189 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 89 over it, 1.89× 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: _ComfyUISettingsSectionState.build lib/presentation/screens/settings/sections/comfyui_settings_section.dart:37— MethodTooLong — build runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× 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: ImageCardActionCatalog.build lib/presentation/widgets/common/image_card_actions.dart:56— MethodTooLong — build runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× 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: _GitHubLogoPainter.paint lib/presentation/widgets/navigation/github_logo.dart:24— MethodTooLong — paint runs 185 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 85 over it, 1.85× 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: _QuickTagCloudToolbarState.build lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart:62— MethodTooLong — build runs 183 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 83 over it, 1.83× 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: ImageGenerationNotifier._reduce lib/presentation/providers/image_generation_provider.dart:520— MethodTooLong — _reduce runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× 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: ThemeComposer.buildTheme lib/presentation/themes/core/theme_composer.dart:33— MethodTooLong — buildTheme runs 181 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× 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.
Hotspot: lib/presentation/widgets/danbooru_post_card.dart lib/presentation/widgets/danbooru_post_card.dart:559— lib/presentation/widgets/danbooru_post_card.dart changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in _DanbooruPostCardState._buildCard at line 559. 14 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/danbooru_post_card.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/providers/image_generation_provider.dart lib/presentation/providers/image_generation_provider.dart:292— lib/presentation/providers/image_generation_provider.dart changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in ImageGenerationNotifier.generate at line 292. 13 of those changes were fix/bug commits, and the other 30 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/providers/image_generation_provider.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/screens/generation/widgets/image_preview.dart lib/presentation/screens/generation/widgets/image_preview.dart:656— lib/presentation/screens/generation/widgets/image_preview.dart changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in _ImagePreviewWidgetState._buildGeneratedImageCard at line 656. 15 of those changes were fix/bug commits, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/generation/widgets/image_preview.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/agent_chat/providers/agent_chat_notifier.dart lib/presentation/agent_chat/providers/agent_chat_notifier.dart:1143— lib/presentation/agent_chat/providers/agent_chat_notifier.dart changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in AgentChatNotifier._sendMessage at line 1143. 16 of those changes were fix/bug commits, and the other 18 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_chat/providers/agent_chat_notifier.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/screens/online_gallery/online_gallery_screen.dart lib/presentation/screens/online_gallery/online_gallery_screen.dart:303— lib/presentation/screens/online_gallery/online_gallery_screen.dart changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in _OnlineGalleryScreenState._handleGalleryStateChanged at line 303. 17 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/online_gallery/online_gallery_screen.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/agent_chat/widgets/agent_chat_composer.dart lib/presentation/agent_chat/widgets/agent_chat_composer.dart:236— lib/presentation/agent_chat/widgets/agent_chat_composer.dart changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in _AgentChatComposerState._editor at line 236. 8 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_chat/widgets/agent_chat_composer.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/widgets/prompt/unified/unified_prompt_input.dart lib/presentation/widgets/prompt/unified/unified_prompt_input.dart:156— lib/presentation/widgets/prompt/unified/unified_prompt_input.dart changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in _UnifiedPromptInputState._handleHardwareKeyEvent at line 156. 16 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/unified/unified_prompt_input.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/screens/vibe_library/widgets/vibe_card.dart lib/presentation/screens/vibe_library/widgets/vibe_card.dart:291— lib/presentation/screens/vibe_library/widgets/vibe_card.dart changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in _VibeCardState._buildCard at line 291. 7 of those changes were fix/bug commits, and the other 20 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/vibe_library/widgets/vibe_card.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/screens/online_gallery/online_gallery_content.dart lib/presentation/screens/online_gallery/online_gallery_content.dart:369— lib/presentation/screens/online_gallery/online_gallery_content.dart changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in _OnlineGalleryContentPresenter._buildResolvedPostCard at line 369. 7 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/online_gallery/online_gallery_content.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/data/models/gallery/nai_image_metadata.dart lib/data/models/gallery/nai_image_metadata.dart:238— lib/data/models/gallery/nai_image_metadata.dart changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in NaiImageMetadata.upgradeFromRawJsonIfNeeded at line 238. 8 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/data/models/gallery/nai_image_metadata.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/agent_chat/widgets/agent_chat_messages.dart lib/presentation/agent_chat/widgets/agent_chat_messages.dart:35— lib/presentation/agent_chat/widgets/agent_chat_messages.dart changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in AgentChatMessages.build at line 35. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_chat/widgets/agent_chat_messages.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart:62— lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in _QuickTagCloudToolbarState.build at line 62. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/widgets/common/image_card_surface.dart lib/presentation/widgets/common/image_card_surface.dart:47— lib/presentation/widgets/common/image_card_surface.dart changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in ImageCardSurface._buildSurface at line 47. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/common/image_card_surface.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/providers/online_gallery_provider.dart lib/presentation/providers/online_gallery_provider.dart:532— lib/presentation/providers/online_gallery_provider.dart changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in OnlineGalleryNotifier.goToPage at line 532. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/providers/online_gallery_provider.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/widgets/common/image_detail/image_detail_viewer.dart lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:602— lib/presentation/widgets/common/image_detail/image_detail_viewer.dart changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in _ImageDetailViewerState._buildMainContent at line 602. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/common/image_detail/image_detail_viewer.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/core/network/request_builders/nai_image_request_builder.dart lib/core/network/request_builders/nai_image_request_builder.dart:563— lib/core/network/request_builders/nai_image_request_builder.dart changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in NAIImageRequestBuilder.build at line 563. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/core/network/request_builders/nai_image_request_builder.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/providers/generation/image_generation_coordinator.dart lib/presentation/providers/generation/image_generation_coordinator.dart:81— lib/presentation/providers/generation/image_generation_coordinator.dart changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in ImageGenerationCoordinator.execute at line 81. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/providers/generation/image_generation_coordinator.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:97— lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in OpenAiChatCompletionsAdapter.completeAgent at line 97. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/screens/settings/sections/privacy_settings_section.dart lib/presentation/screens/settings/sections/privacy_settings_section.dart:94— lib/presentation/screens/settings/sections/privacy_settings_section.dart changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in _PrivacySettingsSectionState.build at line 94. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/settings/sections/privacy_settings_section.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/widgets/gallery/gallery_category_tree_view.dart lib/presentation/widgets/gallery/gallery_category_tree_view.dart:423— lib/presentation/widgets/gallery/gallery_category_tree_view.dart changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in _CategoryItemState.build at line 423. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/gallery/gallery_category_tree_view.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart:242— lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in _PromptAssistantOverlayState._runAction at line 242. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart:147— lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in _AgentChatToolResultTileState.build at line 147. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/widgets/common/card_action_buttons.dart lib/presentation/widgets/common/card_action_buttons.dart:93— lib/presentation/widgets/common/card_action_buttons.dart changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in CardActionButtons.build at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/common/card_action_buttons.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/screens/tag_library_page/tag_library_page_screen.dart lib/presentation/screens/tag_library_page/tag_library_page_screen.dart:93— lib/presentation/screens/tag_library_page/tag_library_page_screen.dart changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in _TagLibraryPageScreenState.build at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/tag_library_page/tag_library_page_screen.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:71— lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in GeminiGenerateContentAdapter.completeAgent at line 71. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
FileTooLong: prompt_assistant/prompt_assistant_models.dart lib/data/models/prompt_assistant/prompt_assistant_models.dart— FileTooLong — 1214 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 714 over it, 2.43× 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: inpaint_mask/inpaint_mask_operations.dart lib/core/utils/inpaint_mask/inpaint_mask_operations.dart— FileTooLong — 1199 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: InpaintMaskUtils (16-1748). The bar is 500 significant lines; this is 699 over it, 2.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: providers/agent_chat_notifier.dart lib/presentation/agent_chat/providers/agent_chat_notifier.dart— FileTooLong — 1089 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: AgentChatNotifier (79-1449). The bar is 500 significant lines; this is 589 over it, 2.18× 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: providers/image_generation_provider.dart lib/presentation/providers/image_generation_provider.dart— FileTooLong — 1084 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: ImageGenerationNotifier (74-1376). The bar is 500 significant lines; this is 584 over it, 2.17× 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: windows/Program.cs tool/ole_drag_inspector/windows/Program.cs— FileTooLong — 1028 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 528 over it, 2.06× 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: widgets/danbooru_post_card.dart lib/presentation/widgets/danbooru_post_card.dart— FileTooLong — 1018 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: _DanbooruPostCardState (128-954). The bar is 500 significant lines; this is 518 over it, 2.04× 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: widgets/agent_chat_composer.dart lib/presentation/agent_chat/widgets/agent_chat_composer.dart— FileTooLong — 1005 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: _AgentChatComposerState (43-1238). The bar is 500 significant lines; this is 505 over it, 2.01× 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: drop/image_destination_dialog.dart lib/presentation/widgets/drop/image_destination_dialog.dart— FileTooLong — 961 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 461 over it, 1.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: precise_ref_library/precise_ref_library_screen.dart lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart— FileTooLong — 948 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: _PreciseRefLibraryScreenState (61-1225). The bar is 500 significant lines; this is 448 over it, 1.90× 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: queue/task_list_item.dart lib/presentation/widgets/queue/task_list_item.dart— FileTooLong — 916 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 416 over it, 1.83× 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: utils/inpaint_outpaint_utils.dart lib/core/utils/inpaint_outpaint_utils.dart— FileTooLong — 870 significant lines (blank, comment-only and punctuation-only lines excluded), about 64% of them inside a single declaration: InpaintOutpaintUtils (396-1148). The bar is 500 significant lines; this is 370 over it, 1.74× 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: online_gallery/ai_tag_gallery_source_adapter.dart lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart— FileTooLong — 842 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: AiTagGallerySourceAdapter (20-892). The bar is 500 significant lines; this is 342 over it, 1.68× 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: auth/login_screen.dart lib/presentation/screens/auth/login_screen.dart— FileTooLong — 836 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 336 over it, 1.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: constants/api_constants.dart lib/core/constants/api_constants.dart— FileTooLong — 829 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 329 over it, 1.66× 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: providers/local_gallery_provider.dart lib/presentation/providers/local_gallery_provider.dart— FileTooLong — 826 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: LocalGalleryNotifier (148-1354). The bar is 500 significant lines; this is 326 over it, 1.65× 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: gallery/nai_image_metadata_raw_decoder.dart lib/data/models/gallery/nai_image_metadata_raw_decoder.dart— FileTooLong — 823 significant lines (blank, comment-only and punctuation-only lines excluded), about 84% of them inside a single declaration: NaiImageMetadataRawDecoder (14-1017). The bar is 500 significant lines; this is 323 over it, 1.65× 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: widgets/image_preview.dart lib/presentation/screens/generation/widgets/image_preview.dart— FileTooLong — 821 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: _ImagePreviewWidgetState (144-1093). The bar is 500 significant lines; this is 321 over it, 1.64× 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: services/random_prompt_generator.dart lib/data/services/random_prompt_generator.dart— FileTooLong — 818 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: RandomPromptGenerator (37-1260). The bar is 500 significant lines; this is 318 over it, 1.64× 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: services/official_random_prompt_generator.dart lib/data/services/official_random_prompt_generator.dart— FileTooLong — 816 significant lines (blank, comment-only and punctuation-only lines excluded), about 81% of them inside a single declaration: _OfficialRecipeEngine (103-953). The bar is 500 significant lines; this is 316 over it, 1.63× 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: providers/fixed_tags_provider.dart lib/presentation/providers/fixed_tags_provider.dart— FileTooLong — 816 significant lines (blank, comment-only and punctuation-only lines excluded), about 66% of them inside a single declaration: FixedTagsNotifier (400-1210). The bar is 500 significant lines; this is 316 over it, 1.63× 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: tag_library_page/tag_library_page_screen.dart lib/presentation/screens/tag_library_page/tag_library_page_screen.dart— FileTooLong — 803 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: _TagLibraryPageScreenState (65-1049). The bar is 500 significant lines; this is 303 over it, 1.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: widgets/outpaint_edge_drag_overlay.dart lib/presentation/widgets/image_editor/widgets/outpaint_edge_drag_overlay.dart— FileTooLong — 803 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 303 over it, 1.61× 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: widgets/vibe_selector_dialog.dart lib/presentation/screens/vibe_library/widgets/vibe_selector_dialog.dart— FileTooLong — 790 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: _VibeSelectorDialogState (210-1154). The bar is 500 significant lines; this is 290 over it, 1.58× 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: nai_launcher_bridge/ui.py krita_plugin/nai_launcher_bridge/ui.py— FileTooLong — 782 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 282 over it, 1.56× 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: widgets/agent_chat_resource_widgets.dart lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart— FileTooLong — 772 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 272 over it, 1.54× 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.
ClassTooLong: InpaintMaskUtils lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:15— ClassTooLong — 1187 significant lines (blank, comment-only and punctuation-only lines excluded), 63 methods. The bar is 400 significant lines; this is 787 over it, 2.97× 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: AgentChatNotifier lib/presentation/agent_chat/providers/agent_chat_notifier.dart:74— ClassTooLong — 1023 significant lines (blank, comment-only and punctuation-only lines excluded), 69 methods. The bar is 400 significant lines; this is 623 over it, 2.56× 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: ImageGenerationNotifier lib/presentation/providers/image_generation_provider.dart:73— ClassTooLong — 1016 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 616 over it, 2.54× 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: _AgentChatComposerState lib/presentation/agent_chat/widgets/agent_chat_composer.dart:43— ClassTooLong — 917 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 517 over it, 2.29× 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: _PreciseRefLibraryScreenState lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:61— ClassTooLong — 870 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 470 over it, 2.18× 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: RandomPromptGenerator lib/data/services/random_prompt_generator.dart:36— ClassTooLong — 752 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 352 over it, 1.88× 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: LocalGalleryNotifier lib/presentation/providers/local_gallery_provider.dart:141— ClassTooLong — 740 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods. The bar is 400 significant lines; this is 340 over it, 1.85× 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: AgentChatSessionController lib/presentation/agent_chat/services/agent_chat_session_controller.dart:43— ClassTooLong — 703 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 303 over it, 1.76× 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: _ImagePreviewWidgetState lib/presentation/screens/generation/widgets/image_preview.dart:144— ClassTooLong — 697 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 297 over it, 1.74× 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: NaiImageMetadataRawDecoder lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:14— ClassTooLong — 694 significant lines (blank, comment-only and punctuation-only lines excluded), 37 methods. The bar is 400 significant lines; this is 294 over it, 1.74× 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: PromptToolbox lib/presentation/agent_chat/services/prompt_toolbox.dart:16— ClassTooLong — 693 significant lines (blank, comment-only and punctuation-only lines excluded), 19 methods. The bar is 400 significant lines; this is 293 over it, 1.73× 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: LocalGalleryActionCoordinator lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:150— ClassTooLong — 686 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 286 over it, 1.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: _MetadataImportDialogState lib/presentation/widgets/metadata/metadata_import_dialog.dart:76— ClassTooLong — 682 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 282 over it, 1.71× 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: DonmaiGallerySourceAdapter lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:11— ClassTooLong — 679 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 279 over it, 1.70× 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: _TagEditorViewState lib/presentation/widgets/prompt/tag_editor_view.dart:60— ClassTooLong — 676 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 276 over it, 1.69× 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: _TagLibraryPageScreenState lib/presentation/screens/tag_library_page/tag_library_page_screen.dart:65— ClassTooLong — 667 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 267 over it, 1.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.
ClassTooLong: AiTagGallerySourceAdapter lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:20— ClassTooLong — 663 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 263 over it, 1.66× 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: VibeFileParser lib/core/utils/vibe_file_parser.dart:16— ClassTooLong — 662 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 262 over it, 1.66× 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: _OfficialRecipeEngine lib/data/services/official_random_prompt_generator.dart:103— ClassTooLong — 658 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 258 over it, 1.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: _VibeSelectorDialogState lib/presentation/screens/vibe_library/widgets/vibe_selector_dialog.dart:210— ClassTooLong — 650 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 250 over it, 1.63× 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: AgentChatPanelController lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart:37— ClassTooLong — 642 significant lines (blank, comment-only and punctuation-only lines excluded), 65 methods. The bar is 400 significant lines; this is 242 over it, 1.61× 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: _DanbooruPostCardState lib/presentation/widgets/danbooru_post_card.dart:128— ClassTooLong — 642 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods. The bar is 400 significant lines; this is 242 over it, 1.61× 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: _VibeBundleImportDialogState lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:102— ClassTooLong — 635 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 235 over it, 1.59× 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: _AutocompleteWrapperState lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:127— ClassTooLong — 623 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 223 over it, 1.56× 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: Layer lib/presentation/widgets/image_editor/layers/layer.dart:199— ClassTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded), 70 methods. The bar is 400 significant lines; this is 222 over it, 1.56× 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.
Low cohesion: OnlineGalleryNotifier (LCOM4 36) lib/presentation/providers/online_gallery_provider.dart:73— OnlineGalleryNotifier'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.
Low cohesion: _ImageEditorScreenState (LCOM4 36) lib/presentation/widgets/image_editor/image_editor_screen.dart:149— _ImageEditorScreenState'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.
Low cohesion: VibeLibraryNotifier (LCOM4 13) lib/presentation/providers/vibe_library_provider.dart:142— VibeLibraryNotifier's methods fall into 13 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 13 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.
Low cohesion: MoveTool (LCOM4 13) lib/presentation/widgets/image_editor/tools/move_tool.dart:8— MoveTool's methods fall into 13 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 13 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.
Low cohesion: ImageEditorWorkspaceState (LCOM4 12) lib/presentation/widgets/image_editor/image_editor_workspace.dart:70— ImageEditorWorkspaceState's methods fall into 12 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 12 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.
Low cohesion: _BenchmarkDataSource (LCOM4 11) tool/cloud_sync/cloud_sync_benchmark.dart:604— _BenchmarkDataSource's methods fall into 11 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 11 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.
Low cohesion: ClosedRegionFillTool (LCOM4 11) lib/presentation/widgets/image_editor/tools/closed_region_fill_tool.dart:11— ClosedRegionFillTool's methods fall into 11 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 11 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.
Low cohesion: _DiskBenchmarkBackend (LCOM4 10) tool/cloud_sync/cloud_sync_production_benchmark.dart:276— _DiskBenchmarkBackend's methods fall into 10 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 10 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.
Low cohesion: FillTool (LCOM4 10) lib/presentation/widgets/image_editor/tools/fill_tool.dart:16— FillTool's methods fall into 10 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 10 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.
Low cohesion: GalleryDataSource (LCOM4 9) lib/core/database/datasources/gallery_data_source.dart:27— GalleryDataSource's methods fall into 9 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 9 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.
Low cohesion: DirectorToolsNotifier (LCOM4 9) lib/presentation/providers/director_tools_notifier.dart:139— DirectorToolsNotifier's methods fall into 9 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 9 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.
Low cohesion: ImageWorkflowController (LCOM4 9) lib/presentation/providers/generation/image_workflow_controller.dart:50— ImageWorkflowController's methods fall into 9 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 9 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.
Low cohesion: BlurTool (LCOM4 9) lib/presentation/widgets/image_editor/tools/blur_tool.dart:13— BlurTool's methods fall into 9 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 9 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.
Low cohesion: BrushTool (LCOM4 9) lib/presentation/widgets/image_editor/tools/brush_tool.dart:101— BrushTool's methods fall into 9 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 9 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.
Low cohesion: EraserTool (LCOM4 9) lib/presentation/widgets/image_editor/tools/eraser_tool.dart:13— EraserTool's methods fall into 9 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 9 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.
Low cohesion: MagicWandTool (LCOM4 9) lib/presentation/widgets/image_editor/tools/magic_wand_tool.dart:13— MagicWandTool's methods fall into 9 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 9 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.
Low cohesion: GeneratedImageDetailData (LCOM4 8) lib/presentation/widgets/common/image_detail/image_detail_data.dart:187— GeneratedImageDetailData's methods fall into 8 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 8 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.
Low cohesion: CloneStampTool (LCOM4 8) lib/presentation/widgets/image_editor/tools/clone_stamp_tool.dart:15— CloneStampTool's methods fall into 8 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 8 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.
Low cohesion: ColorPickerTool (LCOM4 8) lib/presentation/widgets/image_editor/tools/color_picker_tool.dart:18— ColorPickerTool's methods fall into 8 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 8 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.
Low cohesion: FrameTool (LCOM4 8) lib/presentation/widgets/image_editor/tools/frame_tool.dart:8— FrameTool's methods fall into 8 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 8 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.
Low cohesion: ImageCardContextMenuRoute (LCOM4 7) lib/presentation/widgets/common/image_card_context_menu.dart:125— ImageCardContextMenuRoute's methods fall into 7 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 7 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.
Low cohesion: FileImageDetailData (LCOM4 7) lib/presentation/widgets/common/image_detail/file_image_detail_data.dart:13— FileImageDetailData's methods fall into 7 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 7 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.
Low cohesion: EditorCompressionController (LCOM4 7) lib/presentation/widgets/image_editor/controllers/editor_compression_controller.dart:17— EditorCompressionController's methods fall into 7 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 7 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.
Low cohesion: _MemoryUpdateCheckStorage (LCOM4 6) lib/core/services/update_check_service.dart:82— _MemoryUpdateCheckStorage's methods fall into 6 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 6 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.
Low cohesion: SettingsCloudSyncAdapter (LCOM4 6) lib/data/cloud_sync/app_cloud_sync_adapters.dart:377— SettingsCloudSyncAdapter's methods fall into 6 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 6 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.
TooManyMethods: LocalStorageService lib/core/storage/local_storage_service.dart:12— TooManyMethods — 179 methods. The bar is 30 methods; this is 149 over it, 5.97× 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: EditorState lib/presentation/widgets/image_editor/core/editor_state.dart:42— TooManyMethods — 97 methods. The bar is 30 methods; this is 67 over it, 3.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.
TooManyMethods: GenerationParamsNotifier lib/presentation/providers/generation/generation_params_notifier.dart:31— TooManyMethods — 90 methods. The bar is 30 methods; this is 60 over it, 3.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: OnlineGalleryNotifier lib/presentation/providers/online_gallery_provider.dart:73— TooManyMethods — 77 methods. The bar is 30 methods; this is 47 over it, 2.57× 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: ImageEditorWorkspaceState lib/presentation/widgets/image_editor/image_editor_workspace.dart:70— TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.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.
TooManyMethods: Layer lib/presentation/widgets/image_editor/layers/layer.dart:199— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× 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: AgentChatNotifier lib/presentation/agent_chat/providers/agent_chat_notifier.dart:74— TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× 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: VibeLibraryStorageService lib/data/services/vibe_library_storage_service.dart:26— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× 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: AgentChatPanelController lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart:37— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.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.
TooManyMethods: LayerManager lib/presentation/widgets/image_editor/layers/layer_manager.dart:13— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.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.
TooManyMethods: InpaintMaskUtils lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:15— TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.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: AppCloudSyncDataSource lib/data/cloud_sync/app_cloud_sync_data_source.dart:18— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.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.
TooManyMethods: SecureStorageService lib/core/storage/secure_storage_service.dart:13— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.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: VibeLibraryNotifier lib/presentation/providers/vibe_library_provider.dart:142— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.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: GalleryDataSource lib/core/database/datasources/gallery_data_source.dart:27— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.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: ScanStateManager lib/data/services/gallery/scan_state_manager.dart:367— TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.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: LocalGalleryNotifier lib/presentation/providers/local_gallery_provider.dart:141— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× 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: NAILauncherBridgeDocker krita_plugin/nai_launcher_bridge/ui.py:38— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.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: QuickTagCloudRemoteCatalogService lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:28— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.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: ImageWorkflowController lib/presentation/providers/generation/image_workflow_controller.dart:50— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.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: GoogleDriveCloudSyncBackend lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:17— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× 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: OnlineGalleryScreenController lib/presentation/screens/online_gallery/online_gallery_screen_controller.dart:18— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× 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: ImageGenerationNotifier lib/presentation/providers/image_generation_provider.dart:73— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.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: EditorCompressionController lib/presentation/widgets/image_editor/controllers/editor_compression_controller.dart:17— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.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: OnlineGalleryBlacklistNotifier lib/presentation/providers/online_gallery_blacklist_provider.dart:95— TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.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.
Repeated repair: lib/presentation/widgets/prompt/random_manager/tag_group_card.dart lib/presentation/widgets/prompt/random_manager/tag_group_card.dart:216— lib/presentation/widgets/prompt/random_manager/tag_group_card.dart changed 20 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is _TagGroupCardState._buildCapabilityIndicators at line 216), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 条件分支可指定输出本类别的词组与触发条件并真正生效”; “fix(prompt): 数量与值依赖在所有选择模式下决定抽取数量”; “fix(prompt): 词组编辑弹窗恢复触屏横滑切换标签页”; “fix(prompt): 随机词库确认弹窗、预设标题与预览标签在放大文字下不溢出”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/random_manager/tag_group_card.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:666— lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart changed 17 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is _DanbooruListTileState.build at line 666), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): 表单页脚统一由 AdaptiveFormFooter 呈现,按钮贴右不再缩到中间”; “fix(prompt): 添加词组、新建预设与配方搜索的手写输入框改用共享输入框”; “fix(prompt): 添加词组弹窗改用 ContentSizedAdaptiveForm,面板高度随内容收紧”; “fix(prompt): 随机词库与 DIY 面板的文字字号改用主题排版 token”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/adaptive/adaptive_presenter.dart lib/presentation/adaptive/adaptive_presenter.dart:24— lib/presentation/adaptive/adaptive_presenter.dart changed 16 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is AdaptivePresenter.showForm at line 24), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 添加词组弹窗收敛为单一纵向滚动容器并保留左右滑动换来源”; “fix(adaptive): 输入与新建预设弹窗在短横屏、键盘与放大文字下不再溢出”; “fix(dialog): 保持键盘上方确认弹窗紧凑”; “fix(ui): 修复短表单弹窗异常撑高”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/adaptive/adaptive_presenter.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:51— lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart changed 17 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is OnlineGalleryDetailLauncher.show at line 51), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 自动格式化遵循空格偏好并按官网规则保护引号文字”; “fix(online-gallery): 批量与详情操作在 await 前取得稳定句柄”; “fix(toast): 按提示类型固定语义配色并修正文生图反馈”; “fix(dialog): 统一桌面弹窗尺寸与内容高度 (#234)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/screens/cloud_sync/cloud_sync_setup.dart lib/presentation/screens/cloud_sync/cloud_sync_setup.dart:75— lib/presentation/screens/cloud_sync/cloud_sync_setup.dart changed 17 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is _CloudSyncSetupState._run at line 75), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cloud-sync): 修复切换窗口后备份设置表单被清空 (#361)”; “fix(cloud-sync): 明确提示 OAuth 授权失败”; “fix(cloud-sync): 精简备份选择界面层级”; “fix(cloud-sync): 移除图像与大文件备份 (#227)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/cloud_sync/cloud_sync_setup.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/screens/generation/widgets/sidebar_entry_tile.dart lib/presentation/screens/generation/widgets/sidebar_entry_tile.dart:110— lib/presentation/screens/generation/widgets/sidebar_entry_tile.dart changed 16 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is _SidebarEntryTileState.build at line 110), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(generation): 固定词条目首次触屏点操作按钮不再误切换启用”; “fix(generation): 修复固定词侧栏窄宽与触屏下的溢出”; “fix(prompt): 增强固定词选中状态与文字对比度 (#268)”; “refactor(fixed-tags): 侧栏条目不再渲染标签译文并收紧网格卡片”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/screens/generation/widgets/sidebar_entry_tile.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart:815— lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is AgentChatPanelController.scrollToBottom at line 815), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent-chat): 列表自身修正位置时不再重复补偿,按住或拖动时内容不被顶走”; “fix(agent-chat): 正文删掉引用的图片附件仍随消息发送,移除附件后修正光标”; “fix(agent-chat): 流式输出时滚动范围不再跳变,暂停阅读同帧补偿漂移”; “Add agent slash commands and fix context menu, third-party login, and IME rendering (#192)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:191— lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart changed 13 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is _DependencyConfigPanelState._buildTypeOptions at line 191), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): DIY 表单不再在面板首行重复表单标题”; “fix(prompt): 数量与值依赖在所有选择模式下决定抽取数量”; “fix(prompt): 依赖按源求值,角色数量源可用于存在与排斥依赖”; “fix(prompt): DIY 配置表单在窄屏与放大文字下不溢出且规则可编辑”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/common/weight_adjust_toolbar.dart lib/presentation/widgets/common/weight_adjust_toolbar.dart:150— lib/presentation/widgets/common/weight_adjust_toolbar.dart changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is _WeightAdjustToolbarWrapperState._syncToolbarWithControllerSelection at line 150), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 按住鼠标拖选时滚轮只滚动提示词,不再调整权重”; “fix(prompt): 滚轮调权重改写选区所在的已有权重,权重数字去掉末尾的零”; “fix(prompt): 修复紧凑布局溢出与工具栏延时清理”; “fix(prompt): 补齐文本模式批量禁用与启用入口”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/common/weight_adjust_toolbar.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:82— lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is _PostProcessRulePanelState.build at line 82), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): DIY 表单不再在面板首行重复表单标题”; “fix(prompt): 分支条件与预设后处理规则按键名找类别时复用类别引用解析”; “fix(prompt): 规则与分支列表面板共用增删选中逻辑,选中策略保持一致”; “fix(prompt): 后处理预设按键名指向真实类别,词组后处理作用于整轮结果”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/diy/panels/conditional_branch_panel.dart lib/presentation/widgets/prompt/diy/panels/conditional_branch_panel.dart:111— lib/presentation/widgets/prompt/diy/panels/conditional_branch_panel.dart changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is _ConditionalBranchPanelState.build at line 111), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): DIY 表单不再在面板首行重复表单标题”; “fix(prompt): 规则与分支列表面板共用增删选中逻辑,选中策略保持一致”; “fix(prompt): 随机词库与 DIY 面板的文字字号改用主题排版 token”; “fix(prompt): 条件分支可指定输出本类别的词组与触发条件并真正生效”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/diy/panels/conditional_branch_panel.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/tag_mode_prompt_field.dart lib/presentation/widgets/prompt/tag_mode_prompt_field.dart:123— lib/presentation/widgets/prompt/tag_mode_prompt_field.dart changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is _TagModePromptFieldState.build at line 123), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 补齐文本模式批量禁用与启用入口”; “fix(prompt): 按当前编辑模式恢复内容自动高度”; “fix(prompt): 隔离输入框标签模式并统一共享控件”; “fix(prompt): 让模式切换按钮跟随编辑区可见范围”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/tag_mode_prompt_field.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/agent_settings/providers/agent_settings_provider.dart lib/presentation/agent_settings/providers/agent_settings_provider.dart:189— lib/presentation/agent_settings/providers/agent_settings_provider.dart changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is AgentSettingsNotifier._removeLegacyAgentFields at line 189), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(providers): 异步初始化推迟到 build 返回之后”; “fix(logging): 本地存储损坏时日志与异常不再带出提示词”; “fix(agent): 分离系统提示词正文与自动上下文”; “Add agent slash commands and fix context menu, third-party login, and IME rendering (#192)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_settings/providers/agent_settings_provider.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/character/character_prompt_button.dart lib/presentation/widgets/character/character_prompt_button.dart:46— lib/presentation/widgets/character/character_prompt_button.dart changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is CharacterPromptButton.build at line 46), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(menu): 弹出菜单项统一改用 MenuActionLabel,长文案与大字号下换行”; “fix(ui): 修复不透明底色遮挡按压与悬停反馈 (#344)”; “fix(prompt): 修复助手执行反馈与提示词控件交互”; “fix(prompt): 防止角色数量徽章被裁切”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/character/character_prompt_button.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/data/services/dlss/dlss_worker.dart lib/data/services/dlss/dlss_worker.dart:40— lib/data/services/dlss/dlss_worker.dart changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is DlssWorker.run at line 40), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(image): 带 EXIF 方向的 WebP 与 JPEG 同样按转正后像素处理”; “fix(image): 重编码后复制的 EXIF 方向置为 1,避免查看器二次旋转”; “fix(image): EXIF 旋转的 JPEG 按解码后的像素尺寸参与导入、编辑与放大”; “fix(dlss): 删除多次叠加并统一单次 NR 处理”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/data/services/dlss/dlss_worker.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/agent_chat/services/agent_resource_resolver.dart lib/presentation/agent_chat/services/agent_resource_resolver.dart:112— lib/presentation/agent_chat/services/agent_resource_resolver.dart changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is AgentResourceResolver.exists at line 112), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent): QuickTagCloud 作品引用改用可逆编码的不透明 id”; “fix(agent): 无图词条的占位封面同样不作为媒体 id 暴露”; “fix(agent): 在线画廊引用不再暴露 AI TAG 列表占位媒体 id”; “fix(agent): 明确参考图资源参数并补齐脱敏权限诊断 (#303)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/agent_chat/services/agent_resource_resolver.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/tag_library/tag_library_entry_hover_preview.dart lib/presentation/widgets/tag_library/tag_library_entry_hover_preview.dart:62— lib/presentation/widgets/tag_library/tag_library_entry_hover_preview.dart changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is _TagLibraryEntryHoverPreviewState.didUpdateWidget at line 62), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(preview): 延迟显示可滚动悬浮预览”; “fix(ui): 统一卡片分组与悬浮预览层级 (#243)”; “fix(prompt): 支持滚动查看长悬浮预览”; “fix(tags): 补全词库悬浮翻译”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/tag_library/tag_library_entry_hover_preview.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/common/themed_input.dart lib/presentation/widgets/common/themed_input.dart:291— lib/presentation/widgets/common/themed_input.dart changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is _ThemedInputState.build at line 291), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): 共享输入框的清空按钮按交互策略取足命中区,单行时不盖住文字”; “fix(ui): 共享输入框切换控制器或之后开启清空按钮时正确监听与释放”; “fix(ui): 共享表单输入框改为由 ThemedInput 呈现,补上主题右键菜单与 Ctrl+Y”; “fix(ui): 共享输入框的帮助与错误文字统一排在输入框下方”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/common/themed_input.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/fixed_tag_entry_tile.dart lib/presentation/widgets/prompt/fixed_tag_entry_tile.dart:43— lib/presentation/widgets/prompt/fixed_tag_entry_tile.dart changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is _FixedTagEntryTileState.build at line 43), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 增强固定词选中状态与文字对比度 (#268)”; “refactor(fixed-tags): 侧栏条目改用常驻行内操作”; “fix(fixed-tags): 居中移动端前后缀标识”; “fix(fixed-tags): 强化条目层级并移除双层悬浮”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/fixed_tag_entry_tile.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/widgets/prompt/random_manager/tag_group_edit_dialog.dart lib/presentation/widgets/prompt/random_manager/tag_group_edit_dialog.dart:412— lib/presentation/widgets/prompt/random_manager/tag_group_edit_dialog.dart changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is _TagGroupEditDialogState._buildDiyPanel at line 412), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): 表单页脚统一由 AdaptiveFormFooter 呈现,按钮贴右不再缩到中间”; “fix(prompt): 编辑器打开时分支条件的存量键与生成时同样解析为 ID”; “fix(prompt): DIY 表单不再在面板首行重复表单标题”; “fix(prompt): 词组编辑面板的标签栏改用共享的自适应固定标题”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/widgets/prompt/random_manager/tag_group_edit_dialog.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/data/services/random_preset_rules.dart lib/data/services/random_preset_rules.dart:71— lib/data/services/random_preset_rules.dart changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is RandomPresetRules.isGroupEligible at line 71), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(prompt): 依赖指定的变量源与类别源经同一入口匹配映射”; “fix(prompt): 分支条件里按键名或名称保存的存量变量统一解析为 ID”; “fix(prompt): 条件分支可指定输出本类别的词组与触发条件并真正生效”; “fix(prompt): 子词组生成时求值时间、可见性、依赖与性别限定”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/data/services/random_preset_rules.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/adaptive/content_sized_adaptive_form.dart lib/presentation/adaptive/content_sized_adaptive_form.dart:183— lib/presentation/adaptive/content_sized_adaptive_form.dart changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is _HostedHeaderFormState._buildForm at line 183), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(adaptive): 表单页脚固定时与随正文滚动时一样占满表单宽度”; “fix(adaptive): 正文未托管面板标题时在调试构建中报错”; “fix(adaptive): 表单标题栏与底部操作按同一条实测规则固定或随正文滚动”; “fix(prompt): 添加词组弹窗收敛为单一纵向滚动容器并保留左右滑动换来源”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/adaptive/content_sized_adaptive_form.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/core/utils/nai_resolution_adapter.dart lib/core/utils/nai_resolution_adapter.dart:100— lib/core/utils/nai_resolution_adapter.dart changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is NaiResolutionAdapter.findOfficialImportResolution at line 100), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(image): 带 EXIF 方向的 WebP 与 JPEG 同样按转正后像素处理”; “fix(image): 方向非 1 的 JPEG 发送前转正为 PNG,与官网请求一致”; “fix(image): EXIF 旋转的 JPEG 按解码后的像素尺寸参与导入、编辑与放大”; “fix(generation): 导入尺寸保留原图并让聚焦重绘跟随源图”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/core/utils/nai_resolution_adapter.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/providers/update_provider.dart lib/presentation/providers/update_provider.dart:121— lib/presentation/providers/update_provider.dart changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is UpdateStateNotifier.initialize at line 121), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(update): 稍后提醒后重新显示更新提示时保留失败原因”; “fix(update): 更新下载与安装的错误提示跟随界面语言显示”; “fix(update): 修复更新检查限流与错误展示”; “fix(app): 修复画廊滚动、更新检测与分辨率校验”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/providers/update_provider.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: lib/presentation/utils/metadata_import_coordinator.dart lib/presentation/utils/metadata_import_coordinator.dart:94— lib/presentation/utils/metadata_import_coordinator.dart changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is MetadataImportCoordinator._applyFixedTags at line 94), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(metadata): 导入元数据后负面不再叠加固定词与 UC 预设”; “fix(prompt): 角色只按勾选导入,权重调整在关闭自动补全时也能保存”; “fix: 修复 Issue #166 反馈问题 (#168)”; “fix(v5): preserve production metadata and model constraints”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 23:49:33 -08:00' --until='2026-11-14 23:49:33 -08:00' --full-history --no-merges -- lib/presentation/utils/metadata_import_coordinator.dart`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Duplicated block (12 lines × 2) lib/core/cloud_sync/data_source.dart:46— lib/core/cloud_sync/data_source.dart:46-57 | lib/data/cloud_sync/verified_blob_store.dart:27-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 (12 lines × 2) lib/core/utils/file_explorer_utils.dart:74— lib/core/utils/file_explorer_utils.dart:74-85 | lib/core/utils/file_explorer_utils.dart:99-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/file_explorer_utils.dart:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/core/utils/pica_lanczos_resizer.dart:382— lib/core/utils/pica_lanczos_resizer.dart:382-393 | lib/core/utils/pica_lanczos_resizer.dart:478-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/pica_lanczos_resizer.dart:382` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:162— lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:162-173 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:425-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 (12 lines × 2) lib/data/services/official_random_prompt_generator.dart:141— lib/data/services/official_random_prompt_generator.dart:141-152 | lib/data/services/official_random_prompt_generator.dart:933-944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) lib/data/services/vibe_import_service.dart:208— lib/data/services/vibe_import_service.dart:208-219 | lib/data/services/vibe_import_service.dart:263-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/vibe_import_service.dart:208` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:226— lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:226-237 | lib/presentation/agent_chat/services/queue_toolbox.dart:131-142 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:226` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/agent_chat/services/precise_reference_toolbox.dart:60— lib/presentation/agent_chat/services/precise_reference_toolbox.dart:60-71 | lib/presentation/agent_chat/services/vibe_library_toolbox.dart:54-65 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/services/precise_reference_toolbox.dart:60` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/agent_chat/services/web_access_toolbox.dart:130— lib/presentation/agent_chat/services/web_access_toolbox.dart:130-141 | lib/presentation/agent_chat/services/web_access_toolbox.dart:160-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/services/web_access_toolbox.dart:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/providers/comfyui/comfyui_provider.dart:371— lib/presentation/providers/comfyui/comfyui_provider.dart:371-382 | lib/presentation/providers/comfyui/comfyui_provider.dart:442-453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/comfyui/comfyui_provider.dart:371` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) lib/presentation/screens/director_tools/director_tools_screen.dart:601— lib/presentation/screens/director_tools/director_tools_screen.dart:601-612 | lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:256-267 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/director_tools/director_tools_screen.dart:601` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/screens/director_tools/director_tools_screen.dart:599` calls `labelKey` and `lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:254` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) lib/presentation/screens/mosaic/mosaic_editor_preview.dart:108— lib/presentation/screens/mosaic/mosaic_editor_preview.dart:108-119 | lib/presentation/screens/watermark/watermark_editor_screen.dart:654-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/mosaic/mosaic_editor_preview.dart:108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:29— lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:29-40 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:35-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:143— lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:143-154 | lib/presentation/screens/watermark/watermark_editor_controls.dart:544-555 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:143` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:242— lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:242-253 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:261-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:242` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) lib/presentation/themes/modules/color/palettes/editorial_palette.dart:22— lib/presentation/themes/modules/color/palettes/editorial_palette.dart:22-33 | lib/presentation/themes/modules/color/palettes/zen_palette.dart:29-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/themes/modules/color/palettes/editorial_palette.dart:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/themes/modules/color/palettes/zen_palette.dart:41` calls `Color` and `lib/presentation/themes/modules/color/palettes/editorial_palette.dart:34` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) lib/presentation/themes/modules/color/palettes/editorial_palette.dart:36— lib/presentation/themes/modules/color/palettes/editorial_palette.dart:36-47 | lib/presentation/themes/modules/color/palettes/zen_palette.dart:45-56 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/themes/modules/color/palettes/editorial_palette.dart:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:910— lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:910-921 | lib/presentation/widgets/online_gallery/ai_tag_generation_info_section.dart:236-247 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:910` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) lib/presentation/widgets/common/image_detail/components/prompt_section.dart:532— lib/presentation/widgets/common/image_detail/components/prompt_section.dart:532-543 | lib/presentation/widgets/common/image_detail/components/vibe_section.dart:224-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/image_detail/components/prompt_section.dart:532` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) lib/presentation/widgets/common/themed_confirm_dialog.dart:252— lib/presentation/widgets/common/themed_confirm_dialog.dart:252-263 | lib/presentation/widgets/common/themed_confirm_dialog.dart:420-431 — both copies are in the same file, so extract the block into 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) lib/presentation/widgets/danbooru_login_dialog.dart:64— lib/presentation/widgets/danbooru_login_dialog.dart:64-75 | lib/presentation/widgets/gelbooru_credentials_dialog.dart:120-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/danbooru_login_dialog.dart:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:382— lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:382-393 | lib/presentation/widgets/online_gallery/output_filter_settings_panel.dart:105-116 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:382` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:506— lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:506-517 | lib/presentation/widgets/prompt/diy/panels/visibility_rule_panel.dart:165-176 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:506` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:158— lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:158-169 | lib/presentation/widgets/prompt/fixed_tag_library_picker_dialog.dart:139-150 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:158` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) lib/presentation/widgets/prompt/global_settings_dialog.dart:649— lib/presentation/widgets/prompt/global_settings_dialog.dart:649-660 | lib/presentation/widgets/prompt/regex_rules_dialog.dart:596-607 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/global_settings_dialog.dart:649` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:84— lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:84-90 | lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:193-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) lib/core/database/datasources/gallery_favorite_tag_repository.dart:190— lib/core/database/datasources/gallery_favorite_tag_repository.dart:190-196 | lib/core/database/datasources/gallery_favorite_tag_repository.dart:228-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_favorite_tag_repository.dart:190` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/core/utils/inpaint_outpaint_utils.dart:452— lib/core/utils/inpaint_outpaint_utils.dart:452-458 | lib/core/utils/inpaint_outpaint_utils.dart:762-768 — both copies are in the same file, so extract the block into 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) lib/data/repositories/online_gallery_local_favorites_repository.dart:366— lib/data/repositories/online_gallery_local_favorites_repository.dart:366-372 | lib/data/services/online_gallery/quick_tag_cloud_user_service.dart:517-525 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) lib/data/services/efficient_vit_sam_service.dart:329— lib/data/services/efficient_vit_sam_service.dart:329-335 | lib/data/services/local_onnx_tagger_service.dart:363-370 — before extracting anything, compare `lib/data/services/efficient_vit_sam_service.dart` and `lib/data/services/local_onnx_tagger_service.dart` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/efficient_vit_sam_service.dart:329` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) lib/data/services/online_gallery/online_gallery_blacklist_filter_service.dart:37— lib/data/services/online_gallery/online_gallery_blacklist_filter_service.dart:37-43 | lib/presentation/screens/online_gallery/online_gallery_selection_actions.dart:190-197 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/online_gallery/online_gallery_blacklist_filter_service.dart:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) lib/presentation/agent_chat/services/local_gallery_toolbox.dart:130— lib/presentation/agent_chat/services/local_gallery_toolbox.dart:130-137 | lib/presentation/agent_chat/services/local_gallery_toolbox.dart:178-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/services/local_gallery_toolbox.dart:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:552— lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:552-558 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:407-413 — before extracting anything, compare `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart` and `lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart` as WHOLE FILES: this scan already matched 4 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/providers/online_gallery_detail_favorite_service.dart:81— lib/presentation/providers/online_gallery_detail_favorite_service.dart:81-87 | lib/presentation/providers/online_gallery_detail_favorite_service.dart:106-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/online_gallery_detail_favorite_service.dart:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/providers/tag_library_page_provider.dart:643— lib/presentation/providers/tag_library_page_provider.dart:643-649 | lib/presentation/providers/vibe_library_category_provider.dart:357-363 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/tag_library_page_provider.dart:643` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:424— lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:424-430 | lib/presentation/widgets/metadata/metadata_import_dialog.dart:185-191 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart` and `lib/presentation/widgets/metadata/metadata_import_dialog.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:424` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) lib/presentation/widgets/character/inline_character_card.dart:160— lib/presentation/widgets/character/inline_character_card.dart:160-167 | lib/presentation/widgets/character/inline_character_row.dart:350-356 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/character/inline_character_card.dart:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:550— lib/presentation/widgets/gallery/gallery_album_tree_view.dart:550-556 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:423-429 — before extracting anything, compare `lib/presentation/widgets/gallery/gallery_album_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/gallery/gallery_album_tree_view.dart:550` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) lib/data/services/image_metadata_service.dart:779— lib/data/services/image_metadata_service.dart:779-785 | lib/data/services/metadata/hash_calculator.dart:205-211 — 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 (7 lines × 2) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:560— lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:560-566 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:415-421 — before extracting anything, compare `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart` and `lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart` as WHOLE FILES: this scan already matched 4 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:74— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:74-80 | lib/presentation/screens/precise_ref_library/widgets/precise_ref_selector_dialog.dart:80-86 — 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 (7 lines × 2) lib/presentation/screens/precise_ref_library/widgets/precise_ref_card.dart:180— lib/presentation/screens/precise_ref_library/widgets/precise_ref_card.dart:180-186 | lib/presentation/screens/vibe_library/widgets/vibe_card.dart:283-289 — 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 (7 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_image_encode_dialog.dart:150— lib/presentation/screens/vibe_library/widgets/vibe_image_encode_dialog.dart:150-156 | lib/presentation/screens/vibe_library/widgets/vibe_import_naming_dialog.dart:143-149 — 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) lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:391— lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:391-397 | lib/core/agent/harness/session/session_memory.dart:102-108 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/core/agent/resources/agent_chat_resource_reference_codec.dart:227— lib/core/agent/resources/agent_chat_resource_reference_codec.dart:227-233 | lib/core/krita/krita_bridge_protocol.dart:412-418 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/core/cloud_sync/snapshot_transfer.dart:253— lib/core/cloud_sync/snapshot_transfer.dart:253-259 | lib/core/cloud_sync/snapshot_uploader.dart:371-377 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart:186— lib/presentation/agent_chat/widgets/agent_chat_panel_controller.dart:186-192 | lib/presentation/screens/settings/sections/agent/system_prompt_editor.dart:203-209 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:59— lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:59-65 | lib/presentation/screens/watermark/watermark_editor_launcher.dart:57-63 — `lib/presentation/screens/mosaic/mosaic_editor_launcher.dart` and `lib/presentation/screens/watermark/watermark_editor_launcher.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 5 separate duplicated blocks between them, totalling at least 47 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) lib/presentation/screens/tag_library_page/widgets/thumbnail_selection_preview.dart:87— lib/presentation/screens/tag_library_page/widgets/thumbnail_selection_preview.dart:87-93 | lib/presentation/widgets/common/thumbnail_display.dart:55-61 — 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 (7 lines × 2) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:314— lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:314-320 | lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:739-745 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:314` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `Map<String, dynamic>` in one and `Object?` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×23
Edited copy of a member (14 corresponding lines) lib/data/services/online_gallery/artist_chain_parser.dart:327— lib/data/services/online_gallery/artist_chain_parser.dart:327-341 | lib/data/services/online_gallery/artist_chain_parser.dart:343-356 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/data/repositories/gallery_category_repository.dart:313— lib/data/repositories/gallery_category_repository.dart:313-326 | lib/data/repositories/gallery_category_repository.dart:443-459 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/online_gallery/online_gallery_masonry_layout.dart:109— lib/presentation/screens/online_gallery/online_gallery_masonry_layout.dart:109-122 | lib/presentation/screens/online_gallery/online_gallery_masonry_layout.dart:124-137 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/widgets/common/update_check_dialog.dart:851— lib/presentation/widgets/common/update_check_dialog.dart:851-864 | lib/presentation/widgets/common/update_check_dialog.dart:866-879 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/local_gallery/local_gallery_screen_controller.dart:320— lib/presentation/screens/local_gallery/local_gallery_screen_controller.dart:320-333 | lib/presentation/widgets/prompt/fixed_tags_dialog_coordinator.dart:136-149 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/core/storage/secure_storage_service.dart:426— lib/core/storage/secure_storage_service.dart:426-442 | lib/core/storage/secure_storage_service.dart:473-486 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/data/services/vibe_file_repository.dart:557— lib/data/services/vibe_file_repository.dart:557-570 | lib/data/services/vibe_file_repository.dart:572-585 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:305— lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:305-318 | lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:320-333 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/providers/online_gallery_favorites_loader_service.dart:478— lib/presentation/providers/online_gallery_favorites_loader_service.dart:478-491 | lib/presentation/providers/online_gallery_pagination_service.dart:486-500 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/generation/widgets/prompt_input_coordinator.dart:134— lib/presentation/screens/generation/widgets/prompt_input_coordinator.dart:134-147 | lib/presentation/utils/metadata_import_coordinator.dart:215-228 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/main.dart:127— lib/main.dart:127-140 | lib/main.dart:149-166 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/core/network/web_access/safe_web_reader.dart:159— lib/core/network/web_access/safe_web_reader.dart:159-172 | lib/core/network/web_access/searxng_search_client.dart:121-137 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/precise_ref_library/widgets/precise_ref_entry_edit_dialog.dart:45— lib/presentation/screens/precise_ref_library/widgets/precise_ref_entry_edit_dialog.dart:45-62 | lib/presentation/widgets/prompt/global_settings_dialog.dart:27-40 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:374— lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:374-387 | lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:389-402 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) krita_plugin/nai_launcher_bridge/ui.py:695— krita_plugin/nai_launcher_bridge/ui.py:695-708 | krita_plugin/nai_launcher_bridge/ui.py:711-726 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/core/database/datasources/gallery_album_repository.dart:296— lib/core/database/datasources/gallery_album_repository.dart:296-309 | lib/data/services/gallery/gallery_album_import_coordinator.dart:196-209 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/settings/sections/agent_settings_section.dart:451— lib/presentation/screens/settings/sections/agent_settings_section.dart:451-464 | lib/presentation/screens/settings/sections/mcp_server/mcp_server_permission_card.dart:90-104 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/widgets/image_editor/workspace/workspace_desktop_layout.dart:362— lib/presentation/widgets/image_editor/workspace/workspace_desktop_layout.dart:362-375 | lib/presentation/widgets/image_editor/workspace/workspace_mobile_layout.dart:186-201 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:423— lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:423-436 | lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:438-451 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/core/database/datasources/cooccurrence_data_source.dart:232— lib/core/database/datasources/cooccurrence_data_source.dart:232-248 | lib/core/database/datasources/cooccurrence_data_source.dart:250-263 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/auth/login_screen.dart:969— lib/presentation/screens/auth/login_screen.dart:969-983 | lib/presentation/widgets/common/shimmer_skeleton.dart:44-57 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/agent_chat/services/image_resource_action_service.dart:365— lib/presentation/agent_chat/services/image_resource_action_service.dart:365-378 | lib/presentation/mcp/services/mcp_image_response_service.dart:455-468 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar.dart:639— lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar.dart:639-652 | lib/presentation/widgets/danbooru_post_card.dart:925-938 — These two members are one piece of code written twice and then edited apart: 14 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.
Duplicated block (10 lines × 2) lib/core/comfyui/comfyui_websocket_service.dart:111— lib/core/comfyui/comfyui_websocket_service.dart:111-120 | lib/core/comfyui/comfyui_websocket_service.dart:168-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/comfyui/comfyui_websocket_service.dart:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) lib/core/database/datasources/gallery_album_repository.dart:297— lib/core/database/datasources/gallery_album_repository.dart:297-306 | lib/data/services/gallery/gallery_album_import_coordinator.dart:197-206 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_album_repository.dart:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) lib/core/database/datasources/gallery_records.dart:127— lib/core/database/datasources/gallery_records.dart:127-136 | lib/domain/entities/gallery_image_entity.dart:147-156 — 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) lib/core/services/pixel_snap/internal/spread_kernel.dart:57— lib/core/services/pixel_snap/internal/spread_kernel.dart:57-66 | lib/core/services/pixel_snap/internal/spread_kernel.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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) lib/core/utils/pica_lanczos_resizer.dart:347— lib/core/utils/pica_lanczos_resizer.dart:347-356 | lib/core/utils/pica_lanczos_resizer.dart:443-452 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/pica_lanczos_resizer.dart:347` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/data/services/efficient_vit_sam_service.dart:211— lib/data/services/efficient_vit_sam_service.dart:211-220 | lib/data/services/efficient_vit_sam_service.dart:255-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/efficient_vit_sam_service.dart:211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/data/services/official_random_prompt_generator.dart:214— lib/data/services/official_random_prompt_generator.dart:214-223 | lib/data/services/official_random_prompt_generator.dart:447-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/official_random_prompt_generator.dart:214` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/data/services/precise_ref_library_archive_service.dart:298— lib/data/services/precise_ref_library_archive_service.dart:298-307 | lib/data/services/tag_library_io_service.dart:463-472 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/precise_ref_library_archive_service.dart:298` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/screens/auth/login_screen.dart:1121— lib/presentation/screens/auth/login_screen.dart:1121-1130 | lib/presentation/screens/auth/login_screen.dart:1196-1205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/auth/login_screen.dart:1121` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/screens/cloud_sync/cloud_sync_content_selection_dialog.dart:251— lib/presentation/screens/cloud_sync/cloud_sync_content_selection_dialog.dart:251-260 | lib/presentation/screens/cloud_sync/cloud_sync_skill_selection_dialog.dart:187-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/cloud_sync/cloud_sync_content_selection_dialog.dart:251` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/screens/generation/widgets/img2img_panel.dart:74— lib/presentation/screens/generation/widgets/img2img_panel.dart:74-83 | lib/presentation/screens/generation/widgets/unified_reference_panel.dart:361-370 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/img2img_panel.dart:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:200— lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:200-209 | lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.dart:244-254 — before extracting anything, compare `lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart` and `lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:267— lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:267-276 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:636-645 — before extracting anything, compare `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 125 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:267` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `onTap` to `(` in one and `() => Future.delayed(const Duration(milliseconds: 100)` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) lib/presentation/widgets/character/inline_character_editor.dart:117— lib/presentation/widgets/character/inline_character_editor.dart:117-126 | lib/presentation/widgets/prompt/tag_mode_prompt_field.dart:108-117 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:88— lib/presentation/widgets/gallery/gallery_album_tree_view.dart:88-97 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:99-108 — before extracting anything, compare `lib/presentation/widgets/gallery/gallery_album_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/gallery/gallery_album_tree_view.dart:88` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:132— lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:132-141 | lib/presentation/widgets/prompt/diy/panels/visibility_rule_panel.dart:111-120 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/widgets/prompt/quality_tags_selector.dart:70— lib/presentation/widgets/prompt/quality_tags_selector.dart:70-79 | lib/presentation/widgets/prompt/uc_preset_selector.dart:79-88 — before extracting anything, compare `lib/presentation/widgets/prompt/quality_tags_selector.dart` and `lib/presentation/widgets/prompt/uc_preset_selector.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/quality_tags_selector.dart:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1639— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1639-1648 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1675-1684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1639` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) lib/core/utils/pica_lanczos_resizer.dart:395— lib/core/utils/pica_lanczos_resizer.dart:395-404 | lib/core/utils/pica_lanczos_resizer.dart:498-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/pica_lanczos_resizer.dart:395` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:322— lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:322-331 | lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:747-756 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:322` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:408— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:408-417 | lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:717-726 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:45— lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:45-54 | lib/presentation/screens/watermark/watermark_editor_launcher.dart:43-52 — `lib/presentation/screens/mosaic/mosaic_editor_launcher.dart` and `lib/presentation/screens/watermark/watermark_editor_launcher.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 5 separate duplicated blocks between them, totalling at least 47 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 (10 lines × 2) lib/presentation/widgets/image_editor/tools/brush_tool.dart:204— lib/presentation/widgets/image_editor/tools/brush_tool.dart:204-213 | lib/presentation/widgets/image_editor/tools/eraser_tool.dart:68-77 — before extracting anything, compare `lib/presentation/widgets/image_editor/tools/brush_tool.dart` and `lib/presentation/widgets/image_editor/tools/eraser_tool.dart` as WHOLE FILES: this scan already matched 5 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:308— lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:308-318 | lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:323-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:308` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/core/utils/inpaint_outpaint_utils.dart:1016— lib/core/utils/inpaint_outpaint_utils.dart:1016-1026 | lib/core/utils/inpaint_outpaint_utils.dart:1095-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_outpaint_utils.dart:1016` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) lib/data/services/official_random_prompt_generator.dart:160— lib/data/services/official_random_prompt_generator.dart:160-170 | lib/data/services/official_random_prompt_generator.dart:389-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/official_random_prompt_generator.dart:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:94— lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:94-104 | lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:127-137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/screens/auth/login_screen.dart:1071— lib/presentation/screens/auth/login_screen.dart:1071-1081 | lib/presentation/screens/auth/login_screen.dart:1149-1159 — both copies are in the same file, so extract the block into 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) lib/presentation/screens/generation/mobile_generation_chrome.dart:311— lib/presentation/screens/generation/mobile_generation_chrome.dart:311-321 | lib/presentation/screens/generation/widgets/generation_controls/generate_button.dart:112-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 (11 lines × 2) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:643— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:643-653 | lib/presentation/screens/tag_library_page/widgets/send_to_home_dialog.dart:581-591 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/precise_reference_panel.dart:643` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) lib/presentation/screens/generation/widgets/sidebar_link_painter.dart:36— lib/presentation/screens/generation/widgets/sidebar_link_painter.dart:36-46 | lib/presentation/screens/generation/widgets/sidebar_link_painter.dart:62-72 — both copies are in the same file, so extract the block into 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) lib/presentation/screens/mosaic/mosaic_editor_actions_bar.dart:34— lib/presentation/screens/mosaic/mosaic_editor_actions_bar.dart:34-44 | lib/presentation/screens/watermark/watermark_editor_screen.dart:763-773 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/mosaic/mosaic_editor_actions_bar.dart:34` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:58— lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:58-68 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:143-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:58` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:455— lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:455-465 | lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:286-296 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:23— lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:23-33 | lib/presentation/themes/modules/color/palettes/pro_ai_palette.dart:23-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:23` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/themes/modules/color/palettes/pro_ai_palette.dart:35` calls `Color` and `lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:34` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) lib/presentation/widgets/common/app_toast.dart:469— lib/presentation/widgets/common/app_toast.dart:469-479 | lib/presentation/widgets/common/app_toast.dart:732-742 — both copies are in the same file, so extract the block into 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) lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:875— lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:875-885 | lib/presentation/widgets/online_gallery/ai_tag_generation_info_section.dart:185-195 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:875` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/widgets/common/themed_input.dart:267— lib/presentation/widgets/common/themed_input.dart:267-277 | lib/presentation/widgets/prompt/tag_mode_prompt_field.dart:106-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/themed_input.dart:267` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/widgets/image_editor/tools/brush_tool.dart:472— lib/presentation/widgets/image_editor/tools/brush_tool.dart:472-482 | lib/presentation/widgets/image_editor/tools/eraser_tool.dart:203-213 — before extracting anything, compare `lib/presentation/widgets/image_editor/tools/brush_tool.dart` and `lib/presentation/widgets/image_editor/tools/eraser_tool.dart` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/tools/brush_tool.dart:472` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:147— lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:147-157 | lib/presentation/widgets/online_gallery/gallery_prompt_copy_dialog.dart:94-104 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/presentation/widgets/prompt/regex_rules_dialog.dart:82— lib/presentation/widgets/prompt/regex_rules_dialog.dart:82-92 | lib/presentation/widgets/prompt/regex_rules_dialog.dart:592-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/regex_rules_dialog.dart:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) lib/core/utils/character_prompt_block_parser.dart:264— lib/core/utils/character_prompt_block_parser.dart:264-274 | lib/data/services/online_gallery/artist_chain_parser.dart:301-311 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:51— lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:51-61 | lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart:51-61 — before extracting anything, compare `lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart` and `lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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) lib/core/autocomplete/tag_catalog_repository.dart:165— lib/core/autocomplete/tag_catalog_repository.dart:165-173 | lib/core/autocomplete/tag_catalog_repository.dart:209-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/autocomplete/tag_catalog_repository.dart:165` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) lib/core/storage/secure_storage_service.dart:359— lib/core/storage/secure_storage_service.dart:359-368 | lib/core/storage/secure_storage_service.dart:400-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/storage/secure_storage_service.dart:359` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) lib/data/services/official_random_prompt_generator.dart:376— lib/data/services/official_random_prompt_generator.dart:376-384 | lib/data/services/official_random_prompt_generator.dart:684-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/official_random_prompt_generator.dart:376` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:118— lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:118-126 | lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:332-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:118` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:231— lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:231-239 | lib/presentation/widgets/prompt/diy/dialogs/preset_import_dialog.dart:319-327 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) lib/presentation/providers/online_gallery_blacklist_provider.dart:470— lib/presentation/providers/online_gallery_blacklist_provider.dart:470-478 | lib/presentation/providers/online_gallery_blacklist_provider.dart:768-776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/online_gallery_blacklist_provider.dart:470` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) lib/presentation/screens/generation/mobile_layout.dart:90— lib/presentation/screens/generation/mobile_layout.dart:90-98 | lib/presentation/screens/generation/widgets/generation_controls/generation_controls.dart:38-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/mobile_layout.dart:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:77— lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:77-85 | lib/presentation/screens/watermark/watermark_editor_launcher.dart:75-83 — `lib/presentation/screens/mosaic/mosaic_editor_launcher.dart` and `lib/presentation/screens/watermark/watermark_editor_launcher.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 5 separate duplicated blocks between them, totalling at least 47 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:367— lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:367-378 | lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:676-684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:1199— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:1199-1207 | lib/presentation/screens/vibe_library/vibe_library_workspace.dart:463-471 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:1199` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:63— lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:63-71 | lib/presentation/screens/settings/sections/agent/skill_management_panel.dart:272-280 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:63` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) lib/presentation/screens/settings/widgets/cache_statistics_tile.dart:322— lib/presentation/screens/settings/widgets/cache_statistics_tile.dart:322-330 | lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:670-678 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/widgets/cache_statistics_tile.dart:322` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/screens/settings/widgets/cache_statistics_tile.dart:320` calls `of` and `lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:669` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) lib/presentation/widgets/online_gallery/gallery_detail_overview_card.dart:201— lib/presentation/widgets/online_gallery/gallery_detail_overview_card.dart:201-209 | lib/presentation/widgets/online_gallery/gallery_detail_text_section.dart:25-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/online_gallery/gallery_detail_overview_card.dart:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) lib/core/krita/krita_bridge_server.dart:311— lib/core/krita/krita_bridge_server.dart:311-319 | lib/core/mcp/mcp_discovery_file.dart:157-165 — 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) lib/data/services/image_metadata_service.dart:769— lib/data/services/image_metadata_service.dart:769-777 | lib/data/services/metadata/hash_calculator.dart:195-203 — 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) lib/presentation/agent_chat/services/precise_reference_toolbox.dart:22— lib/presentation/agent_chat/services/precise_reference_toolbox.dart:22-30 | lib/presentation/agent_chat/services/vibe_library_toolbox.dart:21-29 — 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) lib/core/utils/prompt_edit_document.dart:32— lib/core/utils/prompt_edit_document.dart:32-40 | lib/presentation/widgets/prompt/tag_editor_session.dart:14-22 — 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) lib/data/models/prompt/pool_sync_config.dart:105— lib/data/models/prompt/pool_sync_config.dart:105-113 | lib/data/models/prompt/sync_config.dart:164-172 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:67— lib/presentation/screens/mosaic/mosaic_editor_launcher.dart:67-75 | lib/presentation/screens/watermark/watermark_editor_launcher.dart:65-73 — `lib/presentation/screens/mosaic/mosaic_editor_launcher.dart` and `lib/presentation/screens/watermark/watermark_editor_launcher.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 5 separate duplicated blocks between them, totalling at least 47 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) lib/presentation/widgets/prompt/quality_tags_selector.dart:282— lib/presentation/widgets/prompt/quality_tags_selector.dart:282-290 | lib/presentation/widgets/prompt/uc_preset_selector.dart:309-317 — before extracting anything, compare `lib/presentation/widgets/prompt/quality_tags_selector.dart` and `lib/presentation/widgets/prompt/uc_preset_selector.dart` as WHOLE FILES: this scan already matched 4 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 (8 lines × 2) lib/core/agent/skill_archive_service.dart:212— lib/core/agent/skill_archive_service.dart:212-219 | lib/data/services/local_onnx_model_service.dart:277-284 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/data/services/local_onnx_model_service.dart:285` calls `File`, `join` and `lib/core/agent/skill_archive_service.dart:220` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) lib/core/autocomplete/completion_ranker.dart:70— lib/core/autocomplete/completion_ranker.dart:70-77 | lib/core/autocomplete/cooccurrence_completion_source.dart:79-86 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) lib/data/cloud_sync/app_cloud_sync_data_source.dart:83— lib/data/cloud_sync/app_cloud_sync_data_source.dart:83-90 | lib/data/cloud_sync/app_cloud_sync_data_source.dart:181-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/cloud_sync/app_cloud_sync_data_source.dart:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) lib/data/cloud_sync/precise_ref_cloud_sync_adapter.dart:51— lib/data/cloud_sync/precise_ref_cloud_sync_adapter.dart:51-58 | lib/data/services/precise_ref_library_archive_service.dart:68-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 (8 lines × 2) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:276— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:276-283 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:203-210 — before extracting anything, compare `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart` and `lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:276` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) lib/data/services/efficient_vit_sam_service.dart:317— lib/data/services/efficient_vit_sam_service.dart:317-324 | lib/data/services/local_onnx_tagger_service.dart:347-354 — before extracting anything, compare `lib/data/services/efficient_vit_sam_service.dart` and `lib/data/services/local_onnx_tagger_service.dart` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/efficient_vit_sam_service.dart:317` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/data/services/local_onnx_tagger_service.dart:356` calls `resolveIntraOpThreadCount` and `lib/data/services/efficient_vit_sam_service.dart:325` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) lib/data/services/online_gallery/quick_tag_cloud_parser.dart:46— lib/data/services/online_gallery/quick_tag_cloud_parser.dart:46-53 | lib/data/services/online_gallery/quick_tag_cloud_parser.dart:84-91 — both copies are in the same file, so extract the block into 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) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:133— lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:133-140 | lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:158-165 — before extracting anything, compare `lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart` and `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:133` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) lib/presentation/screens/mosaic/mosaic_editor_screen.dart:455— lib/presentation/screens/mosaic/mosaic_editor_screen.dart:455-462 | lib/presentation/screens/watermark/watermark_editor_screen.dart:559-566 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/mosaic/mosaic_editor_screen.dart:455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:507— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:507-514 | lib/presentation/widgets/common/update_check_dialog.dart:823-830 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:507` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:231— lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:231-238 | lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:277-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:287` calls `add`, `Offset` and `lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:239` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:1053— lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:1053-1060 | lib/presentation/widgets/prompt/random_manager/tag_group_diy_section.dart:28-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:1053` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:1062` calls `GestureDetector` and `lib/presentation/widgets/prompt/random_manager/tag_group_diy_section.dart:36` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) lib/core/cloud_sync/backend/webdav_capability_probe.dart:292— lib/core/cloud_sync/backend/webdav_capability_probe.dart:292-299 | lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:577-584 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) lib/presentation/screens/generation/desktop_layout.dart:74— lib/presentation/screens/generation/desktop_layout.dart:74-81 | lib/presentation/screens/generation/web_style_layout.dart:65-72 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) lib/presentation/widgets/character/character_prompt_button.dart:171— lib/presentation/widgets/character/character_prompt_button.dart:171-178 | lib/presentation/widgets/character/inline_character_row.dart:686-693 — before extracting anything, compare `lib/presentation/widgets/character/character_prompt_button.dart` and `lib/presentation/widgets/character/inline_character_row.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) lib/presentation/widgets/character/inline_character_card.dart:137— lib/presentation/widgets/character/inline_character_card.dart:137-144 | lib/presentation/widgets/character/inline_character_row.dart:330-337 — 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 (8 lines × 2) lib/presentation/widgets/image_editor/core/canvas_controller.dart:55— lib/presentation/widgets/image_editor/core/canvas_controller.dart:55-62 | lib/presentation/widgets/image_editor/core/tool_manager.dart:223-230 — 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 (8 lines × 2) lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:377— lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:377-384 | lib/core/agent/harness/session/session_memory.dart:88-95 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) lib/data/datasources/remote/online_gallery/quick_tag_cloud_gallery_mapper.dart:208— lib/data/datasources/remote/online_gallery/quick_tag_cloud_gallery_mapper.dart:208-215 | lib/data/services/no_repeat_round_sampler.dart:28-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×18
Edited copy of a member (11 corresponding lines) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1309— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1309-1323 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1325-1335 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/common/app_toast.dart:430— lib/presentation/widgets/common/app_toast.dart:430-440 | lib/presentation/widgets/common/app_toast.dart:660-670 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/prompt/global_settings_dialog.dart:93— lib/presentation/widgets/prompt/global_settings_dialog.dart:93-103 | lib/presentation/widgets/prompt/global_settings_dialog.dart:141-151 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/core/cloud_sync/coordinator.dart:597— lib/core/cloud_sync/coordinator.dart:597-607 | lib/data/cloud_sync/app_cloud_sync_data_source.dart:551-562 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/common/app_toast.dart:618— lib/presentation/widgets/common/app_toast.dart:618-628 | lib/presentation/widgets/common/app_toast.dart:630-640 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/common/card_action_buttons.dart:214— lib/presentation/widgets/common/card_action_buttons.dart:214-224 | lib/presentation/widgets/common/card_action_buttons.dart:254-265 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/core/agent/harness/env/dart_io_execution_env.dart:121— lib/core/agent/harness/env/dart_io_execution_env.dart:121-131 | lib/core/agent/harness/env/dart_io_execution_env.dart:158-168 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/core/database/datasources/cooccurrence_data_source.dart:177— lib/core/database/datasources/cooccurrence_data_source.dart:177-191 | lib/core/database/datasources/translation_data_source.dart:173-183 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/core/cloud_sync/journal.dart:191— lib/core/cloud_sync/journal.dart:191-203 | lib/presentation/agent_chat/services/agent_chat_session_controller.dart:665-675 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/data/datasources/remote/online_gallery/quick_tag_cloud_gallery_repository.dart:73— lib/data/datasources/remote/online_gallery/quick_tag_cloud_gallery_repository.dart:73-83 | lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:195-205 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/core/cloud_sync/snapshot_transfer.dart:27— lib/core/cloud_sync/snapshot_transfer.dart:27-38 | lib/core/cloud_sync/snapshot_transfer.dart:40-50 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/agent_chat/widgets/agent_chat_tool_image_card.dart:18— lib/presentation/agent_chat/widgets/agent_chat_tool_image_card.dart:18-31 | lib/presentation/agent_chat/widgets/agent_chat_tool_image_card.dart:39-49 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/screens/settings/sections/appearance_settings_section.dart:180— lib/presentation/screens/settings/sections/appearance_settings_section.dart:180-190 | lib/presentation/screens/settings/sections/appearance_settings_section.dart:400-410 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/data/services/vibe_library_entry_reader.dart:237— lib/data/services/vibe_library_entry_reader.dart:237-247 | lib/data/services/vibe_library_storage_categories.dart:129-140 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/image_editor/image_editor_processing_service.dart:75— lib/presentation/widgets/image_editor/image_editor_processing_service.dart:75-85 | lib/presentation/widgets/image_editor/services/outpaint_service.dart:8-18 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/data/services/vibe_library_storage_service.dart:159— lib/data/services/vibe_library_storage_service.dart:159-169 | lib/presentation/providers/vibe_library_provider.dart:358-370 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/image_editor/image_editor_screen.dart:226— lib/presentation/widgets/image_editor/image_editor_screen.dart:226-237 | lib/presentation/widgets/image_editor/image_editor_workspace.dart:153-163 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) lib/presentation/widgets/image_editor/image_editor_screen.dart:238— lib/presentation/widgets/image_editor/image_editor_screen.dart:238-249 | lib/presentation/widgets/image_editor/image_editor_workspace.dart:165-175 — These two members are one piece of code written twice and then edited apart: 11 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 (7 corresponding lines) · ×18
Edited copy of a member (7 corresponding lines) lib/data/services/vibe_library_entry_reader.dart:213— lib/data/services/vibe_library_entry_reader.dart:213-220 | lib/data/services/vibe_library_entry_reader.dart:222-228 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/core/utils/exif_container.dart:129— lib/core/utils/exif_container.dart:129-135 | lib/data/services/metadata/exif_metadata_extractor.dart:226-232 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/data/cloud_sync/cloud_sync_operation_storage.dart:569— lib/data/cloud_sync/cloud_sync_operation_storage.dart:569-575 | lib/data/datasources/remote/online_gallery/quick_tag_cloud_query_engine.dart:187-194 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/data/services/random_prompt_generator.dart:1249— lib/data/services/random_prompt_generator.dart:1249-1255 | lib/presentation/providers/comfyui/comfyui_provider.dart:754-760 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:194— lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:194-200 | lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:202-208 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:753— lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:753-767 | lib/presentation/widgets/common/image_detail/components/detail_metadata_panel.dart:954-960 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:123— lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:123-130 | lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:132-138 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/prompt_assistant/services/prompt_assistant_api_client.dart:135— lib/presentation/prompt_assistant/services/prompt_assistant_api_client.dart:135-141 | lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:493-499 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/core/autocomplete/cooccurrence_pack_repository.dart:298— lib/core/autocomplete/cooccurrence_pack_repository.dart:298-304 | lib/data/repositories/gallery_category_repository.dart:137-143 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/core/database/datasources/gallery_query.dart:55— lib/core/database/datasources/gallery_query.dart:55-63 | lib/core/constants/api_constants.dart:1162-1168 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/core/agent/resources/agent_chat_resource_reference_codec.dart:214— lib/core/agent/resources/agent_chat_resource_reference_codec.dart:214-220 | lib/core/autocomplete/cooccurrence_manifest_codec.dart:146-152 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:369— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:369-376 | lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:395-401 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/core/autocomplete/autocomplete_cache_database.dart:151— lib/core/autocomplete/autocomplete_cache_database.dart:151-157 | lib/core/database/datasources/translation_data_source.dart:161-167 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/data/services/vibe_library_entry_writer.dart:143— lib/data/services/vibe_library_entry_writer.dart:143-149 | lib/data/services/vibe_library_storage_service.dart:253-259 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/widgets/image_editor/tools/selection/base_selection_tool.dart:115— lib/presentation/widgets/image_editor/tools/selection/base_selection_tool.dart:115-121 | lib/presentation/widgets/image_editor/tools/selection/lasso_selection_tool.dart:27-37 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/core/services/update_installer_service.dart:736— lib/core/services/update_installer_service.dart:736-742 | lib/core/services/verified_resumable_downloader.dart:481-487 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/widgets/image_editor/tools/brush_tool.dart:381— lib/presentation/widgets/image_editor/tools/brush_tool.dart:381-387 | lib/presentation/widgets/image_editor/tools/eraser_tool.dart:164-170 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) lib/presentation/widgets/character/inline_character_editor.dart:466— lib/presentation/widgets/character/inline_character_editor.dart:466-472 | lib/presentation/widgets/common/pagination_bar.dart:81-87 — These two members are one piece of code written twice and then edited apart: 7 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.
Duplicated block (14 lines × 2) lib/data/services/gallery/gallery_scan_coordinator.dart:51— lib/data/services/gallery/gallery_scan_coordinator.dart:51-64 | lib/data/services/gallery/local_gallery_service_impl.dart:68-81 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/gallery/gallery_scan_coordinator.dart:51` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/data/services/gallery/local_gallery_service_impl.dart:65` calls `value` and `lib/data/services/gallery/gallery_scan_coordinator.dart:50` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) lib/presentation/agent_chat/providers/agent_chat_notifier.dart:1356— lib/presentation/agent_chat/providers/agent_chat_notifier.dart:1356-1369 | lib/presentation/agent_chat/services/agent_chat_event_controller.dart:275-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 (14 lines × 2) lib/presentation/agent_chat/services/agent_api_client.dart:23— lib/presentation/agent_chat/services/agent_api_client.dart:23-36 | lib/presentation/prompt_assistant/services/prompt_assistant_api_client.dart:120-133 — 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) lib/presentation/router/global_status_banners.dart:82— lib/presentation/router/global_status_banners.dart:82-95 | lib/presentation/router/global_status_banners.dart:140-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/router/global_status_banners.dart:82` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:575— lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:575-588 | lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:331-344 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:575` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:197— lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:197-210 | lib/presentation/screens/settings/sections/agent/skill_management_panel.dart:308-321 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) lib/presentation/screens/settings/widgets/cache_statistics_tile.dart:216— lib/presentation/screens/settings/widgets/cache_statistics_tile.dart:216-229 | lib/presentation/widgets/queue/task_list_item.dart:1233-1246 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) lib/presentation/services/library_sidebar_move_service.dart:28— lib/presentation/services/library_sidebar_move_service.dart:28-41 | lib/presentation/services/library_sidebar_move_service.dart:50-63 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/services/library_sidebar_move_service.dart:28` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:60— lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:60-73 | lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:91-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:60` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/widgets/common/app_toast.dart:381— lib/presentation/widgets/common/app_toast.dart:381-394 | lib/presentation/widgets/common/app_toast.dart:566-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/widgets/common/app_toast.dart:563` calls `clamp` and `lib/presentation/widgets/common/app_toast.dart:380` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) lib/presentation/widgets/common/save_as_preset_dialog.dart:440— lib/presentation/widgets/common/save_as_preset_dialog.dart:440-453 | lib/presentation/widgets/common/save_vibe_dialog.dart:344-357 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/save_as_preset_dialog.dart:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/widgets/danbooru_post_card.dart:940— lib/presentation/widgets/danbooru_post_card.dart:940-953 | lib/presentation/widgets/danbooru_post_card.dart:1201-1214 — both copies are in the same file, so extract the block into 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) lib/presentation/widgets/image_editor/tools/brush_tool.dart:215— lib/presentation/widgets/image_editor/tools/brush_tool.dart:215-228 | lib/presentation/widgets/image_editor/tools/eraser_tool.dart:79-92 — before extracting anything, compare `lib/presentation/widgets/image_editor/tools/brush_tool.dart` and `lib/presentation/widgets/image_editor/tools/eraser_tool.dart` as WHOLE FILES: this scan already matched 5 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/widgets/image_editor/tools/brush_tool.dart:232` calls `strokeStyleFor` and `lib/presentation/widgets/image_editor/tools/eraser_tool.dart:96` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:201— lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:201-214 | lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:374-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:201` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:600— lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:600-613 | lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:675-688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:600` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:119— lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:119-132 | lib/presentation/widgets/online_gallery/gallery_prompt_copy_dialog.dart:70-83 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) lib/presentation/widgets/prompt/global_settings_dialog.dart:440— lib/presentation/widgets/prompt/global_settings_dialog.dart:440-453 | lib/presentation/widgets/prompt/random_manager/tag_group_diy_section.dart:78-92 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/global_settings_dialog.dart:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) krita_plugin/nai_launcher_bridge/ui.py:382— krita_plugin/nai_launcher_bridge/ui.py:382-395 | krita_plugin/nai_launcher_bridge/ui.py:420-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) lib/core/cloud_sync/backend/webdav_capability_probe.dart:165— lib/core/cloud_sync/backend/webdav_capability_probe.dart:165-177 | lib/core/cloud_sync/backend/webdav_capability_probe.dart:178-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 (13 lines × 2) lib/core/database/datasources/gallery_favorite_tag_repository.dart:171— lib/core/database/datasources/gallery_favorite_tag_repository.dart:171-183 | lib/core/database/datasources/gallery_favorite_tag_repository.dart:314-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_favorite_tag_repository.dart:171` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) lib/core/utils/fatal_diagnostics.dart:182— lib/core/utils/fatal_diagnostics.dart:182-194 | lib/core/utils/fatal_diagnostics.dart:198-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/fatal_diagnostics.dart:182` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1392— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1392-1404 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1420-1432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1392` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) lib/data/datasources/remote/danbooru_api_service.dart:519— lib/data/datasources/remote/danbooru_api_service.dart:519-531 | lib/data/datasources/remote/danbooru_api_service.dart:541-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/danbooru_api_service.dart:519` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) lib/data/services/tag_library_import_planner.dart:80— lib/data/services/tag_library_import_planner.dart:80-92 | lib/data/services/tag_library_import_planner.dart:119-131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/tag_library_import_planner.dart:80` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart:272— lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart:272-284 | lib/presentation/agent_chat/widgets/agent_chat_turn.dart:494-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart:272` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) lib/presentation/providers/generation/image_generation_coordinator.dart:531— lib/presentation/providers/generation/image_generation_coordinator.dart:531-543 | lib/presentation/providers/generation/image_generation_coordinator.dart:551-563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/generation/image_generation_coordinator.dart:531` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) lib/presentation/screens/generation/widgets/img2img_panel.dart:85— lib/presentation/screens/generation/widgets/img2img_panel.dart:85-97 | lib/presentation/screens/generation/widgets/unified_reference_panel.dart:372-384 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/img2img_panel.dart:85` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) lib/presentation/screens/online_gallery/online_gallery_content.dart:87— lib/presentation/screens/online_gallery/online_gallery_content.dart:87-99 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_auth_dialogs.dart:38-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:170— lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:170-182 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:211-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:206— lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:206-218 | lib/presentation/widgets/danbooru_login_dialog.dart:162-174 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:206` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) lib/presentation/widgets/auth/third_party_api_login_card.dart:156— lib/presentation/widgets/auth/third_party_api_login_card.dart:156-169 | lib/presentation/widgets/auth/token_login_card.dart:119-131 — before extracting anything, compare `lib/presentation/widgets/auth/third_party_api_login_card.dart` and `lib/presentation/widgets/auth/token_login_card.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/auth/third_party_api_login_card.dart:156` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) lib/presentation/widgets/common/image_detail/components/vibe_section.dart:328— lib/presentation/widgets/common/image_detail/components/vibe_section.dart:328-340 | lib/presentation/widgets/common/image_detail/components/vibe_section.dart:347-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/image_detail/components/vibe_section.dart:328` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart:241— lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart:241-253 | lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:682-694 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart:241` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) lib/presentation/widgets/image_editor/tools/brush_tool.dart:190— lib/presentation/widgets/image_editor/tools/brush_tool.dart:190-202 | lib/presentation/widgets/image_editor/tools/eraser_tool.dart:54-66 — before extracting anything, compare `lib/presentation/widgets/image_editor/tools/brush_tool.dart` and `lib/presentation/widgets/image_editor/tools/eraser_tool.dart` as WHOLE FILES: this scan already matched 5 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) krita_plugin/preflight.py:124— krita_plugin/preflight.py:124-136 | krita_plugin/preflight.py:142-154 — both copies are in the same file, so extract the block into 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) REDACTED:79— REDACTED:79-91 | REDACTED:114-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×17
Edited copy of a member (18 corresponding lines) lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:182— lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:182-200 | lib/presentation/widgets/image_editor/widgets/toolbar/mobile_toolbar.dart:159-176 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:339— lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:339-362 | lib/presentation/screens/generation/widgets/img2img_panel_coordinator.dart:35-52 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/data/services/inpaint_draft_file_repository.dart:447— lib/data/services/inpaint_draft_file_repository.dart:447-468 | lib/data/services/inpaint_draft_file_repository.dart:470-487 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/widgets/discord_share/discord_share_dialog.dart:912— lib/presentation/widgets/discord_share/discord_share_dialog.dart:912-937 | lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:668-685 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/providers/fixed_tags_provider.dart:232— lib/presentation/providers/fixed_tags_provider.dart:232-249 | lib/presentation/providers/fixed_tags_provider.dart:251-272 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/widgets/navigation/nav_rail_items.dart:114— lib/presentation/widgets/navigation/nav_rail_items.dart:114-135 | lib/presentation/widgets/navigation/nav_rail_items.dart:169-186 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/providers/online_gallery_command_service.dart:395— lib/presentation/providers/online_gallery_command_service.dart:395-412 | lib/presentation/providers/online_gallery_command_service.dart:414-434 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/widgets/common/image_card_actions.dart:326— lib/presentation/widgets/common/image_card_actions.dart:326-343 | lib/presentation/widgets/common/image_card_actions.dart:353-370 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:235— lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:235-260 | lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:145-162 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/data/repositories/gallery_category_repository.dart:733— lib/data/repositories/gallery_category_repository.dart:733-756 | lib/data/repositories/gallery_folder_repository.dart:64-81 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/widgets/shortcuts/shortcut_tooltip.dart:170— lib/presentation/widgets/shortcuts/shortcut_tooltip.dart:170-193 | lib/presentation/widgets/shortcuts/shortcut_tooltip.dart:344-361 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:509— lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:509-527 | lib/presentation/widgets/image_editor/widgets/panels/layer_panel.dart:775-792 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/providers/online_gallery_local_favorites_provider.dart:74— lib/presentation/providers/online_gallery_local_favorites_provider.dart:74-91 | lib/presentation/providers/online_gallery_local_favorites_provider.dart:93-110 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/data/services/vibe_generation_state_repository.dart:59— lib/data/services/vibe_generation_state_repository.dart:59-78 | lib/data/services/vibe_generation_state_repository.dart:80-97 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/data/cloud_sync/app_cloud_sync_adapters.dart:536— lib/data/cloud_sync/app_cloud_sync_adapters.dart:536-553 | lib/data/cloud_sync/ffdkj_install_intent_adapter.dart:34-52 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/presentation/widgets/image_editor/frame/frame_tool_panel.dart:183— lib/presentation/widgets/image_editor/frame/frame_tool_panel.dart:183-205 | lib/presentation/widgets/library_export/library_export_controls.dart:14-31 — These two members are one piece of code written twice and then edited apart: 18 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 (18 corresponding lines) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:179— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:179-196 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:198-215 — These two members are one piece of code written twice and then edited apart: 18 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 (13 corresponding lines) · ×17
Edited copy of a member (13 corresponding lines) lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:351— lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:351-363 | lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:365-377 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/widgets/common/weight_adjust_toolbar.dart:356— lib/presentation/widgets/common/weight_adjust_toolbar.dart:356-368 | lib/presentation/widgets/prompt/tag_editor_view.dart:400-412 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:784— lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:784-796 | lib/core/cloud_sync/backend/onedrive_api_client.dart:691-703 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/utils/character_prompt_block_parser.dart:218— lib/core/utils/character_prompt_block_parser.dart:218-230 | lib/data/services/online_gallery/artist_chain_parser.dart:230-247 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:148— lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:148-162 | lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:308-320 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/providers/reverse_prompt_provider.dart:34— lib/presentation/providers/reverse_prompt_provider.dart:34-47 | lib/presentation/providers/reverse_prompt_provider.dart:244-256 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/data/services/vibe_file_repository.dart:516— lib/data/services/vibe_file_repository.dart:516-531 | lib/data/services/vibe_portable_file_store.dart:58-70 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/agent/harness/env/dart_io_execution_env.dart:218— lib/core/agent/harness/env/dart_io_execution_env.dart:218-230 | lib/core/agent/harness/env/dart_io_execution_env.dart:335-347 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/cloud_sync/coordinator.dart:503— lib/core/cloud_sync/coordinator.dart:503-515 | lib/core/cloud_sync/coordinator.dart:540-552 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/database/providers/data_source_cache_provider.dart:35— lib/core/database/providers/data_source_cache_provider.dart:35-51 | lib/core/services/danbooru_tags_protocol.dart:28-40 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/widgets/common/image_picker_card/image_picker_card.dart:571— lib/presentation/widgets/common/image_picker_card/image_picker_card.dart:571-583 | lib/presentation/widgets/common/image_picker_card/image_picker_card.dart:585-597 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/providers/cloud_sync/cloud_sync_application_service.dart:369— lib/presentation/providers/cloud_sync/cloud_sync_application_service.dart:369-381 | lib/presentation/providers/cloud_sync/cloud_sync_application_service.dart:383-398 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/providers/quality_preset_provider.dart:33— lib/presentation/providers/quality_preset_provider.dart:33-48 | lib/presentation/providers/uc_preset_provider.dart:27-39 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/core/cloud_sync/coordinator.dart:489— lib/core/cloud_sync/coordinator.dart:489-501 | lib/core/cloud_sync/coordinator.dart:524-538 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/providers/vibe_library_provider.dart:371— lib/presentation/providers/vibe_library_provider.dart:371-385 | lib/data/services/vibe_library_storage_service.dart:170-182 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/widgets/image_editor/services/magic_wand_service.dart:11— lib/presentation/widgets/image_editor/services/magic_wand_service.dart:11-25 | lib/presentation/widgets/image_editor/image_editor_processing_service.dart:55-67 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) lib/presentation/agent_chat/services/manual_inpaint_toolbox.dart:793— lib/presentation/agent_chat/services/manual_inpaint_toolbox.dart:793-807 | lib/presentation/screens/derivatives/derivative_copy_saver.dart:141-153 — These two members are one piece of code written twice and then edited apart: 13 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 (15 corresponding lines) · ×15
Edited copy of a member (15 corresponding lines) lib/core/database/datasources/gallery_album_repository.dart:366— lib/core/database/datasources/gallery_album_repository.dart:366-380 | lib/core/database/datasources/gallery_album_repository.dart:382-397 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/data/services/precise_ref_library_archive_service.dart:293— lib/data/services/precise_ref_library_archive_service.dart:293-307 | lib/data/services/tag_library_io_service.dart:457-472 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/data/services/inpaint_draft_file_repository.dart:491— lib/data/services/inpaint_draft_file_repository.dart:491-505 | lib/data/services/inpaint_draft_file_store.dart:55-71 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) krita_plugin/preflight.py:124— krita_plugin/preflight.py:124-138 | krita_plugin/preflight.py:142-159 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/providers/online_gallery_blacklist_provider.dart:169— lib/presentation/providers/online_gallery_blacklist_provider.dart:169-184 | lib/presentation/providers/online_gallery_blacklist_provider.dart:186-200 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/screens/settings/sections/privacy_settings_section.dart:62— lib/presentation/screens/settings/sections/privacy_settings_section.dart:62-76 | lib/presentation/screens/settings/sections/privacy_settings_section.dart:78-92 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/screens/generation/widgets/img2img_source_section.dart:366— lib/presentation/screens/generation/widgets/img2img_source_section.dart:366-388 | lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:875-889 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/providers/precise_ref_library_provider.dart:325— lib/presentation/providers/precise_ref_library_provider.dart:325-339 | lib/presentation/providers/precise_ref_library_provider.dart:341-355 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart:226— lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart:226-240 | lib/presentation/screens/generation/widgets/reverse_prompt_panel.dart:477-497 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:300— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:300-314 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:420-437 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/screens/watermark/watermark_editor_screen.dart:174— lib/presentation/screens/watermark/watermark_editor_screen.dart:174-189 | lib/presentation/screens/watermark/watermark_editor_screen.dart:191-205 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:255— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:255-269 | lib/presentation/screens/vibe_library/vibe_library_screen.dart:568-582 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:195— lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:195-211 | lib/presentation/widgets/common/image_detail/components/vibe_section.dart:368-382 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/presentation/widgets/auth/third_party_api_login_card.dart:206— lib/presentation/widgets/auth/third_party_api_login_card.dart:206-220 | lib/presentation/widgets/auth/third_party_api_login_card.dart:222-236 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) lib/core/agent/harness/harness_types.dart:85— lib/core/agent/harness/harness_types.dart:85-99 | lib/presentation/agent_chat/services/execution_toolbox.dart:31-45 — These two members are one piece of code written twice and then edited apart: 15 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 (16 corresponding lines) · ×15
Edited copy of a member (16 corresponding lines) lib/presentation/screens/precise_ref_library/widgets/precise_ref_card.dart:98— lib/presentation/screens/precise_ref_library/widgets/precise_ref_card.dart:98-124 | lib/presentation/screens/precise_ref_library/widgets/precise_ref_selector_dialog.dart:400-415 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/screens/local_gallery/local_gallery_screen_controller.dart:299— lib/presentation/screens/local_gallery/local_gallery_screen_controller.dart:299-314 | lib/presentation/screens/local_gallery/local_gallery_screen_controller.dart:432-448 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:478— lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:478-495 | lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:497-512 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:15— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:15-31 | lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:15-30 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:671— lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:671-686 | lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:822-839 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:425— lib/data/cloud_sync/agent_cloud_sync_adapters.dart:425-444 | lib/data/cloud_sync/verified_blob_store.dart:25-40 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/data/models/prompt/diy_category_references.dart:67— lib/data/models/prompt/diy_category_references.dart:67-82 | lib/data/services/random_preset_rules.dart:147-163 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/screens/generation/widgets/prompt_tooltip_components.dart:506— lib/presentation/screens/generation/widgets/prompt_tooltip_components.dart:506-521 | lib/presentation/widgets/prompt/diy/diy_badges.dart:17-33 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/data/models/watermark/watermark_settings.dart:615— lib/data/models/watermark/watermark_settings.dart:615-631 | lib/data/models/watermark/watermark_settings.dart:633-648 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/widgets/common/app_toast.dart:399— lib/presentation/widgets/common/app_toast.dart:399-414 | lib/presentation/widgets/common/app_toast.dart:587-607 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/agent_chat/services/generation_character_orchestration.dart:199— lib/presentation/agent_chat/services/generation_character_orchestration.dart:199-220 | lib/presentation/agent_chat/services/prompt_toolbox.dart:771-786 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/screens/generation/widgets/generation_param_sections.dart:425— lib/presentation/screens/generation/widgets/generation_param_sections.dart:425-440 | lib/presentation/screens/generation/widgets/size_selector.dart:64-83 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/widgets/common/model_family_icon.dart:161— lib/presentation/widgets/common/model_family_icon.dart:161-181 | lib/presentation/widgets/common/provider_icon.dart:161-176 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/core/mosaic/mosaic_render_service.dart:423— lib/core/mosaic/mosaic_render_service.dart:423-438 | lib/core/watermark/watermark_render_service.dart:293-308 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) lib/presentation/screens/prompt_config/widgets/prompt_config_expanded_workspace.dart:21— lib/presentation/screens/prompt_config/widgets/prompt_config_expanded_workspace.dart:21-38 | lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:205-220 — These two members are one piece of code written twice and then edited apart: 16 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 (8 corresponding lines) · ×13
Edited copy of a member (8 corresponding lines) lib/data/services/metadata/ai_tag_generation_parser.dart:217— lib/data/services/metadata/ai_tag_generation_parser.dart:217-224 | lib/presentation/screens/statistics/widgets/dashboard/aspect_ratio_card.dart:60-71 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/data/services/vibe_import_service.dart:467— lib/data/services/vibe_import_service.dart:467-478 | lib/presentation/screens/vibe_library/vibe_import_controller.dart:589-596 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) tool/cloud_sync/cloud_sync_production_benchmark.dart:331— tool/cloud_sync/cloud_sync_production_benchmark.dart:331-338 | tool/cloud_sync/cloud_sync_production_benchmark.dart:340-348 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:872— lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:872-879 | lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:881-888 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/presentation/providers/composition_guide_provider.dart:42— lib/presentation/providers/composition_guide_provider.dart:42-49 | lib/presentation/providers/composition_guide_provider.dart:51-58 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/data/services/precise_ref_library_storage_service.dart:391— lib/data/services/precise_ref_library_storage_service.dart:391-398 | lib/data/services/precise_ref_library_storage_service.dart:400-407 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:543— lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:543-550 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:398-405 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:54— lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:54-61 | lib/presentation/widgets/prompt/diy/panels/visibility_rule_panel.dart:48-58 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/presentation/screens/mosaic/mosaic_editor_screen.dart:471— lib/presentation/screens/mosaic/mosaic_editor_screen.dart:471-478 | lib/presentation/screens/watermark/watermark_editor_screen.dart:570-577 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/data/models/agent/agent_settings.dart:74— lib/data/models/agent/agent_settings.dart:74-81 | lib/data/models/prompt_assistant/prompt_assistant_models.dart:1032-1040 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/presentation/widgets/image_editor/tools/move_tool_panel.dart:274— lib/presentation/widgets/image_editor/tools/move_tool_panel.dart:274-281 | lib/presentation/widgets/image_editor/tools/tool_setting_rows.dart:171-178 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/presentation/widgets/common/shimmer_skeleton.dart:34— lib/presentation/widgets/common/shimmer_skeleton.dart:34-42 | lib/presentation/widgets/queue/task_list_item.dart:1224-1231 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:446— lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:446-454 | lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:831-838 — These two members are one piece of code written twice and then edited apart: 8 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.
Duplicated block (15 lines × 2) lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:200— lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:200-214 | lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:379-393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:215` calls `toString` and `lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:394` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:284— lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:284-298 | lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:477-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) lib/core/network/web_access/exa_search_client.dart:88— lib/core/network/web_access/exa_search_client.dart:88-102 | lib/core/network/web_access/searxng_search_client.dart:25-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/network/web_access/exa_search_client.dart:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15 lines × 2) lib/data/datasources/remote/danbooru_api_service.dart:536— lib/data/datasources/remote/danbooru_api_service.dart:536-550 | lib/data/datasources/remote/danbooru_api_service.dart:556-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/danbooru_api_service.dart:536` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15 lines × 2) lib/data/services/efficient_vit_sam_service.dart:301— lib/data/services/efficient_vit_sam_service.dart:301-315 | lib/data/services/local_onnx_tagger_service.dart:331-345 — before extracting anything, compare `lib/data/services/efficient_vit_sam_service.dart` and `lib/data/services/local_onnx_tagger_service.dart` as WHOLE FILES: this scan already matched 5 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 (15 lines × 2) lib/data/services/online_gallery/quick_tag_cloud_media_resolver.dart:34— lib/data/services/online_gallery/quick_tag_cloud_media_resolver.dart:34-48 | lib/data/services/online_gallery/quick_tag_cloud_media_resolver.dart:149-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/online_gallery/quick_tag_cloud_media_resolver.dart:34` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) lib/presentation/providers/online_gallery_blacklist_provider.dart:299— lib/presentation/providers/online_gallery_blacklist_provider.dart:299-313 | lib/presentation/providers/online_gallery_blacklist_provider.dart:375-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/online_gallery_blacklist_provider.dart:299` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:513— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:513-527 | lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:549-563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:513` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:22— lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:22-36 | lib/presentation/themes/modules/color/palettes/neo_dark_palette.dart:25-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:22` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) lib/presentation/widgets/common/save_vibe_dialog.dart:389— lib/presentation/widgets/common/save_vibe_dialog.dart:389-403 | lib/presentation/widgets/prompt/diy/dialogs/preset_import_dialog.dart:381-395 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/save_vibe_dialog.dart:389` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) lib/presentation/widgets/image_editor/tools/brush_tool.dart:503— lib/presentation/widgets/image_editor/tools/brush_tool.dart:503-517 | lib/presentation/widgets/image_editor/tools/eraser_tool.dart:219-233 — before extracting anything, compare `lib/presentation/widgets/image_editor/tools/brush_tool.dart` and `lib/presentation/widgets/image_editor/tools/eraser_tool.dart` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/tools/brush_tool.dart:503` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) lib/presentation/widgets/image_editor/widgets/color_picker.dart:193— lib/presentation/widgets/image_editor/widgets/color_picker.dart:193-207 | lib/presentation/widgets/image_editor/widgets/color_picker.dart:283-297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/widgets/color_picker.dart:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) lib/presentation/widgets/prompt/fixed_tags_dialog_chrome.dart:41— lib/presentation/widgets/prompt/fixed_tags_dialog_chrome.dart:41-55 | lib/presentation/widgets/prompt/fixed_tags_dialog_chrome.dart:190-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/fixed_tags_dialog_chrome.dart:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×12
Edited copy of a member (17 corresponding lines) lib/presentation/providers/vibe_library_provider.dart:417— lib/presentation/providers/vibe_library_provider.dart:417-433 | lib/presentation/providers/vibe_library_provider.dart:435-452 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/data/services/gallery/gallery_scan_coordinator.dart:48— lib/data/services/gallery/gallery_scan_coordinator.dart:48-64 | lib/data/services/gallery/local_gallery_service_impl.dart:60-81 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/presentation/widgets/common/themed_input.dart:265— lib/presentation/widgets/common/themed_input.dart:265-289 | lib/presentation/widgets/prompt/tag_mode_prompt_field.dart:105-121 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:94— lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:94-110 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:78-96 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/data/services/inpaint_draft_file_repository.dart:408— lib/data/services/inpaint_draft_file_repository.dart:408-424 | lib/data/services/inpaint_draft_file_repository.dart:426-445 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:464— lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:464-482 | lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:537-553 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/presentation/screens/generation/widgets/prompt_input_toolbar.dart:362— lib/presentation/screens/generation/widgets/prompt_input_toolbar.dart:362-382 | lib/presentation/screens/generation/widgets/prompt_input_toolbar.dart:384-400 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:770— lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:770-786 | lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:788-804 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/data/datasources/remote/danbooru_api_service.dart:332— lib/data/datasources/remote/danbooru_api_service.dart:332-349 | lib/data/datasources/remote/danbooru_api_service.dart:351-367 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/presentation/prompt_assistant/providers/prompt_assistant_state_provider.dart:18— lib/presentation/prompt_assistant/providers/prompt_assistant_state_provider.dart:18-34 | lib/presentation/providers/warmup_provider.dart:78-94 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:214— lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:214-231 | lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:233-249 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) lib/presentation/screens/statistics/statistics_state.dart:125— lib/presentation/screens/statistics/statistics_state.dart:125-141 | lib/presentation/screens/statistics/statistics_state.dart:223-239 — These two members are one piece of code written twice and then edited apart: 17 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.
Duplicated block (16 lines × 2) lib/core/network/dio_client.dart:228— lib/core/network/dio_client.dart:228-243 | lib/data/datasources/remote/nai_auth_api_service.dart:255-270 — before extracting anything, compare `lib/core/network/dio_client.dart` and `lib/data/datasources/remote/nai_auth_api_service.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. 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) lib/core/services/file_export_service.dart:305— lib/core/services/file_export_service.dart:305-320 | lib/core/services/file_export_service.dart:334-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/services/file_export_service.dart:305` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) lib/core/utils/inpaint_outpaint_utils.dart:424— lib/core/utils/inpaint_outpaint_utils.dart:424-439 | lib/core/utils/inpaint_outpaint_utils.dart:727-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_outpaint_utils.dart:424` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) lib/data/services/image_metadata_service.dart:231— lib/data/services/image_metadata_service.dart:231-246 | lib/data/services/image_metadata_service.dart:342-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/image_metadata_service.dart:231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:92— lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:92-107 | lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.dart:95-110 — before extracting anything, compare `lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart` and `lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:212— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:212-227 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:247-262 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 134 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) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:233— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:233-248 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:269-284 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 134 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:233` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) lib/presentation/widgets/image_editor/tools/fill_tool.dart:122— lib/presentation/widgets/image_editor/tools/fill_tool.dart:122-137 | lib/presentation/widgets/image_editor/tools/magic_wand_tool.dart:82-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/tools/fill_tool.dart:122` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) lib/presentation/widgets/image_editor/widgets/color_picker.dart:236— lib/presentation/widgets/image_editor/widgets/color_picker.dart:236-251 | lib/presentation/widgets/image_editor/widgets/color_picker.dart:319-334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/widgets/color_picker.dart:236` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:337— lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:337-352 | lib/presentation/widgets/prompt/diy/panels/visibility_rule_panel.dart:223-238 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:337` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) lib/presentation/widgets/prompt/random_manager/preset_selector_bar.dart:326— lib/presentation/widgets/prompt/random_manager/preset_selector_bar.dart:326-341 | lib/presentation/widgets/prompt/random_manager/tag_group_card.dart:280-295 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/random_manager/preset_selector_bar.dart:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:186— lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:186-201 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:440-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `GallerySearchRequest` in one and `GalleryRandomSearchRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
Members sharing a duplicated core (4 members, 50+ identical tokens) lib/core/database/datasources/gallery_favorite_tag_repository.dart:143— lib/core/database/datasources/gallery_favorite_tag_repository.dart:143-186 | lib/core/database/datasources/gallery_favorite_tag_repository.dart:280-329 | lib/core/database/datasources/gallery_image_repository.dart:218-266 | lib/core/database/datasources/gallery_metadata_repository.dart:291-343 — 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) lib/core/database/datasources/gallery_favorite_tag_repository.dart:407— lib/core/database/datasources/gallery_favorite_tag_repository.dart:407-412 | lib/core/database/datasources/gallery_image_repository.dart:780-785 | lib/core/database/datasources/gallery_metadata_repository.dart:345-350 | lib/data/services/bulk_image_state_service.dart:320-325 — 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) lib/core/database/datasources/gallery_query.dart:72— lib/core/database/datasources/gallery_query.dart:72-132 | lib/core/database/datasources/gallery_query.dart:134-189 | lib/core/database/datasources/gallery_query.dart:191-276 | lib/core/database/datasources/gallery_query.dart:278-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) lib/core/utils/novelai_vibe_codec.dart:288— lib/core/utils/novelai_vibe_codec.dart:288-317 | lib/core/watermark/watermark_logo_service.dart:151-181 | lib/data/services/precise_ref_portable_importer.dart:13-55 | lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:687-715 — 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) lib/core/utils/pica_lanczos_resizer.dart:314— lib/core/utils/pica_lanczos_resizer.dart:314-356 | lib/core/utils/pica_lanczos_resizer.dart:358-404 | lib/core/utils/pica_lanczos_resizer.dart:406-452 | lib/core/utils/pica_lanczos_resizer.dart:454-507 — 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) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:253— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:253-274 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:874-895 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:185-201 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:439-455 — 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) lib/presentation/agent_chat/services/generation_execution_service.dart:291— lib/presentation/agent_chat/services/generation_execution_service.dart:291-297 | lib/presentation/providers/gallery_category_provider.dart:466-472 | lib/presentation/providers/online_gallery_blacklist_provider.dart:881-887 | lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart:503-509 — 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) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:63— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:63-243 | lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:71-263 | lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:97-286 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:70-287 — 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) lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:63— lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:63-194 | lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:289-453 | lib/presentation/widgets/character/add_to_library_dialog.dart:349-401 | lib/presentation/widgets/metadata/metadata_import_dialog.dart:112-220 — 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) lib/presentation/widgets/common/add_to_library_dialog.dart:261— lib/presentation/widgets/common/add_to_library_dialog.dart:261-430 | lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart:149-256 | lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:602-696 | lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:660-696 — 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) lib/presentation/widgets/image_editor/tools/blur_tool.dart:161— lib/presentation/widgets/image_editor/tools/blur_tool.dart:161-203 | lib/presentation/widgets/image_editor/tools/clone_stamp_tool.dart:311-355 | lib/presentation/widgets/image_editor/tools/fill_tool.dart:121-158 | lib/presentation/widgets/image_editor/tools/magic_wand_tool.dart:81-177 — 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.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×11
Edited copy of a member (10 corresponding lines) lib/data/services/discord_share_service.dart:538— lib/data/services/discord_share_service.dart:538-547 | lib/data/services/metadata/ai_tag_generation_parser.dart:467-476 — 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.
Edited copy of a member (10 corresponding lines) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:276— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:276-286 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:203-212 — 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.
Edited copy of a member (10 corresponding lines) lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:86— lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:86-95 | lib/presentation/widgets/prompt/fixed_tag_library_picker_dialog.dart:53-62 — 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.
Edited copy of a member (10 corresponding lines) lib/presentation/screens/director_tools/director_tools_screen.dart:138— lib/presentation/screens/director_tools/director_tools_screen.dart:138-151 | lib/presentation/screens/director_tools/director_tools_screen.dart:153-162 — 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.
Edited copy of a member (10 corresponding lines) lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:15— lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:15-24 | lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:92-101 — 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.
Edited copy of a member (10 corresponding lines) lib/data/models/mosaic/mosaic_settings.dart:328— lib/data/models/mosaic/mosaic_settings.dart:328-337 | lib/data/models/watermark/watermark_settings.dart:650-664 — 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.
Edited copy of a member (10 corresponding lines) lib/core/utils/vibe_encoding_utils.dart:241— lib/core/utils/vibe_encoding_utils.dart:241-253 | lib/core/utils/vibe_image_embedder.dart:875-884 — 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.
Edited copy of a member (10 corresponding lines) lib/presentation/screens/statistics/widgets/charts/polar_activity_chart.dart:32— lib/presentation/screens/statistics/widgets/charts/polar_activity_chart.dart:32-43 | lib/presentation/widgets/common/themed_radio.dart:50-59 — 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.
Edited copy of a member (10 corresponding lines) lib/presentation/widgets/prompt/components/library_entry_menu_item.dart:137— lib/presentation/widgets/prompt/components/library_entry_menu_item.dart:137-146 | lib/presentation/widgets/tag_library/tag_library_picker_dialog.dart:457-468 — 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.
Edited copy of a member (10 corresponding lines) lib/core/cloud_sync/backend/github_backend_support.dart:14— lib/core/cloud_sync/backend/github_backend_support.dart:14-23 | lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:760-769 — 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.
Edited copy of a member (10 corresponding lines) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:166— lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:166-176 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:295-304 — 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.
Change coupling: gallery_album_tree_view.dart ↔ gallery_category_tree_view.dart lib/presentation/widgets/gallery/gallery_album_tree_view.dart:1— `lib/presentation/widgets/gallery/gallery_album_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `3c7e67ee` fix(menu): 弹出菜单项统一改用 MenuActionLabel,长文案与大字号下换行; `0ad7903d` fix(rename): 分类树、相簿树与图层的就地重命名统一取消行为; `567c9d36` fix(drop): 拖放回调只发起读取后立即返回,大图拖入不再未响应 — run `git show` on any of them.
Change coupling: data_source_cache_provider.dart ↔ data_source_cache_settings.dart lib/core/database/providers/data_source_cache_provider.dart:1— `lib/core/database/providers/data_source_cache_provider.dart` and `lib/presentation/screens/settings/widgets/data_source_cache_settings.dart` change together 71% of the time (10 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `574b3ee8` feat(tags): 支持五个类别的独立热度阈值配置与分层拉取 (at that commit the file was still `lib/presentation/providers/data_source_cache_provider.dart`); `cf8945fb` feat(tags): 添加标签分类统计及展示功能 (at that commit the file was still `lib/presentation/providers/data_source_cache_provider.dart`); `22aef414` perf(database): 支持增量导入及预构建数据库gzip解压 (at that commit the file was still `lib/presentation/providers/data_source_cache_provider.dart`) — run `git show` on any of them.
Change coupling: global_drop_handler.dart ↔ image_destination_dialog.dart lib/presentation/widgets/drop/global_drop_handler.dart:1— `lib/presentation/widgets/drop/global_drop_handler.dart` and `lib/presentation/widgets/drop/image_destination_dialog.dart` change together 69% of the time (11 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `b1a26419` feat(metadata): 支持选取提示词加入词库 (#112); `b93e80fb` feat(generation): add reverse prompt drop destination; `ab617d2c` feat(core): 支持从 PNG 图片提取多个 Vibe 数据(Bundle) — run `git show` on any of them.
Change coupling: layer_painter.dart ↔ layer_manager.dart lib/presentation/widgets/image_editor/canvas/layer_painter.dart:1— `lib/presentation/widgets/image_editor/canvas/layer_painter.dart` and `lib/presentation/widgets/image_editor/layers/layer_manager.dart` change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `687817f2` fix(editor): 重绘编辑组橡皮擦只擦笔迹并改为实时擦除; `dea0877f` fix(editor): 修复重绘界面放大后卡顿,蒙版重叠处不再加深; `a6a9c0aa` fix(editor): smooth scaled bitmap layers — run `git show` on any of them.
Change coupling: data_source_cache_provider.dart ↔ warmup_provider.dart lib/core/database/providers/data_source_cache_provider.dart:1— `lib/core/database/providers/data_source_cache_provider.dart` and `lib/presentation/providers/warmup_provider.dart` change together 64% of the time (9 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `574b3ee8` feat(tags): 支持五个类别的独立热度阈值配置与分层拉取 (at that commit the file was still `lib/presentation/providers/data_source_cache_provider.dart`); `cf8945fb` feat(tags): 添加标签分类统计及展示功能 (at that commit the file was still `lib/presentation/providers/data_source_cache_provider.dart`); `ce1dea88` refactor(danbooru): 升级 Danbooru 标签懒加载服务到 V3 架构 (at that commit the file was still `lib/presentation/providers/data_source_cache_provider.dart`) — run `git show` on any of them.
Change coupling: storage_keys.dart ↔ generation_settings_notifiers.dart lib/core/constants/storage_keys.dart:1— `lib/core/constants/storage_keys.dart` and `lib/presentation/providers/generation/generation_settings_notifiers.dart` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `e5f34835` feat(prompt): 提示词设置添加粘贴时识别多角色开关; `7bc3dcf6` feat(generation): 添加流式预览开关 (#151); `d165d215` fix(prompt): 恢复鼠标滚轮调权功能 — run `git show` on any of them.
Change coupling: prompt_assistant_overlay.dart ↔ inline_character_editor.dart lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart:1— `lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart` and `lib/presentation/widgets/character/inline_character_editor.dart` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `61d98b66` fix(prompt): 隔离输入框标签模式并统一共享控件; `a5a06671` refactor(prompt): 统一提示词助手外壳与挂载组件; `5a0cad8b` feat(prompt): 支持助手标签翻译与多选成组调权 — run `git show` on any of them.
Change coupling: vibe_file_storage_service.dart ↔ vibe_library_screen.dart lib/data/services/vibe_file_storage_service.dart:1— `lib/data/services/vibe_file_storage_service.dart` and `lib/presentation/screens/vibe_library/vibe_library_screen.dart` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `e7b6ba8c` fix(vibe): preserve library data during updates; `a7f5b056` fix(vibe): 修正已编码 Vibe 的重复编码与计费显示; `2f92124d` fix(vibe): export website-compatible files — run `git show` on any of them.
Change coupling: weight_adjust_toolbar.dart ↔ unified_prompt_input.dart lib/presentation/widgets/common/weight_adjust_toolbar.dart:1— `lib/presentation/widgets/common/weight_adjust_toolbar.dart` and `lib/presentation/widgets/prompt/unified/unified_prompt_input.dart` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `6a1074f9` fix(prompt): 按住鼠标拖选时滚轮只滚动提示词,不再调整权重; `b41b9113` fix(prompt): 补齐文本模式批量禁用与启用入口; `d165d215` fix(prompt): 恢复鼠标滚轮调权功能 — run `git show` on any of them.
Change coupling: vibe_export_utils.dart ↔ vibe_library_screen.dart lib/core/utils/vibe_export_utils.dart:1— `lib/core/utils/vibe_export_utils.dart` and `lib/presentation/screens/vibe_library/vibe_library_screen.dart` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `2f92124d` fix(vibe): export website-compatible files; `145490ed` feat(vibe): add zip export and speed up export dialog; `4d3f84ce` feat(vibe): preserve bundle parameters and raw sources — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×10
Edited copy of a member (23 corresponding lines) lib/presentation/screens/auth/login_screen.dart:586— lib/presentation/screens/auth/login_screen.dart:586-615 | lib/presentation/screens/auth/login_screen.dart:617-639 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/core/agent/harness/env/dart_io_execution_env.dart:170— lib/core/agent/harness/env/dart_io_execution_env.dart:170-192 | lib/core/agent/harness/env/dart_io_execution_env.dart:194-216 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:761— lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:761-783 | lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:785-808 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/presentation/screens/auth/login_screen.dart:1105— lib/presentation/screens/auth/login_screen.dart:1105-1130 | lib/presentation/screens/auth/login_screen.dart:1183-1205 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/presentation/widgets/image_editor/widgets/panels/canvas_size_dialog.dart:294— lib/presentation/widgets/image_editor/widgets/panels/canvas_size_dialog.dart:294-316 | lib/presentation/widgets/image_editor/widgets/panels/canvas_size_dialog.dart:318-340 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:608— lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:608-630 | lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:246-270 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:341— lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:341-368 | lib/presentation/widgets/common/hover_preview_card.dart:176-198 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/core/storage/queue_state_storage.dart:66— lib/core/storage/queue_state_storage.dart:66-88 | lib/presentation/providers/generation/batch_generation_notifier.dart:118-145 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/presentation/screens/cloud_sync/cloud_sync_widgets.dart:138— lib/presentation/screens/cloud_sync/cloud_sync_widgets.dart:138-160 | lib/presentation/screens/settings/sections/mcp_server/mcp_server_connection_card.dart:418-443 — These two members are one piece of code written twice and then edited apart: 23 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 (23 corresponding lines) lib/core/utils/inpaint_outpaint_utils.dart:680— lib/core/utils/inpaint_outpaint_utils.dart:680-702 | lib/core/utils/inpaint_outpaint_utils.dart:841-863 — These two members are one piece of code written twice and then edited apart: 23 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 (21 corresponding lines) · ×10
Edited copy of a member (21 corresponding lines) lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:455— lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:455-475 | lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:286-306 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/core/utils/hard_edge_mask_exporter.dart:181— lib/core/utils/hard_edge_mask_exporter.dart:181-201 | lib/core/utils/inpaint_outpaint_utils.dart:1127-1147 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/presentation/widgets/image_editor/widgets/panels/layer_panel.dart:153— lib/presentation/widgets/image_editor/widgets/panels/layer_panel.dart:153-173 | lib/presentation/widgets/image_editor/widgets/panels/layer_panel.dart:175-197 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/presentation/widgets/auth/credentials_login_form.dart:275— lib/presentation/widgets/auth/credentials_login_form.dart:275-295 | lib/presentation/widgets/auth/token_login_card.dart:306-326 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/data/models/mosaic/mosaic_settings.dart:197— lib/data/models/mosaic/mosaic_settings.dart:197-219 | lib/data/services/dlss/dlss_options.dart:46-66 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/presentation/screens/settings/sections/storage_settings_section.dart:38— lib/presentation/screens/settings/sections/storage_settings_section.dart:38-58 | lib/presentation/screens/settings/sections/storage_settings_section.dart:424-447 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/data/services/gallery/gallery_stream_scanner.dart:70— lib/data/services/gallery/gallery_stream_scanner.dart:70-90 | lib/presentation/providers/gallery_scan_progress_provider.dart:44-64 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/core/comfyui/comfyui_models.dart:44— lib/core/comfyui/comfyui_models.dart:44-64 | lib/presentation/providers/comfyui/comfyui_provider.dart:827-850 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/presentation/widgets/queue/queue_management_page.dart:664— lib/presentation/widgets/queue/queue_management_page.dart:664-685 | lib/presentation/widgets/queue/queue_management_page.dart:687-707 — These two members are one piece of code written twice and then edited apart: 21 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 (21 corresponding lines) lib/presentation/screens/generation/widgets/prompt_tooltip_components.dart:27— lib/presentation/screens/generation/widgets/prompt_tooltip_components.dart:27-47 | lib/presentation/screens/generation/widgets/prompt_tooltip_components.dart:55-75 — These two members are one piece of code written twice and then edited apart: 21 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 (12 corresponding lines) · ×10
Edited copy of a member (12 corresponding lines) tool/cloud_sync/cloud_sync_production_benchmark.dart:350— tool/cloud_sync/cloud_sync_production_benchmark.dart:350-365 | tool/cloud_sync/cloud_sync_production_benchmark.dart:373-384 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/core/krita/krita_outbound_image.dart:67— lib/core/krita/krita_outbound_image.dart:67-78 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:651-662 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/data/models/online_gallery/gallery_prompt_projection.dart:167— lib/data/models/online_gallery/gallery_prompt_projection.dart:167-178 | lib/presentation/providers/local_gallery_provider.dart:1320-1334 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/core/cloud_sync/models.dart:192— lib/core/cloud_sync/models.dart:192-203 | lib/core/cloud_sync/models.dart:259-270 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/presentation/screens/generation/widgets/sidebar_link_painter.dart:102— lib/presentation/screens/generation/widgets/sidebar_link_painter.dart:102-113 | lib/presentation/widgets/prompt/fixed_tags_link_layer.dart:397-409 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/presentation/widgets/prompt/nai_syntax_controller.dart:454— lib/presentation/widgets/prompt/nai_syntax_controller.dart:454-465 | lib/presentation/widgets/prompt/nai_syntax_controller.dart:572-583 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/presentation/screens/mosaic/mosaic_editor_screen.dart:282— lib/presentation/screens/mosaic/mosaic_editor_screen.dart:282-296 | lib/presentation/screens/mosaic/mosaic_editor_screen.dart:298-309 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/data/services/metadata/image_metadata_parser_service.dart:113— lib/data/services/metadata/image_metadata_parser_service.dart:113-124 | lib/data/services/metadata/image_metadata_parser_service.dart:252-263 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/presentation/providers/online_gallery_provider.dart:135— lib/presentation/providers/online_gallery_provider.dart:135-149 | lib/presentation/providers/online_gallery_provider.dart:333-344 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) lib/presentation/widgets/image_editor/image_editor_screen.dart:201— lib/presentation/widgets/image_editor/image_editor_screen.dart:201-212 | lib/presentation/widgets/image_editor/image_editor_workspace.dart:131-142 — These two members are one piece of code written twice and then edited apart: 12 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.
Duplicated block (17 lines × 2) lib/core/autocomplete/completion_orchestrator.dart:154— lib/core/autocomplete/completion_orchestrator.dart:154-170 | lib/core/autocomplete/completion_orchestrator.dart:399-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/autocomplete/completion_orchestrator.dart:154` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/core/autocomplete/completion_orchestrator.dart:416` calls `_preserveCurrentTranslationState` and `lib/core/autocomplete/completion_orchestrator.dart:171` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) lib/data/datasources/remote/nai_image_generation_api_service.dart:88— lib/data/datasources/remote/nai_image_generation_api_service.dart:88-104 | lib/data/datasources/remote/nai_image_generation_api_service.dart:156-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/nai_image_generation_api_service.dart:88` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17 lines × 2) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:649— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:649-665 | lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:735-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:649` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17 lines × 2) lib/data/services/local_onnx_tagger_labels.dart:242— lib/data/services/local_onnx_tagger_labels.dart:242-258 | lib/data/services/local_onnx_tagger_labels.dart:273-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/local_onnx_tagger_labels.dart:242` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) lib/data/services/vibe_library_migration_service.dart:254— lib/data/services/vibe_library_migration_service.dart:254-270 | lib/data/services/vibe_library_migration_service.dart:330-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/data/services/vibe_library_migration_service.dart:272` calls `put`, `i` and `lib/data/services/vibe_library_migration_service.dart:348` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) lib/presentation/agent_chat/services/prompt_toolbox.dart:81— lib/presentation/agent_chat/services/prompt_toolbox.dart:81-97 | lib/presentation/agent_chat/services/prompt_toolbox.dart:105-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/services/prompt_toolbox.dart:81` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17 lines × 2) lib/presentation/screens/settings/sections/privacy_settings_section.dart:284— lib/presentation/screens/settings/sections/privacy_settings_section.dart:284-300 | lib/presentation/screens/settings/sections/privacy_settings_section.dart:398-414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/privacy_settings_section.dart:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:269— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:269-285 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:306-322 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 134 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:269` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17 lines × 2) lib/presentation/widgets/drop/image_destination_dialog.dart:157— lib/presentation/widgets/drop/image_destination_dialog.dart:157-173 | lib/presentation/widgets/drop/image_destination_dialog.dart:457-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/drop/image_destination_dialog.dart:157` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) lib/presentation/widgets/gallery/local_image_context_menu.dart:126— lib/presentation/widgets/gallery/local_image_context_menu.dart:126-142 | lib/presentation/widgets/gallery/local_image_context_menu.dart:244-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/gallery/local_image_context_menu.dart:126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×9
Edited copy of a member (9 corresponding lines) lib/data/services/official_random_prompt_generator.dart:365— lib/data/services/official_random_prompt_generator.dart:365-373 | lib/data/services/official_random_prompt_generator.dart:917-930 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/data/services/inpaint_draft_file_repository.dart:177— lib/data/services/inpaint_draft_file_repository.dart:177-187 | lib/data/services/inpaint_draft_file_repository.dart:194-202 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/data/models/gallery/nai_prompt_export_codec.dart:216— lib/data/models/gallery/nai_prompt_export_codec.dart:216-224 | lib/data/models/gallery/nai_prompt_export_codec.dart:226-234 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/core/utils/hive_storage_helper.dart:395— lib/core/utils/hive_storage_helper.dart:395-405 | lib/data/services/gallery/local_gallery_query.dart:230-238 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/data/cloud_sync/app_cloud_sync_data_source.dart:475— lib/data/cloud_sync/app_cloud_sync_data_source.dart:475-486 | lib/data/cloud_sync/app_cloud_sync_data_source.dart:564-572 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/core/mcp/mcp_tool_adapter.dart:68— lib/core/mcp/mcp_tool_adapter.dart:68-79 | lib/data/models/metadata/metadata_import_selection_codec.dart:150-158 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/presentation/widgets/image_editor/core/history_manager.dart:204— lib/presentation/widgets/image_editor/core/history_manager.dart:204-216 | lib/presentation/widgets/image_editor/core/layer_actions.dart:48-56 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/presentation/widgets/image_editor/core/history_manager.dart:372— lib/presentation/widgets/image_editor/core/history_manager.dart:372-381 | lib/presentation/widgets/image_editor/core/transform_actions.dart:77-85 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) lib/presentation/widgets/common/weight_adjust_toolbar.dart:83— lib/presentation/widgets/common/weight_adjust_toolbar.dart:83-91 | lib/presentation/widgets/prompt/prompt_formatter_wrapper.dart:59-69 — These two members are one piece of code written twice and then edited apart: 9 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 (20 corresponding lines) · ×8
Edited copy of a member (20 corresponding lines) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:312— lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:312-331 | lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:735-756 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:195— lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:195-214 | lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:368-387 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/presentation/widgets/common/app_toast.dart:378— lib/presentation/widgets/common/app_toast.dart:378-397 | lib/presentation/widgets/common/app_toast.dart:559-585 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/core/cloud_sync/backend/webdav_capability_probe.dart:310— lib/core/cloud_sync/backend/webdav_capability_probe.dart:310-329 | lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:523-544 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/core/agent/harness/session/session_memory.dart:147— lib/core/agent/harness/session/session_memory.dart:147-166 | lib/core/agent/harness/session/session_memory.dart:185-209 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/core/services/pixel_snap/internal/pixel_snap_executor.dart:111— lib/core/services/pixel_snap/internal/pixel_snap_executor.dart:111-130 | lib/core/services/pixel_snap/internal/pixel_snap_executor.dart:132-151 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/presentation/agent_chat/services/agent_tool_permission_controller.dart:244— lib/presentation/agent_chat/services/agent_tool_permission_controller.dart:244-263 | lib/presentation/mcp/services/mcp_tool_call_pipeline.dart:185-204 — These two members are one piece of code written twice and then edited apart: 20 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 (20 corresponding lines) lib/presentation/mcp/widgets/mcp_approval_banner.dart:20— lib/presentation/mcp/widgets/mcp_approval_banner.dart:20-39 | lib/presentation/widgets/common/update_notice_banner.dart:13-32 — These two members are one piece of code written twice and then edited apart: 20 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 (5 corresponding lines) · ×8
Edited copy of a member (5 corresponding lines) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:574— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:574-578 | lib/data/services/online_gallery/quick_tag_cloud_parser.dart:582-586 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) lib/data/models/gallery/nai_prompt_export_codec.dart:189— lib/data/models/gallery/nai_prompt_export_codec.dart:189-193 | lib/presentation/services/gallery_prompt_projection_service.dart:227-231 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) lib/presentation/widgets/character/character_tooltip_content.dart:189— lib/presentation/widgets/character/character_tooltip_content.dart:189-193 | lib/presentation/widgets/character/inline_character_section.dart:104-108 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) lib/presentation/screens/settings/sections/mcp_server/mcp_client_config_snippets.dart:49— lib/presentation/screens/settings/sections/mcp_server/mcp_client_config_snippets.dart:49-55 | lib/presentation/screens/settings/sections/mcp_server/mcp_server_connection_card.dart:74-78 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) lib/core/utils/vibe_image_embedder.dart:869— lib/core/utils/vibe_image_embedder.dart:869-873 | lib/data/services/metadata/ai_tag_generation_parser.dart:401-405 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) tool/cloud_sync/cloud_sync_benchmark.dart:564— tool/cloud_sync/cloud_sync_benchmark.dart:564-568 | tool/cloud_sync/cloud_sync_production_benchmark.dart:367-371 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:81— lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:81-85 | lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.dart:100-104 — These two members are one piece of code written twice and then edited apart: 5 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 (5 corresponding lines) lib/core/autocomplete/cooccurrence_sqlite_repository.dart:242— lib/core/autocomplete/cooccurrence_sqlite_repository.dart:242-246 | lib/core/database/datasources/cooccurrence_data_source.dart:197-203 — These two members are one piece of code written twice and then edited apart: 5 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 (26 corresponding lines) · ×7
Edited copy of a member (26 corresponding lines) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:202— lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:202-227 | lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:276-310 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:734— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:734-763 | lib/presentation/screens/precise_ref_library/widgets/precise_ref_selector_dialog.dart:344-369 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) lib/core/database/datasources/gallery_records.dart:264— lib/core/database/datasources/gallery_records.dart:264-294 | lib/data/services/gallery/local_gallery_repository.dart:244-269 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:188— lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:188-217 | lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:225-250 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) lib/core/utils/vibe_performance_diagnostics.dart:28— lib/core/utils/vibe_performance_diagnostics.dart:28-53 | lib/core/utils/vibe_performance_diagnostics.dart:55-80 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) lib/data/models/mosaic/mosaic_settings.dart:57— lib/data/models/mosaic/mosaic_settings.dart:57-85 | lib/data/models/watermark/watermark_settings.dart:297-322 — These two members are one piece of code written twice and then edited apart: 26 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 (26 corresponding lines) lib/data/cloud_sync/fixed_tag_usage_cloud_sync_adapter.dart:125— lib/data/cloud_sync/fixed_tag_usage_cloud_sync_adapter.dart:125-152 | lib/data/cloud_sync/fixed_tag_usage_cloud_sync_adapter.dart:154-179 — These two members are one piece of code written twice and then edited apart: 26 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 (19 corresponding lines) · ×7
Edited copy of a member (19 corresponding lines) lib/data/services/efficient_vit_sam_service.dart:317— lib/data/services/efficient_vit_sam_service.dart:317-335 | lib/data/services/local_onnx_tagger_service.dart:347-370 — These two members are one piece of code written twice and then edited apart: 19 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 (19 corresponding lines) lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:347— lib/core/agent/harness/session/jsonl/session_jsonl_storage.dart:347-367 | lib/core/agent/harness/session/session_memory.dart:60-78 — These two members are one piece of code written twice and then edited apart: 19 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 (19 corresponding lines) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:250— lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:250-268 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:198-216 — These two members are one piece of code written twice and then edited apart: 19 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 (19 corresponding lines) lib/presentation/screens/generation/widgets/image_preview.dart:872— lib/presentation/screens/generation/widgets/image_preview.dart:872-890 | lib/presentation/screens/generation/widgets/image_preview.dart:938-961 — These two members are one piece of code written twice and then edited apart: 19 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 (19 corresponding lines) lib/presentation/widgets/drop/dropped_image_inspector.dart:118— lib/presentation/widgets/drop/dropped_image_inspector.dart:118-136 | lib/presentation/widgets/drop/dropped_image_inspector.dart:138-157 — These two members are one piece of code written twice and then edited apart: 19 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 (19 corresponding lines) lib/data/services/vibe_library_hive_repository.dart:51— lib/data/services/vibe_library_hive_repository.dart:51-69 | lib/data/services/vibe_library_hive_repository.dart:91-109 — These two members are one piece of code written twice and then edited apart: 19 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 (19 corresponding lines) lib/presentation/widgets/online_gallery/gallery_detail_tag_section.dart:110— lib/presentation/widgets/online_gallery/gallery_detail_tag_section.dart:110-128 | lib/presentation/widgets/online_gallery/gallery_detail_tag_section.dart:142-160 — These two members are one piece of code written twice and then edited apart: 19 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 (27 corresponding lines) · ×7
Edited copy of a member (27 corresponding lines) lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:139— lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:139-166 | lib/presentation/widgets/image_editor/widgets/toolbar/mobile_toolbar.dart:123-149 — These two members are one piece of code written twice and then edited apart: 27 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 (27 corresponding lines) lib/presentation/screens/tag_library_page/widgets/entry_card.dart:524— lib/presentation/screens/tag_library_page/widgets/entry_card.dart:524-550 | lib/presentation/widgets/common/image_card_surface.dart:494-523 — These two members are one piece of code written twice and then edited apart: 27 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 (27 corresponding lines) lib/core/autocomplete/cooccurrence_data_pack_protocol.dart:57— lib/core/autocomplete/cooccurrence_data_pack_protocol.dart:57-83 | lib/presentation/providers/queue_execution_provider.dart:77-108 — These two members are one piece of code written twice and then edited apart: 27 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 (27 corresponding lines) lib/presentation/providers/generation/generation_settings_notifiers.dart:148— lib/presentation/providers/generation/generation_settings_notifiers.dart:148-174 | lib/presentation/providers/generation/generation_settings_notifiers.dart:242-268 — These two members are one piece of code written twice and then edited apart: 27 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 (27 corresponding lines) lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:290— lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:290-316 | lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:361-387 — These two members are one piece of code written twice and then edited apart: 27 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 (27 corresponding lines) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:783— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:783-809 | lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:811-838 — These two members are one piece of code written twice and then edited apart: 27 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 (27 corresponding lines) android/app/src/main/kotlin/com/aaalice/nai_launcher/AndroidFileExportChannel.kt:59— android/app/src/main/kotlin/com/aaalice/nai_launcher/AndroidFileExportChannel.kt:59-85 | android/app/src/main/kotlin/com/aaalice/nai_launcher/AndroidFileExportChannel.kt:160-188 — These two members are one piece of code written twice and then edited apart: 27 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 (6 corresponding lines) · ×7
Edited copy of a member (6 corresponding lines) lib/data/cloud_sync/tag_library_thumbnail_compressor.dart:87— lib/data/cloud_sync/tag_library_thumbnail_compressor.dart:87-97 | lib/presentation/utils/reverse_prompt_image_normalizer.dart:131-136 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) lib/core/cloud_sync/backend/webdav_collection_ensurer.dart:138— lib/core/cloud_sync/backend/webdav_collection_ensurer.dart:138-147 | lib/core/cloud_sync/backend/webdav_operation_inventory.dart:233-238 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) lib/presentation/screens/generation/mobile_generation_controller.dart:182— lib/presentation/screens/generation/mobile_generation_controller.dart:182-187 | lib/presentation/screens/generation/mobile_generation_gestures.dart:41-50 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) lib/presentation/widgets/image_editor/layers/layer_patch_baker.dart:199— lib/presentation/widgets/image_editor/layers/layer_patch_baker.dart:199-207 | lib/presentation/widgets/image_editor/tools/blur_tool.dart:125-130 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) lib/data/datasources/remote/online_gallery/gallery_source_adapter.dart:218— lib/data/datasources/remote/online_gallery/gallery_source_adapter.dart:218-223 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:56-62 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) lib/presentation/screens/tag_library_page/tag_library_page_screen.dart:824— lib/presentation/screens/tag_library_page/tag_library_page_screen.dart:824-829 | lib/presentation/widgets/tag_library/tag_library_picker_dialog.dart:252-258 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) lib/presentation/agent_chat/providers/agent_chat_dock_state.dart:39— lib/presentation/agent_chat/providers/agent_chat_dock_state.dart:39-44 | lib/presentation/agent_chat/services/generation_image_workflow_service.dart:17-23 — These two members are one piece of code written twice and then edited apart: 6 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.
Duplicated block (20 lines × 2) lib/core/mosaic/mosaic_render_service.dart:286— lib/core/mosaic/mosaic_render_service.dart:286-305 | lib/core/watermark/watermark_render_service.dart:217-236 — 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 (20 lines × 2) lib/presentation/providers/generation/generation_settings_notifiers.dart:155— lib/presentation/providers/generation/generation_settings_notifiers.dart:155-174 | lib/presentation/providers/generation/generation_settings_notifiers.dart:249-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/generation/generation_settings_notifiers.dart:155` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20 lines × 2) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:342— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:342-361 | lib/presentation/screens/generation/widgets/vibe_transfer_content.dart:415-434 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/precise_reference_panel.dart:342` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:848— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:848-867 | lib/presentation/screens/generation/widgets/vibe_card.dart:638-657 — before extracting anything, compare `lib/presentation/screens/generation/widgets/precise_reference_panel.dart` and `lib/presentation/screens/generation/widgets/vibe_card.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/precise_reference_panel.dart:848` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 2) lib/presentation/screens/generation/widgets/prompt_input_tooltips.dart:148— lib/presentation/screens/generation/widgets/prompt_input_tooltips.dart:148-167 | lib/presentation/screens/generation/widgets/prompt_input_tooltips.dart:310-329 — both copies are in the same file, so extract the block into 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) lib/presentation/screens/settings/sections/appearance_settings_section.dart:293— lib/presentation/screens/settings/sections/appearance_settings_section.dart:293-312 | lib/presentation/screens/settings/sections/appearance_settings_section.dart:366-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/appearance_settings_section.dart:293` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:218— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:218-237 | lib/presentation/screens/vibe_library/widgets/vibe_import_naming_dialog.dart:203-222 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:218` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) lib/data/services/official_random_prompt_generator.dart:242— lib/data/services/official_random_prompt_generator.dart:242-247 | lib/data/services/official_random_prompt_generator.dart:493-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/official_random_prompt_generator.dart:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:573— lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:573-578 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:33-38 — before extracting anything, compare `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart` and `lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:573` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:86— lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:86-91 | lib/presentation/widgets/prompt/fixed_tag_library_picker_dialog.dart:53-58 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/entry_selector_dialog.dart:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) lib/presentation/widgets/navigation/nav_rail_items.dart:124— lib/presentation/widgets/navigation/nav_rail_items.dart:124-129 | lib/presentation/widgets/navigation/nav_rail_items.dart:174-179 — both copies are in the same file, so extract the block into 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) lib/data/services/efficient_vit_sam_service.dart:367— lib/data/services/efficient_vit_sam_service.dart:367-372 | lib/data/services/local_onnx_tagger_service.dart:402-407 — before extracting anything, compare `lib/data/services/efficient_vit_sam_service.dart` and `lib/data/services/local_onnx_tagger_service.dart` as WHOLE FILES: this scan already matched 5 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 (6 lines × 2) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:457— lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:457-462 | lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:126-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) lib/core/utils/efficient_vit_sam_image_processor.dart:263— lib/core/utils/efficient_vit_sam_image_processor.dart:263-268 | lib/core/utils/efficient_vit_sam_image_processor.dart:273-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/efficient_vit_sam_image_processor.dart:263` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) lib/core/autocomplete/tag_catalog_repository.dart:217— lib/core/autocomplete/tag_catalog_repository.dart:217-221 | lib/core/autocomplete/tag_catalog_repository.dart:254-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/autocomplete/tag_catalog_repository.dart:217` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) lib/data/services/discord_share_service.dart:539— lib/data/services/discord_share_service.dart:539-543 | lib/data/services/metadata/ai_tag_generation_parser.dart:468-472 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/discord_share_service.dart:539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) lib/presentation/themes/presets/apple_light_theme.dart:25— lib/presentation/themes/presets/apple_light_theme.dart:25-29 | lib/presentation/themes/presets/brutalist_theme.dart:25-29 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) lib/data/cloud_sync/app_cloud_sync_data_source.dart:811— lib/data/cloud_sync/app_cloud_sync_data_source.dart:811-815 | lib/data/cloud_sync/cloud_sync_operation_storage.dart:587-591 — 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) lib/data/services/online_gallery/online_gallery_random_service.dart:20— lib/data/services/online_gallery/online_gallery_random_service.dart:20-24 | lib/presentation/providers/online_gallery_pagination_service.dart:480-484 — 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) lib/core/autocomplete/zh_dictionary_service.dart:400— lib/core/autocomplete/zh_dictionary_service.dart:400-404 | lib/core/database/asset_database_manager.dart:216-220 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/autocomplete/zh_dictionary_service.dart:400` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) lib/data/services/discord_share_service.dart:462— lib/data/services/discord_share_service.dart:462-466 | lib/data/services/discord_share_service.dart:467-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.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×6
Edited copy of a member (35 corresponding lines) lib/presentation/agent_chat/services/precise_reference_toolbox.dart:32— lib/presentation/agent_chat/services/precise_reference_toolbox.dart:32-71 | lib/presentation/agent_chat/services/vibe_library_toolbox.dart:31-65 — These two members are one piece of code written twice and then edited apart: 35 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 (35 corresponding lines) lib/presentation/widgets/character/character_prompt_button.dart:334— lib/presentation/widgets/character/character_prompt_button.dart:334-369 | lib/presentation/widgets/character/character_prompt_button.dart:383-417 — These two members are one piece of code written twice and then edited apart: 35 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 (35 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:239— lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:239-279 | lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:301-335 — These two members are one piece of code written twice and then edited apart: 35 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 (35 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:126— lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:126-162 | lib/presentation/screens/watermark/watermark_editor_controls.dart:529-563 — These two members are one piece of code written twice and then edited apart: 35 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 (35 corresponding lines) lib/core/database/datasources/gallery_favorite_tag_repository.dart:188— lib/core/database/datasources/gallery_favorite_tag_repository.dart:188-224 | lib/core/database/datasources/gallery_favorite_tag_repository.dart:226-260 — These two members are one piece of code written twice and then edited apart: 35 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 (35 corresponding lines) lib/presentation/widgets/common/save_vibe_dialog.dart:377— lib/presentation/widgets/common/save_vibe_dialog.dart:377-411 | lib/presentation/widgets/prompt/diy/dialogs/preset_import_dialog.dart:365-401 — These two members are one piece of code written twice and then edited apart: 35 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 (30 corresponding lines) · ×6
Edited copy of a member (30 corresponding lines) lib/data/services/vibe_library_migration_service.dart:244— lib/data/services/vibe_library_migration_service.dart:244-275 | lib/data/services/vibe_library_migration_service.dart:320-349 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) lib/presentation/providers/tag_library_page_provider.dart:626— lib/presentation/providers/tag_library_page_provider.dart:626-655 | lib/presentation/providers/vibe_library_category_provider.dart:338-367 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) lib/core/agent/harness/env/dart_io_execution_env.dart:232— lib/core/agent/harness/env/dart_io_execution_env.dart:232-261 | lib/core/agent/harness/env/dart_io_execution_env.dart:263-297 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:446— lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:446-475 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:450-479 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) lib/presentation/widgets/prompt/fixed_tags_button.dart:400— lib/presentation/widgets/prompt/fixed_tags_button.dart:400-432 | lib/presentation/widgets/prompt/fixed_tags_button.dart:519-548 — These two members are one piece of code written twice and then edited apart: 30 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 (30 corresponding lines) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:59— lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:59-88 | lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:90-120 — These two members are one piece of code written twice and then edited apart: 30 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 (28 corresponding lines) · ×6
Edited copy of a member (28 corresponding lines) lib/core/utils/inpaint_outpaint_utils.dart:1014— lib/core/utils/inpaint_outpaint_utils.dart:1014-1041 | lib/core/utils/inpaint_outpaint_utils.dart:1092-1125 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:226— lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:226-253 | lib/presentation/agent_chat/services/queue_toolbox.dart:131-164 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:83— lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:83-110 | lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:112-144 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:239— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:239-270 | lib/presentation/screens/vibe_library/widgets/vibe_image_encode_dialog.dart:240-267 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) lib/presentation/widgets/common/image_detail/file_image_detail_data.dart:51— lib/presentation/widgets/common/image_detail/file_image_detail_data.dart:51-78 | lib/presentation/widgets/common/image_detail/image_detail_data.dart:99-135 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) lib/presentation/agent_chat/services/generation_image_workflow_toolbox.dart:10— lib/presentation/agent_chat/services/generation_image_workflow_toolbox.dart:10-41 | lib/presentation/agent_chat/services/generation_resource_toolbox.dart:105-132 — These two members are one piece of code written twice and then edited apart: 28 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) · ×6
Edited copy of a member (22 corresponding lines) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:76— lib/presentation/widgets/gallery/gallery_album_tree_view.dart:76-97 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:87-108 — 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.
Edited copy of a member (22 corresponding lines) lib/presentation/widgets/character/inline_character_card.dart:146— lib/presentation/widgets/character/inline_character_card.dart:146-173 | lib/presentation/widgets/character/inline_character_row.dart:339-360 — 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.
Edited copy of a member (22 corresponding lines) lib/core/cloud_sync/data_source.dart:42— lib/core/cloud_sync/data_source.dart:42-63 | lib/core/cloud_sync/snapshot_uploader.dart:313-335 — 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.
Edited copy of a member (22 corresponding lines) lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:161— lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:161-184 | lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:186-207 — 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.
Edited copy of a member (22 corresponding lines) lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:112— lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:112-133 | lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:133-155 — 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.
Edited copy of a member (22 corresponding lines) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:273— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:273-296 | lib/presentation/screens/vibe_library/widgets/vibe_detail/vibe_preview_drop_zone.dart:107-128 — 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· Edited copies of one member (3 members, 11+ corresponding lines) · ×6
Edited copies of one member (3 members, 11+ corresponding lines) lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:116— lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:116-126 | lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:197-212 | lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:330-340 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) lib/presentation/providers/vibe_library_provider.dart:337— lib/presentation/providers/vibe_library_provider.dart:337-354 | lib/presentation/providers/vibe_library_provider.dart:528-546 | lib/presentation/providers/vibe_library_provider.dart:548-558 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:214— lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:214-224 | lib/presentation/agent_chat/services/tag_library_toolbox.dart:387-397 | lib/presentation/agent_chat/services/tag_library_toolbox.dart:491-509 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) lib/presentation/agent_chat/services/queue_toolbox.dart:289— lib/presentation/agent_chat/services/queue_toolbox.dart:289-299 | lib/presentation/agent_chat/services/queue_toolbox.dart:344-355 | lib/presentation/agent_chat/services/queue_toolbox.dart:357-369 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:590— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:590-604 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:316-326 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:233-247 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) lib/presentation/widgets/common/hover_image_preview.dart:233— lib/presentation/widgets/common/hover_image_preview.dart:233-243 | lib/presentation/widgets/common/hover_preview_card.dart:108-118 | lib/presentation/widgets/tag_library/tag_library_entry_hover_preview.dart:123-140 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×6
Edited copy of a member (4 corresponding lines) lib/presentation/widgets/gallery/local_image_hover_preview.dart:393— lib/presentation/widgets/gallery/local_image_hover_preview.dart:393-396 | lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:379-382 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) lib/core/network/web_access/exa_search_client.dart:269— lib/core/network/web_access/exa_search_client.dart:269-272 | lib/core/network/web_access/searxng_search_client.dart:153-156 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) lib/core/agent/agent_tool_presentation.dart:62— lib/core/agent/agent_tool_presentation.dart:62-65 | lib/presentation/agent_chat/widgets/agent_chat_history.dart:540-543 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) lib/core/network/web_access/exa_search_client.dart:432— lib/core/network/web_access/exa_search_client.dart:432-435 | lib/core/network/web_access/searxng_search_client.dart:158-161 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) lib/data/services/vibe_file_storage_service.dart:121— lib/data/services/vibe_file_storage_service.dart:121-124 | lib/data/services/vibe_library_storage_service.dart:115-118 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:78— lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:78-81 | lib/presentation/prompt_assistant/providers/prompt_assistant_state_provider.dart:55-58 — These two members are one piece of code written twice and then edited apart: 4 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.
Duplicated block (19 lines × 2) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:829— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:829-847 | lib/presentation/screens/generation/widgets/vibe_card.dart:617-635 — before extracting anything, compare `lib/presentation/screens/generation/widgets/precise_reference_panel.dart` and `lib/presentation/screens/generation/widgets/vibe_card.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/precise_reference_panel.dart:829` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:161— lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:161-179 | lib/presentation/widgets/metadata/metadata_import_dialog.dart:201-219 — before extracting anything, compare `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart` and `lib/presentation/widgets/metadata/metadata_import_dialog.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:161` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) lib/presentation/screens/settings/sections/storage_settings_section.dart:505— lib/presentation/screens/settings/sections/storage_settings_section.dart:505-523 | lib/presentation/screens/settings/sections/storage_settings_section.dart:632-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/storage_settings_section.dart:505` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 2) lib/presentation/screens/statistics/widgets/charts/parameter_distribution_bar.dart:85— lib/presentation/screens/statistics/widgets/charts/parameter_distribution_bar.dart:85-103 | lib/presentation/screens/statistics/widgets/charts/weekday_bar_chart.dart:107-125 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/statistics/widgets/charts/parameter_distribution_bar.dart:85` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 2) lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart:277— lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart:277-295 | lib/presentation/widgets/image_editor/effects/image_editor_effects_controller.dart:204-222 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart:277` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) lib/presentation/widgets/image_editor/widgets/color_picker.dart:231— lib/presentation/widgets/image_editor/widgets/color_picker.dart:231-249 | lib/presentation/widgets/image_editor/widgets/panels/color_panel.dart:439-457 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/widgets/color_picker.dart:231` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Sync-over-async blocking lib/core/agent/harness/session/jsonl/session_jsonl_repository.dart:31— `_listAll` is async and calls listSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs.
Sync-over-async blocking lib/core/agent/harness/session/jsonl/session_jsonl_repository.dart:116— `delete` is async and calls deleteSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs.
Sync-over-async blocking lib/core/comfyui/workflow_template_manager.dart:214— `_loadCustomTemplates` is async and calls listSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs.
Sync-over-async blocking lib/core/services/avatar_service.dart:206— `cleanupOrphanedAvatars` is async and calls listSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs.
Sync-over-async blocking lib/core/utils/vibe_file_parser.dart:599— `fromNaiV4VibeFile` is async and calls readAsBytesSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs.
Sync-over-async blocking lib/core/utils/vibe_file_parser.dart:822— `fromBundleFile` is async and calls readAsBytesSync — a blocking call inside async code stalls the isolate's event loop — every other event, on Flutter the next frame, waits for as long as it runs.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×5
Edited copy of a member (25 corresponding lines) lib/core/services/file_export_service.dart:296— lib/core/services/file_export_service.dart:296-320 | lib/core/services/file_export_service.dart:322-349 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) lib/presentation/widgets/auth/network_troubleshooting_dialog.dart:12— lib/presentation/widgets/auth/network_troubleshooting_dialog.dart:12-36 | lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:23-52 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) lib/presentation/agent_chat/services/generation_preparation_service.dart:98— lib/presentation/agent_chat/services/generation_preparation_service.dart:98-122 | lib/presentation/agent_chat/services/generation_preparation_service.dart:737-761 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:151— lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:151-175 | lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:465-491 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) lib/core/utils/inpaint_outpaint_utils.dart:467— lib/core/utils/inpaint_outpaint_utils.dart:467-491 | lib/core/utils/inpaint_outpaint_utils.dart:865-889 — These two members are one piece of code written twice and then edited apart: 25 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 (37 corresponding lines) · ×5
Edited copy of a member (37 corresponding lines) lib/core/database/datasources/gallery_records.dart:108— lib/core/database/datasources/gallery_records.dart:108-144 | lib/domain/entities/gallery_image_entity.dart:127-164 — These two members are one piece of code written twice and then edited apart: 37 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 (37 corresponding lines) lib/presentation/providers/online_gallery_command_service.dart:132— lib/presentation/providers/online_gallery_command_service.dart:132-171 | lib/presentation/providers/online_gallery_command_service.dart:173-209 — These two members are one piece of code written twice and then edited apart: 37 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 (37 corresponding lines) lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:246— lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:246-282 | lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:434-475 — These two members are one piece of code written twice and then edited apart: 37 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 (37 corresponding lines) lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:200— lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:200-236 | lib/core/cloud_sync/oauth/mobile_oauth_clients.dart:379-418 — These two members are one piece of code written twice and then edited apart: 37 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 (37 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:201— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:201-237 | lib/presentation/screens/vibe_library/widgets/vibe_image_encode_dialog.dart:196-238 — These two members are one piece of code written twice and then edited apart: 37 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 (24 corresponding lines) · ×5
Edited copy of a member (24 corresponding lines) lib/presentation/providers/vibe_library_provider.dart:592— lib/presentation/providers/vibe_library_provider.dart:592-615 | lib/presentation/providers/vibe_library_provider.dart:617-644 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) lib/core/utils/file_explorer_utils.dart:69— lib/core/utils/file_explorer_utils.dart:69-92 | lib/core/utils/file_explorer_utils.dart:94-123 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:383— lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:383-412 | lib/presentation/widgets/prompt/diy/panels/visibility_rule_panel.dart:297-320 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) lib/presentation/widgets/auth/account_avatar.dart:48— lib/presentation/widgets/auth/account_avatar.dart:48-77 | lib/presentation/widgets/auth/account_avatar.dart:158-181 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) lib/presentation/widgets/image_editor/frame/frame_tool_panel.dart:72— lib/presentation/widgets/image_editor/frame/frame_tool_panel.dart:72-95 | lib/presentation/widgets/image_editor/tools/closed_region_fill_tool.dart:56-80 — These two members are one piece of code written twice and then edited apart: 24 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 (34 corresponding lines) · ×5
Edited copy of a member (34 corresponding lines) lib/presentation/mcp/providers/mcp_server_notifier.dart:143— lib/presentation/mcp/providers/mcp_server_notifier.dart:143-176 | lib/presentation/providers/director_tools_notifier.dart:96-131 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) lib/data/models/mosaic/mosaic_settings.dart:106— lib/data/models/mosaic/mosaic_settings.dart:106-139 | lib/data/models/watermark/watermark_settings.dart:343-377 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) lib/presentation/screens/generation/mobile_generation_gestures.dart:292— lib/presentation/screens/generation/mobile_generation_gestures.dart:292-325 | lib/presentation/widgets/common/library_card_badges.dart:18-52 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) lib/presentation/widgets/grouped_grid_view.dart:173— lib/presentation/widgets/grouped_grid_view.dart:173-206 | lib/presentation/widgets/shortcuts/shortcut_tooltip.dart:108-144 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) lib/core/database/datasources/gallery_image_repository.dart:268— lib/core/database/datasources/gallery_image_repository.dart:268-301 | lib/core/database/datasources/gallery_metadata_repository.dart:247-289 — These two members are one piece of code written twice and then edited apart: 34 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.
Duplicated block (15 lines × 3) lib/presentation/screens/auth/login_screen.dart:1083— lib/presentation/screens/auth/login_screen.dart:1083-1097 | lib/presentation/screens/auth/login_screen.dart:1161-1175 | lib/presentation/widgets/gallery/gallery_scan_progress_panel.dart:505-519 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 3) lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:499— lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:499-513 | lib/presentation/screens/generation/widgets/precise_reference_panel.dart:851-865 | lib/presentation/screens/generation/widgets/vibe_card.dart:641-655 — before extracting anything, compare `lib/presentation/screens/generation/widgets/precise_reference_panel.dart` and `lib/presentation/screens/generation/widgets/vibe_card.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:499` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15 lines × 3) lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:159— lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:159-173 | lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:436-450 | lib/presentation/widgets/metadata/metadata_import_dialog.dart:199-213 — before extracting anything, compare `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart` and `lib/presentation/widgets/metadata/metadata_import_dialog.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) lib/presentation/screens/vibe_library/vibe_library_workspace.dart:503— lib/presentation/screens/vibe_library/vibe_library_workspace.dart:503-517 | lib/presentation/widgets/drop/global_drop_overlay.dart:18-32 | lib/presentation/widgets/drop/global_drop_overlay.dart:82-96 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/vibe_library_workspace.dart:503` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) lib/presentation/widgets/navigation/nav_rail_account_button.dart:39— lib/presentation/widgets/navigation/nav_rail_account_button.dart:39-53 | lib/presentation/widgets/navigation/nav_rail_items.dart:213-227 | lib/presentation/widgets/navigation/nav_rail_items.dart:318-332 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/navigation/nav_rail_account_button.dart:39` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) lib/presentation/screens/settings/sections/storage_settings_section.dart:489— lib/presentation/screens/settings/sections/storage_settings_section.dart:489-503 | lib/presentation/screens/settings/sections/storage_settings_section.dart:617-630 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/storage_settings_section.dart:489` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14–15 lines × 2) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:372— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:372-386 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:431-444 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 134 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:372` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) lib/presentation/widgets/auth/third_party_api_login_card.dart:185— lib/presentation/widgets/auth/third_party_api_login_card.dart:185-198 | lib/presentation/widgets/auth/token_login_card.dart:152-166 — before extracting anything, compare `lib/presentation/widgets/auth/third_party_api_login_card.dart` and `lib/presentation/widgets/auth/token_login_card.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/auth/third_party_api_login_card.dart:185` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) lib/presentation/widgets/prompt/fixed_tags_button.dart:503— lib/presentation/widgets/prompt/fixed_tags_button.dart:503-517 | lib/presentation/widgets/queue/task_edit_dialog.dart:330-343 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/fixed_tags_button.dart:503` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–15 lines × 2) krita_plugin/install_plugin.py:541— krita_plugin/install_plugin.py:541-554 | krita_plugin/install_plugin.py:558-572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `krita_plugin/install_plugin.py:541` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×4
Edited copy of a member (29 corresponding lines) lib/presentation/screens/prompt_config/widgets/prompt_config_unavailable_states.dart:75— lib/presentation/screens/prompt_config/widgets/prompt_config_unavailable_states.dart:75-103 | lib/presentation/widgets/prompt/random_manager/preview_generator_panel.dart:571-605 — These two members are one piece of code written twice and then edited apart: 29 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 (29 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:286— lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:286-314 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:307-338 — These two members are one piece of code written twice and then edited apart: 29 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 (29 corresponding lines) lib/presentation/screens/precise_ref_library/widgets/precise_ref_card.dart:135— lib/presentation/screens/precise_ref_library/widgets/precise_ref_card.dart:135-164 | lib/presentation/screens/vibe_library/widgets/vibe_card.dart:234-262 — These two members are one piece of code written twice and then edited apart: 29 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 (29 corresponding lines) lib/presentation/widgets/prompt/diy/diy_rule_list_card.dart:165— lib/presentation/widgets/prompt/diy/diy_rule_list_card.dart:165-193 | lib/presentation/widgets/prompt/diy/panels/time_condition_panel.dart:633-666 — These two members are one piece of code written twice and then edited apart: 29 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) · ×4
Edited copy of a member (31 corresponding lines) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:1194— lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:1194-1224 | lib/presentation/screens/vibe_library/vibe_library_workspace.dart:457-489 — 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.
Edited copy of a member (31 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:497— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:497-527 | lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:529-563 — 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.
Edited copy of a member (31 corresponding lines) lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:491— lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:491-527 | lib/presentation/screens/statistics/widgets/dashboard/other_stats_card.dart:63-93 — 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.
Edited copy of a member (31 corresponding lines) lib/presentation/widgets/prompt/diy/diy_empty_state.dart:18— lib/presentation/widgets/prompt/diy/diy_empty_state.dart:18-57 | lib/presentation/widgets/prompt/random_manager/tag_group_diy_tab.dart:96-126 — 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 copies of one member (3 members, 15+ corresponding lines) · ×4
Edited copies of one member (3 members, 15+ corresponding lines) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1337— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1337-1352 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1354-1368 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1606-1626 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) lib/data/datasources/remote/danbooru_api_service.dart:80— lib/data/datasources/remote/danbooru_api_service.dart:80-97 | lib/data/datasources/remote/danbooru_api_service.dart:113-131 | lib/data/datasources/remote/danbooru_api_service.dart:495-509 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) lib/presentation/themes/modules/color/palettes/editorial_palette.dart:36— lib/presentation/themes/modules/color/palettes/editorial_palette.dart:36-50 | lib/presentation/themes/modules/color/palettes/fluid_palette.dart:38-52 | lib/presentation/themes/modules/color/palettes/zen_palette.dart:45-60 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:220— lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:220-235 | lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:237-252 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:265-279 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (29 lines × 2) lib/data/cloud_sync/cloud_sync_operation_storage.dart:126— lib/data/cloud_sync/cloud_sync_operation_storage.dart:126-154 | lib/data/cloud_sync/cloud_sync_operation_storage.dart:179-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (29 lines × 2) lib/data/services/efficient_vit_sam_service.dart:337— lib/data/services/efficient_vit_sam_service.dart:337-365 | lib/data/services/local_onnx_tagger_service.dart:372-400 — before extracting anything, compare `lib/data/services/efficient_vit_sam_service.dart` and `lib/data/services/local_onnx_tagger_service.dart` as WHOLE FILES: this scan already matched 5 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 (29 lines × 2) lib/presentation/widgets/character/add_character_buttons.dart:149— lib/presentation/widgets/character/add_character_buttons.dart:149-177 | lib/presentation/widgets/character/add_character_buttons.dart:243-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/character/add_character_buttons.dart:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/widgets/character/add_character_buttons.dart:241` calls `of` and `lib/presentation/widgets/character/add_character_buttons.dart:147` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (29 lines × 2) lib/presentation/widgets/character/character_prompt_button.dart:341— lib/presentation/widgets/character/character_prompt_button.dart:341-369 | lib/presentation/widgets/character/character_prompt_button.dart:389-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/character/character_prompt_button.dart:341` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–16 lines × 2) lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:163— lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:163-178 | lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:188-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:163` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–16 lines × 2) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:757— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:757-772 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:784-798 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:757` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15–16 lines × 2) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:326— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:326-340 | lib/presentation/screens/generation/widgets/vibe_transfer_content.dart:398-413 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/precise_reference_panel.dart:326` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15–16 lines × 2) lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:501— lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:501-516 | lib/presentation/screens/statistics/widgets/dashboard/other_stats_card.dart:70-84 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/statistics/widgets/dashboard/anlas_cost_card.dart:501` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) lib/core/cloud_sync/backend/webdav_collection_ensurer.dart:112— lib/core/cloud_sync/backend/webdav_collection_ensurer.dart:112-124 | lib/core/cloud_sync/backend/webdav_etag_reader.dart:46-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/cloud_sync/backend/webdav_collection_ensurer.dart:112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–14 lines × 2) lib/core/database/datasources/gallery_album_repository.dart:514— lib/core/database/datasources/gallery_album_repository.dart:514-527 | lib/core/database/datasources/gallery_album_repository.dart:610-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_album_repository.dart:514` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) lib/presentation/screens/watermark/watermark_editor_screen.dart:817— lib/presentation/screens/watermark/watermark_editor_screen.dart:817-829 | lib/presentation/screens/watermark/watermark_editor_screen.dart:833-846 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/watermark/watermark_editor_screen.dart:817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–14 lines × 2) REDACTED:111— REDACTED:111-124 | REDACTED:144-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:109` calls `connect` and `REDACTED:142` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–13 lines × 2) lib/data/services/official_random_prompt_generator.dart:197— lib/data/services/official_random_prompt_generator.dart:197-209 | lib/data/services/official_random_prompt_generator.dart:744-755 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/official_random_prompt_generator.dart:197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) lib/data/services/vibe_file_document_codec.dart:148— lib/data/services/vibe_file_document_codec.dart:148-159 | lib/data/services/vibe_file_document_codec.dart:238-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/vibe_file_document_codec.dart:238` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–13 lines × 2) lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:895— lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:895-907 | lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:933-944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:895` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) lib/presentation/widgets/image_editor/tools/blur_tool.dart:176— lib/presentation/widgets/image_editor/tools/blur_tool.dart:176-188 | lib/presentation/widgets/image_editor/tools/clone_stamp_tool.dart:329-340 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/tools/blur_tool.dart:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/widgets/image_editor/tools/clone_stamp_tool.dart:327` calls `SizedBox`, `_CloneSourceControls` and `lib/presentation/widgets/image_editor/tools/blur_tool.dart:176` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 2) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1338— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1338-1346 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1355-1362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1338` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8–9 lines × 2) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:72— lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:72-80 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:428-435 — before extracting anything, compare `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 125 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:72` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:296— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:296-303 | lib/presentation/widgets/prompt/uc_preset_selector.dart:360-368 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/uc_preset_selector.dart:360` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:233— lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:233-241 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:196-203 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication· Edited copy of a member (53 corresponding lines) · ×3
Edited copy of a member (53 corresponding lines) lib/presentation/screens/settings/sections/storage_settings_section.dart:458— lib/presentation/screens/settings/sections/storage_settings_section.dart:458-527 | lib/presentation/screens/settings/sections/storage_settings_section.dart:602-654 — These two members are one piece of code written twice and then edited apart: 53 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 (53 corresponding lines) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:309— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:309-361 | lib/presentation/screens/generation/widgets/vibe_transfer_content.dart:382-434 — These two members are one piece of code written twice and then edited apart: 53 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 (53 corresponding lines) lib/presentation/screens/prompt_config/widgets/preset_transfer_chooser.dart:64— lib/presentation/screens/prompt_config/widgets/preset_transfer_chooser.dart:64-118 | lib/presentation/screens/tag_library_page/widgets/tag_library_drop_menu.dart:155-207 — These two members are one piece of code written twice and then edited apart: 53 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 (33 corresponding lines) · ×3
Edited copy of a member (33 corresponding lines) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1638— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1638-1672 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1674-1706 — These two members are one piece of code written twice and then edited apart: 33 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 (33 corresponding lines) lib/data/services/efficient_vit_sam_service.dart:199— lib/data/services/efficient_vit_sam_service.dart:199-231 | lib/data/services/efficient_vit_sam_service.dart:233-277 — These two members are one piece of code written twice and then edited apart: 33 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 (33 corresponding lines) lib/presentation/screens/statistics/widgets/cards/chart_card.dart:22— lib/presentation/screens/statistics/widgets/cards/chart_card.dart:22-57 | lib/presentation/widgets/prompt/diy/panels/time_condition_panel.dart:672-704 — These two members are one piece of code written twice and then edited apart: 33 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 copies of one member (3 members, 14+ corresponding lines) · ×3
Edited copies of one member (3 members, 14+ corresponding lines) lib/presentation/widgets/prompt/global_settings_dialog.dart:105— lib/presentation/widgets/prompt/global_settings_dialog.dart:105-121 | lib/presentation/widgets/prompt/global_settings_dialog.dart:123-139 | lib/presentation/widgets/prompt/global_settings_dialog.dart:153-166 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:378— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:378-395 | lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:403-416 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:423-437 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) lib/presentation/providers/local_gallery_provider.dart:793— lib/presentation/providers/local_gallery_provider.dart:793-806 | lib/presentation/providers/local_gallery_provider.dart:808-821 | lib/presentation/providers/local_gallery_provider.dart:860-873 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×3
Edited copies of one member (3 members, 13+ corresponding lines) lib/presentation/agent_chat/services/precise_reference_toolbox.dart:73— lib/presentation/agent_chat/services/precise_reference_toolbox.dart:73-88 | lib/presentation/agent_chat/services/tag_library_toolbox.dart:115-130 | lib/presentation/agent_chat/services/vibe_library_toolbox.dart:67-79 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) lib/data/services/vibe_library_import_repository_impl.dart:99— lib/data/services/vibe_library_import_repository_impl.dart:99-114 | lib/data/services/vibe_library_storage_service.dart:183-195 | lib/presentation/providers/vibe_library_provider.dart:401-415 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) lib/core/utils/efficient_vit_sam_image_processor.dart:179— lib/core/utils/efficient_vit_sam_image_processor.dart:179-193 | lib/core/utils/inpaint_mask/inpaint_mask_geometry.dart:124-136 | lib/core/utils/inpaint_outpaint_utils.dart:493-507 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×3
Edited copies of one member (3 members, 7+ corresponding lines) lib/core/constants/api_constants.dart:1134— lib/core/constants/api_constants.dart:1134-1140 | lib/presentation/widgets/online_gallery/gallery_detail_controller.dart:179-188 | lib/presentation/widgets/online_gallery/gallery_detail_dialog.dart:122-128 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) lib/core/services/agent_question_notification_service.dart:64— lib/core/services/agent_question_notification_service.dart:64-70 | lib/core/services/android_foreground_task_service.dart:48-54 | lib/data/repositories/online_gallery_local_favorites_repository.dart:365-372 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:397— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:397-406 | lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:438-444 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:439-448 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×3
Edited copy of a member (3 corresponding lines) lib/core/agent/agent_profile_service.dart:121— lib/core/agent/agent_profile_service.dart:121-123 | lib/core/cloud_sync/backend/webdav_namespace_cleaner.dart:202-204 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) lib/core/watermark/watermark_tone.dart:60— lib/core/watermark/watermark_tone.dart:60-62 | lib/data/services/dlss/dlss_float_frame.dart:130-132 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) lib/core/watermark/watermark_tone.dart:64— lib/core/watermark/watermark_tone.dart:64-66 | lib/data/services/dlss/dlss_float_frame.dart:133-135 — These two members are one piece of code written twice and then edited apart: 3 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.
Duplicated block (18 lines × 2) lib/core/services/windows_update_script.dart:20— lib/core/services/windows_update_script.dart:20-37 | lib/core/services/windows_update_script.dart:78-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/services/windows_update_script.dart:20` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) lib/presentation/screens/generation/mobile_generation_chrome.dart:324— lib/presentation/screens/generation/mobile_generation_chrome.dart:324-341 | lib/presentation/screens/generation/widgets/generation_controls/generate_button.dart:145-162 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/mobile_generation_chrome.dart:324` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) lib/presentation/widgets/image_editor/tools/color_picker_tool.dart:638— lib/presentation/widgets/image_editor/tools/color_picker_tool.dart:638-655 | lib/presentation/widgets/image_editor/tools/selection/base_selection_tool.dart:198-215 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/tools/color_picker_tool.dart:638` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:247— lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:247-263 | lib/presentation/widgets/prompt/comfyui_import_dialog.dart:183-200 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) lib/presentation/widgets/common/image_detail/file_image_detail_data.dart:58— lib/presentation/widgets/common/image_detail/file_image_detail_data.dart:58-74 | lib/presentation/widgets/common/image_detail/image_detail_data.dart:115-132 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17–18 lines × 2) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:181— lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:181-198 | lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:619-635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:181` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) lib/presentation/screens/auth/login_screen.dart:705— lib/presentation/screens/auth/login_screen.dart:705-720 | lib/presentation/screens/auth/login_screen.dart:754-767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/auth/login_screen.dart:705` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–16 lines × 2) lib/presentation/screens/tag_library_page/widgets/tag_library_toolbar.dart:289— lib/presentation/screens/tag_library_page/widgets/tag_library_toolbar.dart:289-302 | lib/presentation/widgets/gallery/local_gallery_toolbar.dart:139-154 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–16 lines × 2) lib/presentation/widgets/auth/third_party_api_login_card.dart:77— lib/presentation/widgets/auth/third_party_api_login_card.dart:77-90 | lib/presentation/widgets/auth/token_login_card.dart:54-69 — before extracting anything, compare `lib/presentation/widgets/auth/third_party_api_login_card.dart` and `lib/presentation/widgets/auth/token_login_card.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/auth/third_party_api_login_card.dart:77` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 4) lib/core/utils/novelai_vibe_codec.dart:291— lib/core/utils/novelai_vibe_codec.dart:291-302 | lib/core/watermark/watermark_logo_service.dart:158-169 | lib/data/services/precise_ref_portable_importer.dart:20-31 | lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:692-703 — before extracting anything, compare `lib/core/watermark/watermark_logo_service.dart` and `lib/data/services/precise_ref_portable_importer.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/novelai_vibe_codec.dart:291` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 4) lib/presentation/widgets/common/add_to_library_dialog.dart:415— lib/presentation/widgets/common/add_to_library_dialog.dart:415-426 | lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart:239-250 | lib/presentation/widgets/prompt/diy/panels/dependency_config_panel.dart:680-691 | lib/presentation/widgets/prompt/fixed_tag_edit_dialog.dart:682-693 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/common/add_to_library_dialog.dart:415` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 4) lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:50— lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:50-61 | lib/presentation/screens/statistics/widgets/charts/heatmap_chart.dart:62-73 | lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:56-67 | lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.dart:53-64 — before extracting anything, compare `lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart` and `lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.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 (11–12 lines × 2) lib/presentation/providers/precise_ref_library_provider.dart:328— lib/presentation/providers/precise_ref_library_provider.dart:328-339 | lib/presentation/providers/precise_ref_library_provider.dart:345-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/providers/precise_ref_library_provider.dart:328` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) lib/presentation/screens/tag_library_page/widgets/entry_card.dart:92— lib/presentation/screens/tag_library_page/widgets/entry_card.dart:92-102 | lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:90-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 (11–12 lines × 2) lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:388— lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:388-399 | lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:423-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:388` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 3) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:377— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:377-385 | lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:84-91 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:436-443 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:377` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:93` calls `withValues` and `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:386` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) lib/data/services/official_random_prompt_generator.dart:366— lib/data/services/official_random_prompt_generator.dart:366-373 | lib/data/services/official_random_prompt_generator.dart:666-673 | lib/data/services/official_random_prompt_generator.dart:674-681 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/official_random_prompt_generator.dart:666` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 3) lib/core/cloud_sync/backend/github_backend_support.dart:111— lib/core/cloud_sync/backend/github_backend_support.dart:111-118 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:541-548 | lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:590-597 — 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.
main::(anonymous)::dilate (cognitive 41) tool/diagnostics/nai_inpaint_parity_browser.cjs:299— main::(anonymous)::dilate has cognitive complexity 41 (threshold 15). Drivers by points: loops 9 (23 pts), if/else 5 (18 pts) (nesting depth added 27). 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.
main::(anonymous)::blur (cognitive 40) tool/diagnostics/nai_inpaint_parity_browser.cjs:377— main::(anonymous)::blur has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 9 (19 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.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) lib/presentation/router/app_router_config.dart:271— lib/presentation/router/app_router_config.dart:271-342 | lib/presentation/screens/auth/login_screen.dart:76-153 | lib/presentation/screens/image_comparison_screen.dart:274-356 | lib/presentation/screens/slideshow_screen.dart:376-446 | lib/presentation/screens/splash/splash_screen.dart:66-134 — 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) lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:38— lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:38-49 | lib/presentation/screens/statistics/widgets/animated/animated_number.dart:39-50 | lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart:38-49 | lib/presentation/screens/statistics/widgets/charts/heatmap_chart.dart:75-86 | lib/presentation/screens/statistics/widgets/charts/polar_activity_chart.dart:45-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.
D4 · Code Duplication· Edited copy of a member (66 corresponding lines) · ×2
Edited copy of a member (66 corresponding lines) lib/presentation/providers/comfyui/comfyui_provider.dart:353— lib/presentation/providers/comfyui/comfyui_provider.dart:353-429 | lib/presentation/providers/comfyui/comfyui_provider.dart:431-496 — These two members are one piece of code written twice and then edited apart: 66 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 (66 corresponding lines) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:263— lib/presentation/widgets/gallery/gallery_album_tree_view.dart:263-328 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:296-370 — These two members are one piece of code written twice and then edited apart: 66 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 (44 corresponding lines) · ×2
Edited copy of a member (44 corresponding lines) lib/presentation/agent_chat/services/precise_reference_toolbox.dart:90— lib/presentation/agent_chat/services/precise_reference_toolbox.dart:90-133 | lib/presentation/agent_chat/services/precise_reference_toolbox.dart:135-189 — These two members are one piece of code written twice and then edited apart: 44 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 (44 corresponding lines) lib/presentation/agent_chat/widgets/agent_chat_tool_image_card.dart:71— lib/presentation/agent_chat/widgets/agent_chat_tool_image_card.dart:71-114 | lib/presentation/agent_chat/widgets/agent_chat_tool_result_file_image.dart:235-290 — These two members are one piece of code written twice and then edited apart: 44 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 (55 corresponding lines) · ×2
Edited copy of a member (55 corresponding lines) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:822— lib/presentation/screens/generation/widgets/precise_reference_panel.dart:822-876 | lib/presentation/screens/generation/widgets/vibe_card.dart:597-666 — These two members are one piece of code written twice and then edited apart: 55 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 (55 corresponding lines) lib/presentation/widgets/drop/global_drop_overlay.dart:11— lib/presentation/widgets/drop/global_drop_overlay.dart:11-70 | lib/presentation/widgets/drop/global_drop_overlay.dart:76-130 — These two members are one piece of code written twice and then edited apart: 55 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 (43 corresponding lines) · ×2
Edited copy of a member (43 corresponding lines) lib/presentation/widgets/common/horizontal_resize_handle.dart:38— lib/presentation/widgets/common/horizontal_resize_handle.dart:38-80 | lib/presentation/widgets/common/vertical_resize_handle.dart:36-88 — These two members are one piece of code written twice and then edited apart: 43 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 (43 corresponding lines) lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:330— lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:330-374 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:376-418 — These two members are one piece of code written twice and then edited apart: 43 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 (42 corresponding lines) · ×2
Edited copy of a member (42 corresponding lines) lib/presentation/screens/auth/login_screen.dart:686— lib/presentation/screens/auth/login_screen.dart:686-737 | lib/presentation/screens/auth/login_screen.dart:739-780 — These two members are one piece of code written twice and then edited apart: 42 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 (42 corresponding lines) lib/presentation/screens/auth/login_screen.dart:991— lib/presentation/screens/auth/login_screen.dart:991-1044 | lib/presentation/screens/vibe_library/widgets/vibe_image_encode_dialog.dart:561-602 — These two members are one piece of code written twice and then edited apart: 42 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 (39 corresponding lines) · ×2
Edited copy of a member (39 corresponding lines) lib/core/autocomplete/completion_orchestrator.dart:287— lib/core/autocomplete/completion_orchestrator.dart:287-325 | lib/core/autocomplete/completion_orchestrator.dart:327-368 — These two members are one piece of code written twice and then edited apart: 39 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 (39 corresponding lines) lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:249— lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:249-288 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:290-328 — These two members are one piece of code written twice and then edited apart: 39 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 (32 corresponding lines) · ×2
Edited copy of a member (32 corresponding lines) lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:385— lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:385-418 | lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:420-451 — These two members are one piece of code written twice and then edited apart: 32 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 (32 corresponding lines) lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:59— lib/presentation/screens/vibe_library/widgets/vibe_bundle_import_dialog.dart:59-96 | lib/presentation/screens/vibe_library/widgets/vibe_image_encode_dialog.dart:621-652 — These two members are one piece of code written twice and then edited apart: 32 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 copies of one member (3 members, 20+ corresponding lines) · ×2
Edited copies of one member (3 members, 20+ corresponding lines) lib/core/autocomplete/autocomplete_cache_database.dart:91— lib/core/autocomplete/autocomplete_cache_database.dart:91-116 | lib/core/autocomplete/tag_catalog_repository.dart:134-153 | lib/core/autocomplete/zh_dictionary_service.dart:249-275 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 20+ corresponding lines) lib/data/datasources/remote/nai_image_generation_api_service.dart:87— lib/data/datasources/remote/nai_image_generation_api_service.dart:87-111 | lib/data/datasources/remote/nai_image_generation_api_service.dart:134-153 | lib/data/datasources/remote/nai_image_generation_api_service.dart:155-174 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 24+ corresponding lines) · ×2
Edited copies of one member (3 members, 24+ corresponding lines) lib/data/datasources/remote/danbooru_api_service.dart:390— lib/data/datasources/remote/danbooru_api_service.dart:390-419 | lib/data/datasources/remote/danbooru_api_service.dart:555-578 | lib/data/datasources/remote/danbooru_api_service.dart:596-621 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 24+ corresponding lines) lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:70— lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:70-95 | lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:671-694 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:145-172 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×2
Edited copies of one member (3 members, 17+ corresponding lines) lib/presentation/themes/modules/color/palettes/material_you_palette.dart:42— lib/presentation/themes/modules/color/palettes/material_you_palette.dart:42-61 | lib/presentation/themes/modules/color/palettes/system_palette.dart:27-44 | lib/presentation/themes/modules/color/palettes/system_palette.dart:46-62 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) lib/presentation/widgets/character/character_tooltip_content.dart:80— lib/presentation/widgets/character/character_tooltip_content.dart:80-98 | lib/presentation/widgets/prompt/diy/diy_badges.dart:40-56 | lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:179-197 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 19+ corresponding lines) · ×2
Edited copies of one member (4 members, 19+ corresponding lines) lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:33— lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:33-53 | lib/presentation/screens/precise_ref_library/widgets/precise_ref_selector_dialog.dart:38-61 | lib/presentation/widgets/prompt/diy/dialogs/preset_import_dialog.dart:44-66 | lib/presentation/widgets/prompt/regex_rules_dialog.dart:432-450 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 19+ corresponding lines) lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:54— lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:54-72 | lib/presentation/widgets/image_editor/effects/effects_preview_dialog.dart:42-64 | lib/presentation/widgets/image_editor/widgets/panels/color_panel.dart:96-117 | lib/presentation/widgets/image_editor/widgets/panels/shift_edges_dialog.dart:40-60 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×2
Edited copies of one member (3 members, 9+ corresponding lines) lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:146— lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:146-164 | lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:166-182 | lib/presentation/prompt_assistant/providers/prompt_assistant_history_provider.dart:206-214 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:298— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:298-306 | lib/presentation/widgets/gallery/gallery_album_tree_view.dart:167-175 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:286-294 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×2
Edited copies of one member (3 members, 18+ corresponding lines) lib/presentation/widgets/prompt/random_manager/algorithm_config_card.dart:439— lib/presentation/widgets/prompt/random_manager/algorithm_config_card.dart:439-456 | lib/presentation/widgets/prompt/random_manager/category_card_list.dart:217-235 | lib/presentation/widgets/prompt/random_manager/preview_generator_panel.dart:614-633 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) lib/presentation/providers/generation/image_workflow_controller.dart:271— lib/presentation/providers/generation/image_workflow_controller.dart:271-289 | lib/presentation/providers/generation/image_workflow_controller.dart:446-463 | lib/presentation/providers/generation/image_workflow_controller.dart:470-488 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×2
Edited copies of one member (3 members, 8+ corresponding lines) lib/presentation/agent_chat/services/queue_toolbox.dart:448— lib/presentation/agent_chat/services/queue_toolbox.dart:448-455 | lib/presentation/providers/generation/vibe_reference_service.dart:139-146 | lib/presentation/providers/local_gallery_provider.dart:1344-1353 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) lib/presentation/screens/settings/widgets/gallery_cache_actions.dart:45— lib/presentation/screens/settings/widgets/gallery_cache_actions.dart:45-52 | lib/presentation/screens/statistics/widgets/dashboard/animated_refresh_button.dart:26-33 | lib/presentation/widgets/gallery/gallery_scan_progress_panel.dart:496-503 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (2 corresponding lines) · ×2
Edited copy of a member (2 corresponding lines) lib/core/services/update_installer_service.dart:750— lib/core/services/update_installer_service.dart:750-752 | lib/core/services/verified_resumable_downloader.dart:489-490 — These two members are one piece of code written twice and then edited apart: 2 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 (2 corresponding lines) lib/core/network/web_access/web_access_models.dart:9— lib/core/network/web_access/web_access_models.dart:9-10 | lib/data/models/prompt_assistant/prompt_assistant_models.dart:28-32 — These two members are one piece of code written twice and then edited apart: 2 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 copies of one member (3 members, 4+ corresponding lines) · ×2
Edited copies of one member (3 members, 4+ corresponding lines) lib/presentation/screens/tag_library_page/widgets/entry_card.dart:451— lib/presentation/screens/tag_library_page/widgets/entry_card.dart:451-454 | lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:497-500 | lib/presentation/widgets/common/image_detail/components/prompt_section.dart:79-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:441— lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:441-444 | lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:826-829 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:527-530 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (23 lines × 2) lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:262— lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:262-284 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:302-324 — both copies are in the same file, so extract the block into 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) lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:156— lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:156-178 | lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.dart:129-151 — before extracting anything, compare `lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart` and `lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.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. 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 × 2) lib/presentation/screens/director_tools/widgets/pixel_snap_panel.dart:238— lib/presentation/screens/director_tools/widgets/pixel_snap_panel.dart:238-258 | lib/presentation/widgets/auth/credentials_login_form.dart:145-166 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/director_tools/widgets/pixel_snap_panel.dart:238` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–22 lines × 2) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:96— lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:96-117 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:446-466 — before extracting anything, compare `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 125 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) lib/presentation/screens/generation/widgets/reverse_prompt_panel.dart:186— lib/presentation/screens/generation/widgets/reverse_prompt_panel.dart:186-206 | lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:668-688 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/reverse_prompt_panel.dart:186` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:254— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:254-274 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:875-895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `GallerySearchRequest` in one and `GalleryRandomSearchRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (18–20 lines × 2) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:750— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:750-767 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:828-847 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:750` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–20 lines × 2) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:158— lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:158-177 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:500-517 — before extracting anything, compare `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 125 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:158` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:69— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:69-84 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:123-139 — before extracting anything, compare `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart` and `lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:69` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16–17 lines × 2) lib/presentation/screens/prompt_config/widgets/prompt_config_unavailable_states.dart:88— lib/presentation/screens/prompt_config/widgets/prompt_config_unavailable_states.dart:88-103 | lib/presentation/widgets/prompt/random_manager/preview_generator_panel.dart:589-605 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/prompt_config/widgets/prompt_config_unavailable_states.dart:88` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) lib/core/network/dio_client.dart:227— lib/core/network/dio_client.dart:227-239 | lib/core/storage/secure_storage_service.dart:541-553 | lib/data/datasources/remote/nai_auth_api_service.dart:254-266 — before extracting anything, compare `lib/core/network/dio_client.dart` and `lib/data/datasources/remote/nai_auth_api_service.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/network/dio_client.dart:227` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) lib/presentation/widgets/bulk_metadata_edit_dialog.dart:260— lib/presentation/widgets/bulk_metadata_edit_dialog.dart:260-272 | lib/presentation/widgets/online_gallery/blacklist_settings_panel.dart:242-254 | lib/presentation/widgets/online_gallery/gallery_detail_primary_actions.dart:61-73 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/bulk_metadata_edit_dialog.dart:260` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) lib/presentation/router/app_router_config.dart:306— lib/presentation/router/app_router_config.dart:306-317 | lib/presentation/screens/image_comparison_screen.dart:320-331 | lib/presentation/screens/slideshow_screen.dart:410-421 — before extracting anything, compare `lib/presentation/router/app_router_config.dart` and `lib/presentation/screens/image_comparison_screen.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/router/app_router_config.dart:306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:24— lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:24-35 | lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:27-38 | lib/presentation/themes/modules/color/palettes/neo_dark_palette.dart:27-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:39` calls `Color` and `lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:36` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–11 lines × 2) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:113— lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:113-123 | lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:145-153 — before extracting anything, compare `lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart` and `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 2) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart:680— lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart:680-690 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart:783-791 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart:680` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) lib/core/network/dio_client.dart:245— lib/core/network/dio_client.dart:245-254 | lib/core/storage/secure_storage_service.dart:569-578 | lib/data/datasources/remote/nai_auth_api_service.dart:272-281 — before extracting anything, compare `lib/core/network/dio_client.dart` and `lib/data/datasources/remote/nai_auth_api_service.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. 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) lib/presentation/widgets/character/character_position_canvas.dart:690— lib/presentation/widgets/character/character_position_canvas.dart:690-699 | lib/presentation/widgets/character/inline_character_card.dart:399-408 | lib/presentation/widgets/character/inline_character_row.dart:507-516 — 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–10 lines × 2) lib/core/database/datasources/gallery_album_repository.dart:850— lib/core/database/datasources/gallery_album_repository.dart:850-858 | lib/core/database/datasources/gallery_album_repository.dart:860-869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_album_repository.dart:860` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 lines × 2) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:294— lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:294-302 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:462-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:294` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 3) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:252— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:252-260 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:123-131 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:204-212 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:252` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 3) lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:28— lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:28-36 | lib/presentation/screens/statistics/widgets/animated/animated_number.dart:29-37 | lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart:28-36 — before extracting anything, compare `lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart` and `lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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) lib/presentation/agent_chat/services/generation_execution_service.dart:292— lib/presentation/agent_chat/services/generation_execution_service.dart:292-297 | lib/presentation/providers/gallery_category_provider.dart:467-472 | lib/presentation/providers/online_gallery_blacklist_provider.dart:882-887 | lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart:504-509 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 4) lib/core/database/datasources/gallery_favorite_tag_repository.dart:407— lib/core/database/datasources/gallery_favorite_tag_repository.dart:407-412 | lib/core/database/datasources/gallery_image_repository.dart:780-785 | lib/core/database/datasources/gallery_metadata_repository.dart:345-350 | lib/data/services/bulk_image_state_service.dart:320-325 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
OnlineGalleryPaginationService.load (cyclomatic 95) lib/presentation/providers/online_gallery_pagination_service.dart:90— OnlineGalleryPaginationService.load has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OnlineGalleryRandomLoaderService.load (cyclomatic 76) lib/presentation/providers/online_gallery_random_loader_service.dart:107— OnlineGalleryRandomLoaderService.load 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.
OnlineGalleryFavoritesLoaderService.load (cyclomatic 74) lib/presentation/providers/online_gallery_favorites_loader_service.dart:89— OnlineGalleryFavoritesLoaderService.load 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.
_OfficialRecipeEngine._furryCharacter (cyclomatic 64) lib/data/services/official_random_prompt_generator.dart:502— _OfficialRecipeEngine._furryCharacter has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MetadataImportOptions.selectedCountFor (cyclomatic 63) lib/data/models/metadata/metadata_import_options.dart:166— MetadataImportOptions.selectedCountFor has cyclomatic complexity 63 (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.
_DanbooruPostCardState._buildCard (cyclomatic 62) lib/presentation/widgets/danbooru_post_card.dart:559— _DanbooruPostCardState._buildCard has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_DetailTopBarActions._buildActions (cyclomatic 61) lib/presentation/widgets/common/image_detail/components/detail_top_bar.dart:196— _DetailTopBarActions._buildActions has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentChatEventController.handle (cyclomatic 56) lib/presentation/agent_chat/services/agent_chat_event_controller.dart:42— AgentChatEventController.handle 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.
WarmupMessageLocalizer._localizeKnownMessage (cyclomatic 54) lib/presentation/utils/warmup_message_localizer.dart:34— WarmupMessageLocalizer._localizeKnownMessage has cyclomatic complexity 54 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
OpenAiResponsesAdapter.completeAgent (cyclomatic 52) lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:70— OpenAiResponsesAdapter.completeAgent 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.
GalleryDetailInfoPanel.build (cyclomatic 52) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:30— GalleryDetailInfoPanel.build 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.
AnthropicMessagesAdapter.completeAgent (cyclomatic 50) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:63— AnthropicMessagesAdapter.completeAgent 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.
ImageGenerationCoordinator.execute (cyclomatic 49) lib/presentation/providers/generation/image_generation_coordinator.dart:81— ImageGenerationCoordinator.execute 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.
GenerationPreparationService.prepareForKind (cyclomatic 48) lib/presentation/agent_chat/services/generation_preparation_service.dart:140— GenerationPreparationService.prepareForKind has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenAiChatCompletionsAdapter.completeAgent (cyclomatic 48) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:97— OpenAiChatCompletionsAdapter.completeAgent has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_QuickTagCloudToolbarState.build (cyclomatic 48) lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart:62— _QuickTagCloudToolbarState.build has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AiTagGenerationInfoSection.build (cyclomatic 47) lib/presentation/widgets/online_gallery/ai_tag_generation_info_section.dart:20— AiTagGenerationInfoSection.build 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.
PortableRecordCodec.decode (cyclomatic 46) lib/data/cloud_sync/portable_record_codec.dart:32— PortableRecordCodec.decode 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.
GeminiGenerateContentAdapter.completeAgent (cyclomatic 46) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:71— GeminiGenerateContentAdapter.completeAgent 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.
InputHandler.handleKeyEvent (cyclomatic 46) lib/presentation/widgets/image_editor/core/input_handler.dart:193— InputHandler.handleKeyEvent 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.
TagSubCategoryHelper.classifyTag (cyclomatic 45) lib/data/models/prompt/tag_category.dart:162— TagSubCategoryHelper.classifyTag has cyclomatic complexity 45 (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: TagSubCategoryHelper.getDisplayName (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.
ImageCardSurface._buildSurface (cyclomatic 44) lib/presentation/widgets/common/image_card_surface.dart:47— ImageCardSurface._buildSurface has cyclomatic complexity 44 (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.
nai_inpaint_parity_browser.main (cyclomatic 44) tool/diagnostics/nai_inpaint_parity_browser.cjs:161— nai_inpaint_parity_browser.main has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 3 of the 44 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 377, 299, 354, …). 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.
_OfficialRecipeEngine._legacyCharacter (cyclomatic 42) lib/data/services/official_random_prompt_generator.dart:256— _OfficialRecipeEngine._legacyCharacter 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.
ContiguousRegionSelector.selectRgba (cyclomatic 40) lib/core/utils/contiguous_region_selector.dart:46— ContiguousRegionSelector.selectRgba has cyclomatic complexity 40 (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.
_AgentChatComposerState._editor (cyclomatic 39) lib/presentation/agent_chat/widgets/agent_chat_composer.dart:236— _AgentChatComposerState._editor 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.
AssistantModelCatalog._resolvePiProvider (cyclomatic 38) lib/presentation/prompt_assistant/models/assistant_model_capability.dart:361— AssistantModelCatalog._resolvePiProvider 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.
AuthNotifier._restoreStoredSession (cyclomatic 37) lib/data/services/auth_provider.dart:289— AuthNotifier._restoreStoredSession 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.
GeminiGenerateContentAdapter._buildAgentPayload (cyclomatic 37) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:265— GeminiGenerateContentAdapter._buildAgentPayload 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.
_OnlineGalleryContentPresenter._buildResolvedPostCard (cyclomatic 37) lib/presentation/screens/online_gallery/online_gallery_content.dart:369— _OnlineGalleryContentPresenter._buildResolvedPostCard 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.
OnlineGalleryLocalFavoritesRepository.query (cyclomatic 36) lib/data/repositories/online_gallery_local_favorites_repository.dart:146— OnlineGalleryLocalFavoritesRepository.query 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.
AgentChatNotifier._sendMessage (cyclomatic 36) lib/presentation/agent_chat/providers/agent_chat_notifier.dart:1143— AgentChatNotifier._sendMessage 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.
OnlineGalleryErrorMapper.map (cyclomatic 35) lib/data/services/online_gallery/online_gallery_error_mapper.dart:38— OnlineGalleryErrorMapper.map 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.
_OfficialRecipeEngine.generateFurry (cyclomatic 34) lib/data/services/official_random_prompt_generator.dart:386— _OfficialRecipeEngine.generateFurry 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.
PreciseRefImageCodec.detectExtension (cyclomatic 34) lib/data/services/precise_ref_portable_importer.dart:13— PreciseRefImageCodec.detectExtension 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.
AgentChatMessages.build (cyclomatic 34) lib/presentation/agent_chat/widgets/agent_chat_messages.dart:35— AgentChatMessages.build 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.
ImageGenerationCoordinator._runRequest (cyclomatic 34) lib/presentation/providers/generation/image_generation_coordinator.dart:355— ImageGenerationCoordinator._runRequest 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.
EditorResultExporter.buildEditorResult (cyclomatic 34) lib/presentation/widgets/image_editor/export/editor_result_exporter.dart:66— EditorResultExporter.buildEditorResult 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.
_TagEditorViewState._key (cyclomatic 34) lib/presentation/widgets/prompt/tag_editor_view.dart:537— _TagEditorViewState._key 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.
QuickTagCloudQueryEngine.matchingRecords (cyclomatic 33) lib/data/datasources/remote/online_gallery/quick_tag_cloud_query_engine.dart:28— QuickTagCloudQueryEngine.matchingRecords 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.
GalleryStreamScanner._processSingleFile (cyclomatic 33) lib/data/services/gallery/gallery_stream_scanner.dart:463— GalleryStreamScanner._processSingleFile 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.
_AgentChatComposerState._contextIndicator (cyclomatic 33) lib/presentation/agent_chat/widgets/agent_chat_composer.dart:527— _AgentChatComposerState._contextIndicator has cyclomatic complexity 33 (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.
AgentChatMessages._messageTile (cyclomatic 33) lib/presentation/agent_chat/widgets/agent_chat_messages.dart:374— AgentChatMessages._messageTile 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.
McpImageResponseService.prepare (cyclomatic 33) lib/presentation/mcp/services/mcp_image_response_service.dart:103— McpImageResponseService.prepare 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.
_PrivacySettingsSectionState.build (cyclomatic 33) lib/presentation/screens/settings/sections/privacy_settings_section.dart:94— _PrivacySettingsSectionState.build has cyclomatic complexity 33 (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.
SqliteGalleryAlbumRepository._moveAlbumToSlot (cyclomatic 32) lib/core/database/datasources/gallery_album_repository.dart:791— SqliteGalleryAlbumRepository._moveAlbumToSlot 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.
SafeWebReader._isBlockedIpv4 (cyclomatic 32) lib/core/network/web_access/safe_web_reader.dart:282— SafeWebReader._isBlockedIpv4 has cyclomatic complexity 32 (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.
SessionJsonlCodec.encode (cyclomatic 30) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:8— SessionJsonlCodec.encode 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.
SkillArchiveExtractor._preflightZipHeaders (cyclomatic 30) lib/core/agent/skill_archive_extractor.dart:190— SkillArchiveExtractor._preflightZipHeaders 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.
CompletionOrchestrator.query (cyclomatic 30) lib/core/autocomplete/completion_orchestrator.dart:62— CompletionOrchestrator.query has cyclomatic complexity 30 (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.
AgentSkillsCloudSyncAdapter.validateRecord (cyclomatic 30) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:252— AgentSkillsCloudSyncAdapter.validateRecord has cyclomatic complexity 30 (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.
MetadataImportOptions.selectedCount (cyclomatic 30) lib/data/models/metadata/metadata_import_options.dart:255— MetadataImportOptions.selectedCount has cyclomatic complexity 30 (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.
_OfficialRecipeEngine.generateLegacy (cyclomatic 30) lib/data/services/official_random_prompt_generator.dart:154— _OfficialRecipeEngine.generateLegacy 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.
GalleryCategoryNotifier._moveCategoryToSlot (cyclomatic 30) lib/presentation/providers/gallery_category_provider.dart:314— GalleryCategoryNotifier._moveCategoryToSlot 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.
_ImagePreviewWidgetState._buildGeneratedImageCard (cyclomatic 30) lib/presentation/screens/generation/widgets/image_preview.dart:656— _ImagePreviewWidgetState._buildGeneratedImageCard has cyclomatic complexity 30 (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.
_Img2ImgUpscaleSectionState.build (cyclomatic 30) lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:99— _Img2ImgUpscaleSectionState.build 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.
CardActionButtons.build (cyclomatic 30) lib/presentation/widgets/common/card_action_buttons.dart:93— CardActionButtons.build has cyclomatic complexity 30 (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.
_DanbooruPostCardState._buildActions (cyclomatic 30) lib/presentation/widgets/danbooru_post_card.dart:382— _DanbooruPostCardState._buildActions 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.
_CategoryItemState.build (cyclomatic 30) lib/presentation/widgets/gallery/gallery_category_tree_view.dart:423— _CategoryItemState.build 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.
_UnifiedPromptInputState._handleHardwareKeyEvent (cyclomatic 30) lib/presentation/widgets/prompt/unified/unified_prompt_input.dart:156— _UnifiedPromptInputState._handleHardwareKeyEvent has cyclomatic complexity 30 (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.
CooccurrenceDataPackService._install (cyclomatic 29) lib/core/autocomplete/cooccurrence_data_pack_service.dart:187— CooccurrenceDataPackService._install 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.
WebDavCapabilityProbe.run (cyclomatic 29) lib/core/cloud_sync/backend/webdav_capability_probe.dart:32— WebDavCapabilityProbe.run 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.
HiveStorageHelper._migrateFromOldLocation (cyclomatic 29) lib/core/utils/hive_storage_helper.dart:171— HiveStorageHelper._migrateFromOldLocation 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.
GenerationSettingsService.updateSettings (cyclomatic 29) lib/presentation/agent_chat/services/generation_settings_service.dart:68— GenerationSettingsService.updateSettings 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.
ImageGenerationNotifier.generate (cyclomatic 29) lib/presentation/providers/image_generation_provider.dart:292— ImageGenerationNotifier.generate 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.
PromptInputEditor.build (cyclomatic 29) lib/presentation/screens/generation/widgets/prompt_input_editor.dart:35— PromptInputEditor.build 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.
_VibeCategoryItemState.build (cyclomatic 29) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:65— _VibeCategoryItemState.build 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.
ImageCardController.update (cyclomatic 29) lib/presentation/widgets/common/image_card_controller.dart:68— ImageCardController.update 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.
NAIImageRequestBuilder.build (cyclomatic 28) lib/core/network/request_builders/nai_image_request_builder.dart:563— NAIImageRequestBuilder.build 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.
NaiImageMetadata.upgradeFromRawJsonIfNeeded (cyclomatic 28) lib/data/models/gallery/nai_image_metadata.dart:238— NaiImageMetadata.upgradeFromRawJsonIfNeeded 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.
_WatermarkEditorScreenState._buildActions (cyclomatic 28) lib/presentation/screens/watermark/watermark_editor_screen.dart:761— _WatermarkEditorScreenState._buildActions 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.
CloudRecordMerger.merge (cyclomatic 27) lib/core/cloud_sync/record_merge.dart:17— CloudRecordMerger.merge 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.
SpreadKernel._spread (cyclomatic 27) lib/core/services/pixel_snap/internal/spread_kernel.dart:29— SpreadKernel._spread 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.
AgentChatConfig.fromJson (cyclomatic 27) lib/data/models/agent/agent_settings.dart:220— AgentChatConfig.fromJson 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.
_OfficialRecipeEngine._characterPromptCharacter (cyclomatic 27) lib/data/services/official_random_prompt_generator.dart:811— _OfficialRecipeEngine._characterPromptCharacter 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.
OnlineGalleryToolbox._executeBrowse (cyclomatic 27) lib/presentation/agent_chat/services/online_gallery_toolbox.dart:107— OnlineGalleryToolbox._executeBrowse 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.
OnlineGalleryToolbarAuthControls._buildUserButton (cyclomatic 27) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_auth.dart:47— OnlineGalleryToolbarAuthControls._buildUserButton 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.
_VibeCardState._buildCard (cyclomatic 27) lib/presentation/screens/vibe_library/widgets/vibe_card.dart:291— _VibeCardState._buildCard 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.
ImageWorkflowLauncher._openEditor (cyclomatic 27) lib/presentation/services/image_workflow_launcher.dart:63— ImageWorkflowLauncher._openEditor 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.
CompactIconButton.build (cyclomatic 27) lib/presentation/widgets/common/compact_icon_button.dart:37— CompactIconButton.build 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.
_MetadataImportDialogState._buildPromptSection (cyclomatic 27) lib/presentation/widgets/metadata/metadata_import_dialog.dart:264— _MetadataImportDialogState._buildPromptSection 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.
PromptWeightEditing._resolveTarget (cyclomatic 27) lib/presentation/widgets/prompt/prompt_weight_editing.dart:98— PromptWeightEditing._resolveTarget 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.
_OfficialRecipeEngine.generateCharacterPrompts (cyclomatic 26) lib/data/services/official_random_prompt_generator.dart:694— _OfficialRecipeEngine.generateCharacterPrompts 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.
GenerationCharacterOrchestrator.normalizeExplicit (cyclomatic 26) lib/presentation/agent_chat/services/generation_character_orchestration.dart:38— GenerationCharacterOrchestrator.normalizeExplicit 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.
OpenAiChatCompletionsAdapter._maxTokensField (cyclomatic 26) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:662— OpenAiChatCompletionsAdapter._maxTokensField 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.
ImageGenerationNotifier._reduce (cyclomatic 26) lib/presentation/providers/image_generation_provider.dart:520— ImageGenerationNotifier._reduce 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.
_OnlineGalleryScreenState._handleGalleryStateChanged (cyclomatic 26) lib/presentation/screens/online_gallery/online_gallery_screen.dart:303— _OnlineGalleryScreenState._handleGalleryStateChanged 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.
OnlineGalleryToolbarSourceControls._buildSecondaryControls (cyclomatic 26) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:387— OnlineGalleryToolbarSourceControls._buildSecondaryControls 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.
GenerationPromptTransferService.replaceMainPrompt (cyclomatic 26) lib/presentation/services/generation_prompt_transfer_service.dart:192— GenerationPromptTransferService.replaceMainPrompt 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.
_CollapsibleImagePanelState.build (cyclomatic 26) lib/presentation/widgets/common/collapsible_image_panel.dart:278— _CollapsibleImagePanelState.build 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.
ImageCardFrame.build (cyclomatic 26) lib/presentation/widgets/common/image_card_frame.dart:52— ImageCardFrame.build 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.
_LocalGalleryToolbarState.build (cyclomatic 26) lib/presentation/widgets/gallery/local_gallery_toolbar.dart:167— _LocalGalleryToolbarState.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.
_AutoSaveToggleChipState.build (cyclomatic 26) lib/presentation/widgets/generation/auto_save_toggle_chip.dart:68— _AutoSaveToggleChipState.build 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.
SkillArchiveExtractor.extract (cyclomatic 25) lib/core/agent/skill_archive_extractor.dart:38— SkillArchiveExtractor.extract 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.
SkillInstallTransactionManager.recoverTransaction (cyclomatic 25) lib/core/agent/skill_install_transaction.dart:41— SkillInstallTransactionManager.recoverTransaction 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.
BackendHttp.request (cyclomatic 25) lib/core/cloud_sync/backend/backend_http.dart:40— BackendHttp.request 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.
WebDavOperationInventory.findExisting (cyclomatic 25) lib/core/cloud_sync/backend/webdav_operation_inventory.dart:38— WebDavOperationInventory.findExisting 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.
PipeParser._splitPipeSegments (cyclomatic 25) lib/core/utils/comfyui_prompt_parser/pipe_parser.dart:98— PipeParser._splitPipeSegments 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.
NaiPromptExportCodec._project (cyclomatic 25) lib/data/models/gallery/nai_prompt_export_codec.dart:236— NaiPromptExportCodec._project 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.
_ArchiveRecord.parse (cyclomatic 25) lib/data/services/precise_ref_library_archive_service.dart:361— _ArchiveRecord.parse 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.
_AgentChatResourcePickerBodyState._buildLocalGallery (cyclomatic 25) lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:723— _AgentChatResourcePickerBodyState._buildLocalGallery 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.
AgentChatThreadModel.fromMessages (cyclomatic 25) lib/presentation/agent_chat/widgets/agent_chat_turn.dart:22— AgentChatThreadModel.fromMessages 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.
OpenAiResponsesAdapter._buildAgentPayload (cyclomatic 25) lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:289— OpenAiResponsesAdapter._buildAgentPayload 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.
ImageSendActionDispatcher.handle (cyclomatic 25) lib/presentation/services/image_send_action_dispatcher.dart:36— ImageSendActionDispatcher.handle 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.
_AutocompleteWrapperState._onKeyEvent (cyclomatic 25) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:625— _AutocompleteWrapperState._onKeyEvent 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.
SessionState.applyMutation (cyclomatic 24) lib/core/agent/harness/session/session_state.dart:152— SessionState.applyMutation 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.
SessionState._matchesRecordQuery (cyclomatic 24) lib/core/agent/harness/session/session_state.dart:462— SessionState._matchesRecordQuery 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.
PromptTokenParser.editChangesActiveToken (cyclomatic 24) lib/core/autocomplete/prompt_token_parser.dart:205— PromptTokenParser.editChangesActiveToken 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.
VibeFileParser._extractEncodingDetails (cyclomatic 24) lib/core/utils/vibe_file_parser.dart:940— VibeFileParser._extractEncodingDetails 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.
AgentToolPermissionController.beforeToolCall (cyclomatic 24) lib/presentation/agent_chat/services/agent_tool_permission_controller.dart:49— AgentToolPermissionController.beforeToolCall 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.
AnthropicMessagesAdapter.buildAgentPayload (cyclomatic 24) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:245— AnthropicMessagesAdapter.buildAgentPayload 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.
HistoryImageCard.build (cyclomatic 24) lib/presentation/screens/generation/widgets/history_panel/history_image_card.dart:90— HistoryImageCard.build 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.
MosaicEditorActionsBar.build (cyclomatic 24) lib/presentation/screens/mosaic/mosaic_editor_actions_bar.dart:32— MosaicEditorActionsBar.build 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.
_PreciseRefSelectorDialogState.build (cyclomatic 24) lib/presentation/screens/precise_ref_library/widgets/precise_ref_selector_dialog.dart:129— _PreciseRefSelectorDialogState.build 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.
CompletionOverlay.build (cyclomatic 24) lib/presentation/widgets/autocomplete/completion_overlay.dart:61— CompletionOverlay.build 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.
_PromptCopyDialogState._buildExportOptions (cyclomatic 24) lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:264— _PromptCopyDialogState._buildExportOptions 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.
_AlbumItemState.build (cyclomatic 24) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:550— _AlbumItemState.build 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.
MagicWandController.apply (cyclomatic 24) lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart:42— MagicWandController.apply 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.
_NavRailAccountButtonState._showAccountMenu (cyclomatic 24) lib/presentation/widgets/navigation/nav_rail_account_button.dart:162— _NavRailAccountButtonState._showAccountMenu 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.
krita_bridge_direct_probe_no_write._main (cyclomatic 24) REDACTED:48— krita_bridge_direct_probe_no_write._main 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.
_DriveFile.fromJson (cyclomatic 23) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:894— _DriveFile.fromJson 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.
BoundedTransferScheduler.run (cyclomatic 23) lib/core/cloud_sync/bounded_transfer_scheduler.dart:80— BoundedTransferScheduler.run 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.
NAIImageRequestBuilder.buildBaseParameters (cyclomatic 23) lib/core/network/request_builders/nai_image_request_builder.dart:73— NAIImageRequestBuilder.buildBaseParameters 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.
NaiPromptParser._splitByDelimiters (cyclomatic 23) lib/core/utils/nai_prompt_parser.dart:73— NaiPromptParser._splitByDelimiters 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.
PromptEditDocument._parse (cyclomatic 23) lib/core/utils/prompt_edit_document.dart:103— PromptEditDocument._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.
PromptTagUtils.splitTopLevel (cyclomatic 23) lib/core/utils/prompt_tag_utils.dart:9— PromptTagUtils.splitTopLevel 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.
WatermarkLogoService._detectExtension (cyclomatic 23) lib/core/watermark/watermark_logo_service.dart:151— WatermarkLogoService._detectExtension 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.
PromptAssistantConfigState._isUntouchedLegacyPollinationsDefault (cyclomatic 23) lib/data/models/prompt_assistant/prompt_assistant_models.dart:1322— PromptAssistantConfigState._isUntouchedLegacyPollinationsDefault 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.
OpenAiChatCompletionsAdapter._mapAgentMessage (cyclomatic 23) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:438— OpenAiChatCompletionsAdapter._mapAgentMessage 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.
ImageGenerationService._execute (cyclomatic 23) lib/presentation/providers/generation/image_generation_service.dart:133— ImageGenerationService._execute 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.
_AutocompleteWrapperState._buildOverlay (cyclomatic 23) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:507— _AutocompleteWrapperState._buildOverlay 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.
_BulkProgressDialogState.build (cyclomatic 23) lib/presentation/widgets/bulk_progress_dialog.dart:64— _BulkProgressDialogState.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.
_FavoriteIconButtonState.build (cyclomatic 23) lib/presentation/widgets/common/animated_favorite_button.dart:162— _FavoriteIconButtonState.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.
GlobalDropActionCoordinator.processDroppedFile (cyclomatic 23) lib/presentation/widgets/drop/global_drop_action_coordinator.dart:232— GlobalDropActionCoordinator.processDroppedFile 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.
OnlineGalleryCardLeftStatusOverlays.build (cyclomatic 23) lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:103— OnlineGalleryCardLeftStatusOverlays.build 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.
TagEditorSession.apply (cyclomatic 23) lib/presentation/widgets/prompt/tag_editor_session.dart:330— TagEditorSession.apply 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.
_TaskListItemState.build (cyclomatic 23) lib/presentation/widgets/queue/task_list_item.dart:95— _TaskListItemState.build 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.
SkillArchiveService.exportSkills (cyclomatic 22) lib/core/agent/skill_archive_service.dart:62— SkillArchiveService.exportSkills 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.
ResumableSnapshotUploader.resume (cyclomatic 22) lib/core/cloud_sync/snapshot_uploader.dart:33— ResumableSnapshotUploader.resume 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.
NAIImageRequestBuilder.buildVibeTransferParameters (cyclomatic 22) lib/core/network/request_builders/nai_image_request_builder.dart:319— NAIImageRequestBuilder.buildVibeTransferParameters 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.
VerifiedResumableDownloader._downloadToPartFile (cyclomatic 22) lib/core/services/verified_resumable_downloader.dart:273— VerifiedResumableDownloader._downloadToPartFile 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.
NaiGenerationResponseProcessor.processMessagePackStream (cyclomatic 22) lib/data/datasources/remote/nai_generation_response_processor.dart:95— NaiGenerationResponseProcessor.processMessagePackStream 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.
FilterCriteria.hasFilters (cyclomatic 22) lib/data/services/gallery/gallery_filter_service.dart:154— FilterCriteria.hasFilters 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.
FilterCriteria.cacheKey (cyclomatic 22) lib/data/services/gallery/gallery_filter_service.dart:196— FilterCriteria.cacheKey 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.
QuickTagCloudParser.parseCodex (cyclomatic 22) lib/data/services/online_gallery/quick_tag_cloud_parser.dart:249— QuickTagCloudParser.parseCodex 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.
_MobileGenerateButton.build (cyclomatic 22) lib/presentation/screens/generation/mobile_generation_chrome.dart:309— _MobileGenerateButton.build 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.
OnlineGalleryScrollPrefetchCoordinator._requestNextIfNeeded (cyclomatic 22) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:177— OnlineGalleryScrollPrefetchCoordinator._requestNextIfNeeded 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.
OnlineGalleryScrollPrefetchCoordinator.jumpToPageTarget (cyclomatic 22) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:312— OnlineGalleryScrollPrefetchCoordinator.jumpToPageTarget 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.
OnlineGalleryScrollPrefetchCoordinator.scheduleVisiblePrefetch (cyclomatic 22) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:530— OnlineGalleryScrollPrefetchCoordinator.scheduleVisiblePrefetch 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.
_StorageSettingsSectionState.build (cyclomatic 22) lib/presentation/screens/settings/sections/storage_settings_section.dart:176— _StorageSettingsSectionState.build 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.
_EntryCardState.build (cyclomatic 22) lib/presentation/screens/tag_library_page/widgets/entry_card.dart:82— _EntryCardState.build 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.
_ElevatedCardState.build (cyclomatic 22) lib/presentation/widgets/common/elevated_card.dart:112— _ElevatedCardState.build 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.
_ImageDetailViewerState._buildMainContent (cyclomatic 22) lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:602— _ImageDetailViewerState._buildMainContent 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.
TagEditorSession._changed (cyclomatic 22) lib/presentation/widgets/prompt/tag_editor_session.dart:183— TagEditorSession._changed 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.
_TagEditorViewState._action (cyclomatic 22) lib/presentation/widgets/prompt/tag_editor_view.dart:414— _TagEditorViewState._action 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.
ReadHarnessTool.executeWithContext (cyclomatic 21) lib/core/agent/harness/tools/read.dart:105— ReadHarnessTool.executeWithContext 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.
LoopbackCloudDriveOAuthClient._validatedIdentity (cyclomatic 21) lib/core/cloud_sync/oauth/loopback_oauth_client.dart:494— LoopbackCloudDriveOAuthClient._validatedIdentity 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.
CharacterPromptBlockParser.parse (cyclomatic 21) lib/core/utils/character_prompt_block_parser.dart:91— CharacterPromptBlockParser.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.
InpaintMaskUtils.fillMaskRegionAtPoint (cyclomatic 21) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:392— InpaintMaskUtils.fillMaskRegionAtPoint 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.
InpaintMaskUtils._officialWorkerBlur (cyclomatic 21) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1434— InpaintMaskUtils._officialWorkerBlur has cyclomatic complexity 21 (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.
NovelAiVibeCodec.validateSingleMap (cyclomatic 21) lib/core/utils/novelai_vibe_codec.dart:123— NovelAiVibeCodec.validateSingleMap 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.
PromptEditDocument._span (cyclomatic 21) lib/core/utils/prompt_edit_document.dart:170— PromptEditDocument._span 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.
VibeFileParser._parsePngIsolate (cyclomatic 21) lib/core/utils/vibe_file_parser.dart:360— VibeFileParser._parsePngIsolate 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.
CloudSyncOperationStorage._validRecordIndex (cyclomatic 21) lib/data/cloud_sync/cloud_sync_operation_storage.dart:488— CloudSyncOperationStorage._validRecordIndex 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.
AiTagGallerySourceAdapter._fetchList (cyclomatic 21) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:178— AiTagGallerySourceAdapter._fetchList 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.
AiTagGenerationInfo.toJson (cyclomatic 21) lib/data/models/online_gallery/ai_tag_generation_info.dart:87— AiTagGenerationInfo.toJson 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.
CharacterCountResolver.getCountTag (cyclomatic 21) lib/data/services/character_count_resolver.dart:66— CharacterCountResolver.getCountTag 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.
TagToolbox._searchTags (cyclomatic 21) lib/presentation/agent_chat/services/tag_toolbox.dart:97— TagToolbox._searchTags 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.
OnlineGalleryBlacklistNotifier.pushToCloud (cyclomatic 21) lib/presentation/providers/online_gallery_blacklist_provider.dart:418— OnlineGalleryBlacklistNotifier.pushToCloud 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.
SubscriptionNotifier.build (cyclomatic 21) lib/presentation/providers/subscription_provider.dart:52— SubscriptionNotifier.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.
OnlineGalleryGrid.build (cyclomatic 21) lib/presentation/screens/online_gallery/online_gallery_grid.dart:87— OnlineGalleryGrid.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.
_VibeLibraryContentViewState._sendEntryToGenerationWithParams (cyclomatic 21) lib/presentation/screens/vibe_library/widgets/vibe_library_content_view.dart:455— _VibeLibraryContentViewState._sendEntryToGenerationWithParams 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.
WatermarkEditorControls.build (cyclomatic 21) lib/presentation/screens/watermark/watermark_editor_controls.dart:38— WatermarkEditorControls.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.
ImageCardActionCatalog.build (cyclomatic 21) lib/presentation/widgets/common/image_card_actions.dart:56— ImageCardActionCatalog.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.
acceptance_report._manual_evidence_from_args (cyclomatic 21) krita_plugin/acceptance_report.py:477— acceptance_report._manual_evidence_from_args 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.
ThreeWayMerger.merge (cyclomatic 20) lib/core/cloud_sync/merge.dart:58— ThreeWayMerger.merge 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.
EditorCompressionPlan.resolve (cyclomatic 20) lib/core/utils/editor_compression_utils.dart:80— EditorCompressionPlan.resolve 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.
PngShareSource.parse (cyclomatic 20) lib/core/utils/png_share_source.dart:12— PngShareSource.parse 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.
PromptEditDocument.emphasisRanges (cyclomatic 20) lib/core/utils/prompt_edit_document.dart:240— PromptEditDocument.emphasisRanges 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.
VibeFileParser._extractBundleFromPngIsolate (cyclomatic 20) lib/core/utils/vibe_file_parser.dart:224— VibeFileParser._extractBundleFromPngIsolate 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.
VibeImageEmbedder._extractEncodingFromVibe (cyclomatic 20) lib/core/utils/vibe_image_embedder.dart:755— VibeImageEmbedder._extractEncodingFromVibe 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.
WatermarkRenderService.render (cyclomatic 20) lib/core/watermark/watermark_render_service.dart:107— WatermarkRenderService.render 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.
VerifiedBlobStore.putStream (cyclomatic 20) lib/data/cloud_sync/verified_blob_store.dart:62— VerifiedBlobStore.putStream 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.
AiTagGallerySourceAdapter._parseMetadata (cyclomatic 20) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:471— AiTagGallerySourceAdapter._parseMetadata 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.
OnlineGalleryLocalFavoritesRepository._migrateQuickTagCloudFavorites (cyclomatic 20) lib/data/repositories/online_gallery_local_favorites_repository.dart:374— OnlineGalleryLocalFavoritesRepository._migrateQuickTagCloudFavorites 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.
AuthState.parseError (cyclomatic 20) lib/data/services/auth_provider.dart:152— AuthState.parseError 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.
LocalOnnxModelService._inferKind (cyclomatic 20) lib/data/services/local_onnx_model_service.dart:597— LocalOnnxModelService._inferKind 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.
AiTagGenerationParser.parse (cyclomatic 20) lib/data/services/metadata/ai_tag_generation_parser.dart:13— AiTagGenerationParser.parse 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.
MetadataWorkerPool._initializeWorkers (cyclomatic 20) lib/data/services/metadata/metadata_worker_pool.dart:63— MetadataWorkerPool._initializeWorkers 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.
QuickTagCloudParser.normalizeImages (cyclomatic 20) lib/data/services/online_gallery/quick_tag_cloud_parser.dart:450— QuickTagCloudParser.normalizeImages 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.
AgentImagePresentationService.present (cyclomatic 20) lib/presentation/agent_chat/services/image_presentation_toolbox.dart:40— AgentImagePresentationService.present 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.
AgentChatPanelCoordinator._send (cyclomatic 20) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:124— AgentChatPanelCoordinator._send 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.
_AgentChatWorkTrailState.build (cyclomatic 20) lib/presentation/agent_chat/widgets/agent_chat_turn.dart:379— _AgentChatWorkTrailState.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.
PromptAssistantService._detectImageMime (cyclomatic 20) lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:687— PromptAssistantService._detectImageMime 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.
FixedTagsNotifier.restoreUsageSnapshot (cyclomatic 20) lib/presentation/providers/fixed_tags_provider.dart:626— FixedTagsNotifier.restoreUsageSnapshot 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.
GenerationImageBatchActions._packSelectedImages (cyclomatic 20) lib/presentation/screens/generation/services/generation_image_batch_actions.dart:83— GenerationImageBatchActions._packSelectedImages 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.
LocalGalleryActionCoordinator.packSelectedImages (cyclomatic 20) lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:260— LocalGalleryActionCoordinator.packSelectedImages 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. This is NOT this file's highest cyclomatic complexity: LocalGalleryActionCoordinator.routeImageAction (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.
AssistantTaskThinkingField.build (cyclomatic 20) lib/presentation/screens/settings/widgets/assistant_task_thinking_field.dart:24— AssistantTaskThinkingField.build 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.
_HeatmapChartState.build (cyclomatic 20) lib/presentation/screens/statistics/widgets/charts/heatmap_chart.dart:94— _HeatmapChartState.build 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.
_VibeExportDialogAdvancedState._export (cyclomatic 20) lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:429— _VibeExportDialogAdvancedState._export 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.
UpdateCheckDialog._buildActions (cyclomatic 20) lib/presentation/widgets/common/update_check_dialog.dart:682— UpdateCheckDialog._buildActions 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.
_GalleryCategoryTreeViewState._buildCategoryNode (cyclomatic 20) lib/presentation/widgets/gallery/gallery_category_tree_view.dart:191— _GalleryCategoryTreeViewState._buildCategoryNode 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.
EditorSessionInitializer._loadInitialImage (cyclomatic 20) lib/presentation/widgets/image_editor/controllers/editor_session_initializer.dart:97— EditorSessionInitializer._loadInitialImage 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.
_Model3dEditorScreenState.build (cyclomatic 20) lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:389— _Model3dEditorScreenState.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.
_GalleryDetailActionRailState._entries (cyclomatic 20) lib/presentation/widgets/online_gallery/gallery_detail_action_rail.dart:67— _GalleryDetailActionRailState._entries 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.
QueueTaskDetailView.build (cyclomatic 20) lib/presentation/widgets/queue/task_list_item.dart:799— QueueTaskDetailView.build 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.
AgentProfileService.previewImport (cyclomatic 19) lib/core/agent/agent_profile_service.dart:35— AgentProfileService.previewImport 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.
DanbooruCompletionSource.search (cyclomatic 19) lib/core/autocomplete/danbooru_completion_source.dart:46— DanbooruCompletionSource.search 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.
SnapshotManifest.SnapshotManifest (cyclomatic 19) lib/core/cloud_sync/models.dart:128— SnapshotManifest.SnapshotManifest 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.
PromptTokenCounterService._normalizePromptForCounting (cyclomatic 19) lib/core/services/prompt_token_counter_service.dart:185— PromptTokenCounterService._normalizePromptForCounting 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.
InpaintMaskUtils.prepareNovelAiInpaintMaskArtifacts (cyclomatic 19) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:755— InpaintMaskUtils.prepareNovelAiInpaintMaskArtifacts 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.
NovelAiVibeCodec._imageMimeType (cyclomatic 19) lib/core/utils/novelai_vibe_codec.dart:288— NovelAiVibeCodec._imageMimeType 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.
AiTagGallerySourceAdapter.detail (cyclomatic 19) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:304— AiTagGallerySourceAdapter.detail 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.
AiTagGenerationInfo.hasAnyParam (cyclomatic 19) lib/data/models/online_gallery/ai_tag_generation_info.dart:62— AiTagGenerationInfo.hasAnyParam 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.
DanbooruAuth._loadSavedCredentials (cyclomatic 19) lib/data/services/danbooru_auth_service.dart:144— DanbooruAuth._loadSavedCredentials 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.
FilterCriteria.copyWith (cyclomatic 19) lib/data/services/gallery/gallery_filter_service.dart:72— FilterCriteria.copyWith 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.
ArtistChainParser._parseRange (cyclomatic 19) lib/data/services/online_gallery/artist_chain_parser.dart:96— ArtistChainParser._parseRange 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.
VibeImportService._importParsedSources (cyclomatic 19) lib/data/services/vibe_import_service.dart:307— VibeImportService._importParsedSources 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.
_AgentChatSessionPickerBodyState.build (cyclomatic 19) lib/presentation/agent_chat/widgets/agent_chat_session_picker.dart:232— _AgentChatSessionPickerBodyState.build 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.
_WorkItemGroupTileState.build (cyclomatic 19) lib/presentation/agent_chat/widgets/agent_chat_turn.dart:644— _WorkItemGroupTileState.build 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.
_PromptAssistantOverlayState._runAction (cyclomatic 19) lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart:242— _PromptAssistantOverlayState._runAction 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.
KritaBridgeService._generateImage (cyclomatic 19) lib/presentation/providers/krita/krita_bridge_service.dart:354— KritaBridgeService._generateImage 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.
VibeImportHandler.saveToLibrary (cyclomatic 19) lib/presentation/screens/generation/handlers/vibe_import_handler.dart:355— VibeImportHandler.saveToLibrary 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.
_OnlineGalleryToolbarPresenter._buildPrimaryActions (cyclomatic 19) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart:659— _OnlineGalleryToolbarPresenter._buildPrimaryActions 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.
_WebAccessSettingsState.build (cyclomatic 19) lib/presentation/screens/settings/sections/web_access_settings.dart:49— _WebAccessSettingsState.build 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.
VibeDetailParamPanel._buildActionBar (cyclomatic 19) lib/presentation/screens/vibe_library/widgets/vibe_detail/vibe_detail_param_panel.dart:400— VibeDetailParamPanel._buildActionBar 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.
VibeExportAdvancedExecutor.resolveEntryVibes (cyclomatic 19) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_advanced_executor.dart:286— VibeExportAdvancedExecutor.resolveEntryVibes 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.
_VibeLibraryContentViewState._sendEntryToGeneration (cyclomatic 19) lib/presentation/screens/vibe_library/widgets/vibe_library_content_view.dart:308— _VibeLibraryContentViewState._sendEntryToGeneration 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.
CompletionOverlayHeader.build (cyclomatic 19) lib/presentation/widgets/autocomplete/completion_overlay_header.dart:27— CompletionOverlayHeader.build 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.
InpaintMaskActionsController.fillClosedMaskRegionsAt (cyclomatic 19) lib/presentation/widgets/image_editor/controllers/inpaint_mask_actions_controller.dart:38— InpaintMaskActionsController.fillClosedMaskRegionsAt 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.
GalleryDetailInfoPanel._buildCodexOverview (cyclomatic 19) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:565— GalleryDetailInfoPanel._buildCodexOverview 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.
OnlineGalleryCardStatusOverlays.build (cyclomatic 19) lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:25— OnlineGalleryCardStatusOverlays.build 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.
UnifiedPromptConfig.== (cyclomatic 19) lib/presentation/widgets/prompt/unified/unified_prompt_config.dart:227— UnifiedPromptConfig.== 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.
main::(anonymous)::blur (cyclomatic 19) tool/diagnostics/nai_inpaint_parity_browser.cjs:377— main::(anonymous)::blur 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.
BashHarnessTool.executeWithContext (cyclomatic 18) lib/core/agent/harness/tools/bash.dart:93— BashHarnessTool.executeWithContext 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.
ComfyUIWebSocketService._handleJsonMessage (cyclomatic 18) lib/core/comfyui/comfyui_websocket_service.dart:105— ComfyUIWebSocketService._handleJsonMessage 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.
PixelSnapEngine._selectPitch (cyclomatic 18) lib/core/services/pixel_snap/pixel_snap_engine.dart:188— PixelSnapEngine._selectPitch 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.
InpaintMaskGeometry.expandBinary (cyclomatic 18) lib/core/utils/inpaint_mask/inpaint_mask_geometry.dart:138— InpaintMaskGeometry.expandBinary 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.
OutpaintResolvedGeometry.== (cyclomatic 18) lib/core/utils/inpaint_outpaint_utils.dart:147— OutpaintResolvedGeometry.== 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.
InpaintOutpaintUtils.materializeVirtualFrame (cyclomatic 18) lib/core/utils/inpaint_outpaint_utils.dart:509— InpaintOutpaintUtils.materializeVirtualFrame 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.
VibeLibraryCloudSyncAdapter.validateRecord (cyclomatic 18) lib/data/cloud_sync/vibe_library_cloud_sync_adapter.dart:106— VibeLibraryCloudSyncAdapter.validateRecord 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.
GalleryPromptCopyProjection.buildText (cyclomatic 18) lib/data/models/online_gallery/gallery_prompt_projection.dart:123— GalleryPromptCopyProjection.buildText 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.
TagLibraryEntry.promptTagCount (cyclomatic 18) lib/data/models/tag_library/tag_library_entry.dart:118— TagLibraryEntry.promptTagCount 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.
OnlineGalleryBlacklistRepository._isValidV2 (cyclomatic 18) lib/data/repositories/online_gallery_blacklist_repository.dart:80— OnlineGalleryBlacklistRepository._isValidV2 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.
GalleryStreamScanner.startScanning (cyclomatic 18) lib/data/services/gallery/gallery_stream_scanner.dart:173— GalleryStreamScanner.startScanning 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.
LocalOnnxModelService.importTaggerFiles (cyclomatic 18) lib/data/services/local_onnx_model_service.dart:231— LocalOnnxModelService.importTaggerFiles 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.
ComfyUiParser.parse (cyclomatic 18) lib/data/services/metadata/metadata_text_decoder.dart:507— ComfyUiParser.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.
OnlineGallerySearchService.buildPlan (cyclomatic 18) lib/data/services/online_gallery/online_gallery_search_service.dart:36— OnlineGallerySearchService.buildPlan 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.
RandomPromptGenerator._generateFromPoolGroup (cyclomatic 18) lib/data/services/random_prompt_generator.dart:712— RandomPromptGenerator._generateFromPoolGroup 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.
VibeFileDocumentCodec._findStableVibeIndex (cyclomatic 18) lib/data/services/vibe_file_document_codec.dart:94— VibeFileDocumentCodec._findStableVibeIndex 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.
VibeLibraryEntryWriter.updateEncodingModel (cyclomatic 18) lib/data/services/vibe_library_entry_writer.dart:162— VibeLibraryEntryWriter.updateEncodingModel 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.
GenerationQueueTaskService.queueTask (cyclomatic 18) lib/presentation/agent_chat/services/generation_queue_task_service.dart:20— GenerationQueueTaskService.queueTask 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.
_AgentChatToolResultTileState.build (cyclomatic 18) lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart:147— _AgentChatToolResultTileState.build 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.
AssistantModelCatalog.resolveProvider (cyclomatic 18) lib/presentation/prompt_assistant/models/assistant_model_capability.dart:198— AssistantModelCatalog.resolveProvider 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.
_ProviderQueue._execute (cyclomatic 18) lib/presentation/prompt_assistant/services/assistant_request_scheduler.dart:117— _ProviderQueue._execute 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.
MobileCollapsedPromptLauncher.build (cyclomatic 18) lib/presentation/screens/generation/mobile_generation_workspace.dart:225— MobileCollapsedPromptLauncher.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.
_PreciseReferencePanelState.build (cyclomatic 18) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:59— _PreciseReferencePanelState.build 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.
OnlineGallerySelectionActions._buildReplicationTask (cyclomatic 18) lib/presentation/screens/online_gallery/online_gallery_selection_actions.dart:100— OnlineGallerySelectionActions._buildReplicationTask 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.
_PreciseRefLibraryScreenState._importImages (cyclomatic 18) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:108— _PreciseRefLibraryScreenState._importImages 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.
_ComfyUISettingsSectionState.build (cyclomatic 18) lib/presentation/screens/settings/sections/comfyui_settings_section.dart:37— _ComfyUISettingsSectionState.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.
_GenerationSettingsSectionState.build (cyclomatic 18) lib/presentation/screens/settings/sections/generation_settings_section.dart:115— _GenerationSettingsSectionState.build 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.
_AnimatedRefreshButtonState.build (cyclomatic 18) lib/presentation/screens/statistics/widgets/dashboard/animated_refresh_button.dart:54— _AnimatedRefreshButtonState.build 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.
_CategoryItemState.build (cyclomatic 18) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:359— _CategoryItemState.build 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.
VibeImportController.importDrop (cyclomatic 18) lib/presentation/screens/vibe_library/vibe_import_controller.dart:150— VibeImportController.importDrop 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.
_Toolbar.build (cyclomatic 18) lib/presentation/screens/vibe_library/vibe_library_workspace.dart:286— _Toolbar.build 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.
GenerationTransferConfiguration._resolveModel (cyclomatic 18) lib/presentation/services/generation_prompt_transfer_service.dart:144— GenerationTransferConfiguration._resolveModel 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.
_CredentialsLoginFormState.build (cyclomatic 18) lib/presentation/widgets/auth/credentials_login_form.dart:50— _CredentialsLoginFormState.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.
_AutocompleteWrapperState._onTextChanged (cyclomatic 18) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:281— _AutocompleteWrapperState._onTextChanged 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.
_AutocompleteWrapperState._onCompletionStateChanged (cyclomatic 18) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:449— _AutocompleteWrapperState._onCompletionStateChanged 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.
_ActionButton.build (cyclomatic 18) lib/presentation/widgets/bulk_action_bar.dart:381— _ActionButton.build 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.
_DiscordShareDialogState._send (cyclomatic 18) lib/presentation/widgets/discord_share/discord_share_dialog.dart:343— _DiscordShareDialogState._send 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.
_GalleryAlbumTreeViewState._buildAlbumContent (cyclomatic 18) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:189— _GalleryAlbumTreeViewState._buildAlbumContent 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.
InputHandler.handlePointerDown (cyclomatic 18) lib/presentation/widgets/image_editor/core/input_handler.dart:371— InputHandler.handlePointerDown 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.
FixedTagsDialogView.build (cyclomatic 18) lib/presentation/widgets/prompt/fixed_tags_dialog_view.dart:26— FixedTagsDialogView.build 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.
PromptWeightEditing._partialTarget (cyclomatic 18) lib/presentation/widgets/prompt/prompt_weight_editing.dart:241— PromptWeightEditing._partialTarget 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.
_TaskListItemState._buildActionButtons (cyclomatic 18) lib/presentation/widgets/queue/task_list_item.dart:440— _TaskListItemState._buildActionButtons 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.
CooccurrenceDataPackService._initialize (cyclomatic 17) lib/core/autocomplete/cooccurrence_data_pack_service.dart:71— CooccurrenceDataPackService._initialize 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.
TagCatalogRepository.search (cyclomatic 17) lib/core/autocomplete/tag_catalog_repository.dart:47— TagCatalogRepository.search 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.
GitHubBackendSupport.throwResponse (cyclomatic 17) lib/core/cloud_sync/backend/github_backend_support.dart:40— GitHubBackendSupport.throwResponse 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.
OneDriveApiClient._decodeItem (cyclomatic 17) lib/core/cloud_sync/backend/onedrive_api_client.dart:520— OneDriveApiClient._decodeItem 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.
McpStreamableHttpTransport._handlePost (cyclomatic 17) lib/core/mcp/mcp_streamable_http_transport.dart:114— McpStreamableHttpTransport._handlePost 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.
OnlineGalleryRetryInterceptor._isRetriableError (cyclomatic 17) lib/core/network/online_gallery_retry_interceptor.dart:146— OnlineGalleryRetryInterceptor._isRetriableError 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.
InpaintMaskUtils.fillEditorMaskRegionAtPoint (cyclomatic 17) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:482— InpaintMaskUtils.fillEditorMaskRegionAtPoint has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PromptLiteralScanner._angleEnd (cyclomatic 17) lib/core/utils/prompt_literal_scanner.dart:49— PromptLiteralScanner._angleEnd 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.
CloudSyncOperationStorage.readSnapshot (cyclomatic 17) lib/data/cloud_sync/cloud_sync_operation_storage.dart:125— CloudSyncOperationStorage.readSnapshot 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.
NaiGenerationTransport.buildGenerationMultipart (cyclomatic 17) lib/data/datasources/remote/nai_generation_transport.dart:154— NaiGenerationTransport.buildGenerationMultipart 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.
LocalGalleryRepository.loadRecords (cyclomatic 17) lib/data/services/gallery/local_gallery_repository.dart:87— LocalGalleryRepository.loadRecords 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.
OnnxTaggerLabelFiles._parseVocabularyLabels (cyclomatic 17) lib/data/services/local_onnx_tagger_labels.dart:302— OnnxTaggerLabelFiles._parseVocabularyLabels 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.
AiTagGenerationParser._parseNaiJson (cyclomatic 17) lib/data/services/metadata/ai_tag_generation_parser.dart:407— AiTagGenerationParser._parseNaiJson 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.
AiTagGenerationParser._buildNaiInfo (cyclomatic 17) lib/data/services/metadata/ai_tag_generation_parser.dart:478— AiTagGenerationParser._buildNaiInfo 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.
ImageMetadataContainerCodec._scanValidatedPngChunks (cyclomatic 17) lib/data/services/metadata/image_metadata_container_codec.dart:356— ImageMetadataContainerCodec._scanValidatedPngChunks 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.
NaiCommentComposer._fieldsComment (cyclomatic 17) lib/data/services/metadata/nai_comment_composer.dart:52— NaiCommentComposer._fieldsComment 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.
TagLibraryPortableThumbnailStore.stage (cyclomatic 17) lib/data/services/tag_library_portable_thumbnail_store.dart:47— TagLibraryPortableThumbnailStore.stage 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.
VibeFolderSync.syncFolderToHive (cyclomatic 17) lib/data/services/vibe_folder_sync.dart:20— VibeFolderSync.syncFolderToHive 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.
MetadataFilterCriteria.matches (cyclomatic 17) lib/domain/entities/gallery_image_entity.dart:248— MetadataFilterCriteria.matches 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.
GenerationImageFavoriteToolbox.setFavorite (cyclomatic 17) lib/presentation/agent_chat/services/generation_image_favorite_toolbox.dart:80— GenerationImageFavoriteToolbox.setFavorite 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.
GenerationImageWorkflowService.open (cyclomatic 17) lib/presentation/agent_chat/services/generation_image_workflow_service.dart:73— GenerationImageWorkflowService.open has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
McpImageResponseService._displayReferences (cyclomatic 17) lib/presentation/mcp/services/mcp_image_response_service.dart:310— McpImageResponseService._displayReferences 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.
AssistantModelMetadata._nativeEffort (cyclomatic 17) lib/presentation/prompt_assistant/models/assistant_model_capability.dart:122— AssistantModelMetadata._nativeEffort 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.
OpenAiChatCompletionsAdapter._completeAgentNonStream (cyclomatic 17) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:288— OpenAiChatCompletionsAdapter._completeAgentNonStream 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.
OnlineGalleryBlacklistNotifier._syncIncrementally (cyclomatic 17) lib/presentation/providers/online_gallery_blacklist_provider.dart:714— OnlineGalleryBlacklistNotifier._syncIncrementally 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.
OnlineGalleryNotifier.goToPage (cyclomatic 17) lib/presentation/providers/online_gallery_provider.dart:532— OnlineGalleryNotifier.goToPage 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.
QueueExecutionNotifier._onGenerationStateChanged (cyclomatic 17) lib/presentation/providers/queue_execution_provider.dart:584— QueueExecutionNotifier._onGenerationStateChanged 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.
RandomPresetNotifier._loadPresets (cyclomatic 17) lib/presentation/providers/random_preset_provider.dart:115— RandomPresetNotifier._loadPresets 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.
SubscriptionNotifier._doFetchSubscription (cyclomatic 17) lib/presentation/providers/subscription_provider.dart:374— SubscriptionNotifier._doFetchSubscription 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.
DlssRuntimeCard.build (cyclomatic 17) lib/presentation/screens/dlss/dlss_runtime_card.dart:22— DlssRuntimeCard.build 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.
GenerateButtonWithCost._buildPrimaryButton (cyclomatic 17) lib/presentation/screens/generation/widgets/generation_controls/generate_button.dart:111— GenerateButtonWithCost._buildPrimaryButton 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.
OnlineGalleryScrollPrefetchCoordinator.onScroll (cyclomatic 17) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:94— OnlineGalleryScrollPrefetchCoordinator.onScroll 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.
OnlineGalleryRatingDropdown.build (cyclomatic 17) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar.dart:692— OnlineGalleryRatingDropdown.build 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.
_PreciseRefLibraryScreenState.build (cyclomatic 17) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:589— _PreciseRefLibraryScreenState.build 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.
_StackedAreaChartState._buildChartData (cyclomatic 17) lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.dart:127— _StackedAreaChartState._buildChartData 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.
_EntryListItemState.build (cyclomatic 17) lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:64— _EntryListItemState.build 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.
VibeExportEmbedImageOptionCard.build (cyclomatic 17) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_embed_and_encoding_sections.dart:40— VibeExportEmbedImageOptionCard.build 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.
DroppedFileReader._resolve (cyclomatic 17) lib/presentation/utils/dropped_file_reader.dart:95— DroppedFileReader._resolve 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.
_CardDragSourceState._prepareSession (cyclomatic 17) lib/presentation/widgets/common/card_drag_source.dart:98— _CardDragSourceState._prepareSession 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.
UpdateNoticeBanner.build (cyclomatic 17) lib/presentation/widgets/common/update_notice_banner.dart:42— UpdateNoticeBanner.build 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.
EditorCanvasResizeController.changeCanvasSize (cyclomatic 17) lib/presentation/widgets/image_editor/controllers/editor_canvas_resize_controller.dart:40— EditorCanvasResizeController.changeCanvasSize 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.
_FillRequest.floodFill (cyclomatic 17) lib/presentation/widgets/image_editor/tools/fill_tool.dart:201— _FillRequest.floodFill 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.
TagEditorSession.replaceLabel (cyclomatic 17) lib/presentation/widgets/prompt/tag_editor_session.dart:412— TagEditorSession.replaceLabel 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.
TagEditorSession.moveSelectedBefore (cyclomatic 17) lib/presentation/widgets/prompt/tag_editor_session.dart:536— TagEditorSession.moveSelectedBefore 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.
_TaskEditDialogState._buildParametersSection (cyclomatic 17) lib/presentation/widgets/queue/task_edit_dialog.dart:238— _TaskEditDialogState._buildParametersSection 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.
_ShortcutBindingEditorState._processKeyCombination (cyclomatic 17) lib/presentation/widgets/shortcuts/shortcut_binding_editor.dart:364— _ShortcutBindingEditorState._processKeyCombination 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.
OleDataInspector.CaptureHBitmap (cyclomatic 16) tool/ole_drag_inspector/windows/Program.cs:1172— OleDataInspector.CaptureHBitmap 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.
CooccurrenceManifestCodec.parse (cyclomatic 16) lib/core/autocomplete/cooccurrence_manifest_codec.dart:51— CooccurrenceManifestCodec.parse 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.
ZhDictionaryService.installOrUpdate (cyclomatic 16) lib/core/autocomplete/zh_dictionary_service.dart:137— ZhDictionaryService.installOrUpdate 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.
LocalGalleryThumbnailMigration._isVerifiedLegacyThumbnail (cyclomatic 16) lib/core/cache/local_gallery_thumbnail_migration.dart:204— LocalGalleryThumbnailMigration._isVerifiedLegacyThumbnail 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.
GoogleDriveCloudSyncBackend._fetchInventory (cyclomatic 16) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:584— GoogleDriveCloudSyncBackend._fetchInventory 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.
CloudDriveOAuthSession.fromJson (cyclomatic 16) lib/core/cloud_sync/oauth/cloud_drive_oauth_models.dart:93— CloudDriveOAuthSession.fromJson 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.
GalleryExceptionConverter.convert (cyclomatic 16) lib/core/exceptions/gallery_exceptions.dart:231— GalleryExceptionConverter.convert 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.
SafeWebReader.read (cyclomatic 16) lib/core/network/web_access/safe_web_reader.dart:38— SafeWebReader.read 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.
SearxngSearchClient.search (cyclomatic 16) lib/core/network/web_access/searxng_search_client.dart:13— SearxngSearchClient.search 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.
DibBitmapCodec.toBmpFile (cyclomatic 16) lib/core/utils/dib_bitmap_codec.dart:25— DibBitmapCodec.toBmpFile 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.
TextSpaceConverter.convert (cyclomatic 16) lib/core/utils/text_space_converter.dart:25— TextSpaceConverter.convert 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.
AgentSystemPromptCloudSyncAdapter.validateRecord (cyclomatic 16) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:55— AgentSystemPromptCloudSyncAdapter.validateRecord 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.
AgentSkillsCloudSyncAdapter._prepareRestorePlans (cyclomatic 16) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:338— AgentSkillsCloudSyncAdapter._prepareRestorePlans 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.
NAIAuthApiService.validateToken (cyclomatic 16) lib/data/datasources/remote/nai_auth_api_service.dart:56— NAIAuthApiService.validateToken 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.
NaiImageMetadataRawDecoder.decode (cyclomatic 16) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:17— NaiImageMetadataRawDecoder.decode 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.
NaiImageMetadataRawDecoder._modelIdFromSourceText (cyclomatic 16) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:975— NaiImageMetadataRawDecoder._modelIdFromSourceText 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.
PromptAssistantConfigState.decode (cyclomatic 16) lib/data/models/prompt_assistant/prompt_assistant_models.dart:1225— PromptAssistantConfigState.decode 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.
LocalGalleryQuery.applyFilter (cyclomatic 16) lib/data/services/gallery/local_gallery_query.dart:114— LocalGalleryQuery.applyFilter 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.
_OfficialRecipeEngine._dressInSeparates (cyclomatic 16) lib/data/services/official_random_prompt_generator.dart:884— _OfficialRecipeEngine._dressInSeparates 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.
CharacterTagGenerator.generate (cyclomatic 16) lib/data/services/strategies/character_tag_generator.dart:80— CharacterTagGenerator.generate 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.
AgentChatPanelCoordinator._editUserMessage (cyclomatic 16) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:315— AgentChatPanelCoordinator._editUserMessage 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.
McpImageResponseService._imageContent (cyclomatic 16) lib/presentation/mcp/services/mcp_image_response_service.dart:216— McpImageResponseService._imageContent 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.
ImageWorkflowState.copyWith (cyclomatic 16) lib/presentation/providers/generation/image_workflow_models.dart:370— ImageWorkflowState.copyWith 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.
KritaBridgeNotifier.enable (cyclomatic 16) lib/presentation/providers/krita/krita_bridge_notifier.dart:207— KritaBridgeNotifier.enable 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.
ReversePromptNotifier.runChain (cyclomatic 16) lib/presentation/providers/reverse_prompt_provider.dart:368— ReversePromptNotifier.runChain 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.
VibeImportHandler.importFromLibrary (cyclomatic 16) lib/presentation/screens/generation/handlers/vibe_import_handler.dart:179— VibeImportHandler.importFromLibrary 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.
OnlineGalleryPagination._buildBar (cyclomatic 16) lib/presentation/screens/online_gallery/online_gallery_pagination.dart:35— OnlineGalleryPagination._buildBar 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.
OnlineGalleryToolbarSearch._buildSearchFields (cyclomatic 16) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:130— OnlineGalleryToolbarSearch._buildSearchFields 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.
_AgentSystemPromptEditorState.build (cyclomatic 16) lib/presentation/screens/settings/sections/agent/system_prompt_editor.dart:54— _AgentSystemPromptEditorState.build 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.
_ProviderModelListState.build (cyclomatic 16) lib/presentation/screens/settings/sections/model_services/provider_models_card.dart:144— _ProviderModelListState.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.
_ZhDictionaryStatus.build (cyclomatic 16) lib/presentation/screens/settings/widgets/data_source_cache_settings.dart:463— _ZhDictionaryStatus.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.
_TagLibraryPageScreenState.build (cyclomatic 16) lib/presentation/screens/tag_library_page/tag_library_page_screen.dart:93— _TagLibraryPageScreenState.build 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.
_EntryListItemState._buildActions (cyclomatic 16) lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:316— _EntryListItemState._buildActions 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.
VibeImportController._encodeImage (cyclomatic 16) lib/presentation/screens/vibe_library/vibe_import_controller.dart:473— VibeImportController._encodeImage 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.
VibeExportOptionCard.build (cyclomatic 16) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:27— VibeExportOptionCard.build 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.
GenerationHistoryStorageService._decodeRecord (cyclomatic 16) lib/presentation/services/generation_history_storage_service.dart:165— GenerationHistoryStorageService._decodeRecord 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.
MetadataImportApplier.applyPromptAndGenerationParams (cyclomatic 16) lib/presentation/utils/metadata_import_applier.dart:54— MetadataImportApplier.applyPromptAndGenerationParams 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.
AutocompleteUtils._parseCurrentTagSegment (cyclomatic 16) lib/presentation/widgets/autocomplete/autocomplete_utils.dart:161— AutocompleteUtils._parseCurrentTagSegment 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.
AppStateView.build (cyclomatic 16) lib/presentation/widgets/common/app_state_view.dart:49— AppStateView.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.
_ThumbnailItemState.build (cyclomatic 16) lib/presentation/widgets/common/image_detail/components/detail_thumbnail_bar.dart:106— _ThumbnailItemState.build 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.
_HoverPreviewCardInnerState.build (cyclomatic 16) lib/presentation/widgets/danbooru_post_card.dart:979— _HoverPreviewCardInnerState.build 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.
_PromptLibraryEntryDialogState.build (cyclomatic 16) lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:208— _PromptLibraryEntryDialogState.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.
_PromptLibraryEntryDialogState._save (cyclomatic 16) lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:508— _PromptLibraryEntryDialogState._save 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.
_GelbooruCredentialsDialogState.build (cyclomatic 16) lib/presentation/widgets/gelbooru_credentials_dialog.dart:115— _GelbooruCredentialsDialogState.build 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.
EditorExitCoordinator.exportAndClose (cyclomatic 16) lib/presentation/widgets/image_editor/controllers/editor_exit_coordinator.dart:70— EditorExitCoordinator.exportAndClose 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.
KeyboardState.updateFromEvent (cyclomatic 16) lib/presentation/widgets/image_editor/core/input_handler.dart:24— KeyboardState.updateFromEvent 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: InputHandler.getCursor (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.
GalleryDetailInfoPanel._buildItemBadges (cyclomatic 16) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:282— GalleryDetailInfoPanel._buildItemBadges 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.
NaiSyntaxController._applyComposingUnderline (cyclomatic 16) lib/presentation/widgets/prompt/nai_syntax_controller.dart:183— NaiSyntaxController._applyComposingUnderline 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.
PromptEditorToolbar.build (cyclomatic 16) lib/presentation/widgets/prompt/toolbar/prompt_editor_toolbar.dart:83— PromptEditorToolbar.build 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.
TodoComment lib/presentation/widgets/prompt/unified/prompt_search_utils.dart:92— /// TODO(用户实现):见下方说明,可选择保持原样、收敛空标签,或整体格式化。 — 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.
ImageGenerationCoordinator.execute (cognitive 236) lib/presentation/providers/generation/image_generation_coordinator.dart:81— ImageGenerationCoordinator.execute has cognitive complexity 236 (threshold 15). Drivers by points: if/else 29 (149 pts), loops 6 (36 pts), ternaries 5 (23 pts), error handling 4 (22 pts), boolean chains 6 (nesting depth added 186). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OnlineGalleryPaginationService.load (cognitive 192) lib/presentation/providers/online_gallery_pagination_service.dart:90— OnlineGalleryPaginationService.load has cognitive complexity 192 (threshold 15). Drivers by points: ternaries 36 (86 pts), if/else 25 (67 pts), boolean chains 31, loops 2 (6 pts), error handling 2 (nesting depth added 96). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OnlineGalleryFavoritesLoaderService.load (cognitive 145) lib/presentation/providers/online_gallery_favorites_loader_service.dart:89— OnlineGalleryFavoritesLoaderService.load has cognitive complexity 145 (threshold 15). Drivers by points: if/else 22 (57 pts), ternaries 29 (56 pts), boolean chains 19, error handling 4 (10 pts), loops 1 (3 pts) (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeminiGenerateContentAdapter.completeAgent (cognitive 126) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:71— GeminiGenerateContentAdapter.completeAgent has cognitive complexity 126 (threshold 15). Drivers by points: if/else 22 (60 pts), ternaries 7 (44 pts), boolean chains 9, loops 3 (8 pts), match/switch 1 (4 pts), error handling 1 (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.
OpenAiChatCompletionsAdapter.completeAgent (cognitive 125) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:97— OpenAiChatCompletionsAdapter.completeAgent has cognitive complexity 125 (threshold 15). Drivers by points: if/else 31 (100 pts), loops 4 (13 pts), boolean chains 11, error handling 1 (nesting depth added 78). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OnlineGalleryRandomLoaderService.load (cognitive 121) lib/presentation/providers/online_gallery_random_loader_service.dart:107— OnlineGalleryRandomLoaderService.load has cognitive complexity 121 (threshold 15). Drivers by points: if/else 23 (52 pts), boolean chains 35, ternaries 13 (29 pts), loops 1 (2 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_DanbooruPostCardState._buildCard (cognitive 97) lib/presentation/widgets/danbooru_post_card.dart:559— _DanbooruPostCardState._buildCard has cognitive complexity 97 (threshold 15). Drivers by points: if/else 25 (40 pts), ternaries 18 (36 pts), boolean chains 21 (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.
OpenAiResponsesAdapter.completeAgent (cognitive 95) lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:70— OpenAiResponsesAdapter.completeAgent has cognitive complexity 95 (threshold 15). Drivers by points: if/else 26 (65 pts), boolean chains 11, ternaries 3 (11 pts), loops 2 (6 pts), error handling 1, match/switch 1 (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.
nai_inpaint_parity_browser.main (cognitive 95) tool/diagnostics/nai_inpaint_parity_browser.cjs:161— nai_inpaint_parity_browser.main has cognitive complexity 95 (threshold 15). Drivers by points: loops 23 (48 pts), if/else 18 (43 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 51). Most of this is not in the body itself: 2 of the 95 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 299, 377, 354, …). 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.
PortableRecordCodec.decode (cognitive 94) lib/data/cloud_sync/portable_record_codec.dart:32— PortableRecordCodec.decode has cognitive complexity 94 (threshold 15). Drivers by points: if/else 18 (60 pts), boolean chains 22, loops 3 (8 pts), error handling 2 (4 pts) (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.
AgentChatEventController.handle (cognitive 89) lib/presentation/agent_chat/services/agent_chat_event_controller.dart:42— AgentChatEventController.handle has cognitive complexity 89 (threshold 15). Drivers by points: if/else 18 (37 pts), ternaries 12 (31 pts), boolean chains 9, loops 4 (9 pts), match/switch 2 (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.
AuthNotifier._restoreStoredSession (cognitive 86) lib/data/services/auth_provider.dart:289— AuthNotifier._restoreStoredSession has cognitive complexity 86 (threshold 15). Drivers by points: if/else 27 (70 pts), error handling 3 (7 pts), boolean chains 5, loops 2 (4 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.
GenerationPreparationService.prepareForKind (cognitive 83) lib/presentation/agent_chat/services/generation_preparation_service.dart:140— GenerationPreparationService.prepareForKind has cognitive complexity 83 (threshold 15). Drivers by points: if/else 29 (53 pts), error handling 6 (12 pts), ternaries 8 (12 pts), boolean chains 4, loops 2 (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.
GeminiGenerateContentAdapter._buildAgentPayload (cognitive 83) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:265— GeminiGenerateContentAdapter._buildAgentPayload has cognitive complexity 83 (threshold 15). Drivers by points: if/else 20 (52 pts), loops 6 (16 pts), boolean chains 8, match/switch 1 (4 pts), ternaries 1 (3 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageGenerationCoordinator._runRequest (cognitive 82) lib/presentation/providers/generation/image_generation_coordinator.dart:355— ImageGenerationCoordinator._runRequest has cognitive complexity 82 (threshold 15). Drivers by points: if/else 18 (64 pts), boolean chains 11, loops 2 (4 pts), error handling 1 (2 pts), ternaries 1 (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.
HiveStorageHelper._migrateFromOldLocation (cognitive 80) lib/core/utils/hive_storage_helper.dart:171— HiveStorageHelper._migrateFromOldLocation has cognitive complexity 80 (threshold 15). Drivers by points: if/else 18 (57 pts), error handling 3 (8 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpreadKernel._spread (cognitive 79) lib/core/services/pixel_snap/internal/spread_kernel.dart:29— SpreadKernel._spread has cognitive complexity 79 (threshold 15). Drivers by points: if/else 8 (32 pts), ternaries 6 (22 pts), loops 7 (20 pts), boolean chains 5 (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.
AnthropicMessagesAdapter.completeAgent (cognitive 78) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:63— AnthropicMessagesAdapter.completeAgent has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (57 pts), boolean chains 10, match/switch 2 (5 pts), loops 2 (3 pts), ternaries 1 (2 pts), error handling 1 (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.
OpenAiChatCompletionsAdapter._completeAgentNonStream (cognitive 78) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:288— OpenAiChatCompletionsAdapter._completeAgentNonStream has cognitive complexity 78 (threshold 15). Drivers by points: if/else 10 (50 pts), ternaries 2 (18 pts), loops 1 (7 pts), boolean chains 2, error handling 1 (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.
_OfficialRecipeEngine._furryCharacter (cognitive 73) lib/data/services/official_random_prompt_generator.dart:502— _OfficialRecipeEngine._furryCharacter has cognitive complexity 73 (threshold 15). Drivers by points: if/else 33 (49 pts), boolean chains 15, ternaries 5, loops 2, match/switch 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_DetailTopBarActions._buildActions (cognitive 72) lib/presentation/widgets/common/image_detail/components/detail_top_bar.dart:196— _DetailTopBarActions._buildActions has cognitive complexity 72 (threshold 15). Drivers by points: if/else 26 (41 pts), boolean chains 19, ternaries 5 (9 pts), match/switch 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.
GalleryDetailInfoPanel.build (cognitive 69) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:30— GalleryDetailInfoPanel.build has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 22, ternaries 10 (17 pts), loops 3 (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.
_QuickTagCloudToolbarState.build (cognitive 69) lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart:62— _QuickTagCloudToolbarState.build has cognitive complexity 69 (threshold 15). Drivers by points: if/else 20 (38 pts), ternaries 12 (15 pts), boolean chains 14, loops 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.
AgentChatNotifier._sendMessage (cognitive 68) lib/presentation/agent_chat/providers/agent_chat_notifier.dart:1143— AgentChatNotifier._sendMessage has cognitive complexity 68 (threshold 15). Drivers by points: if/else 24 (43 pts), loops 3 (9 pts), ternaries 3 (8 pts), boolean chains 6, error handling 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.
_VibeLibraryContentViewState._sendEntryToGenerationWithParams (cognitive 68) lib/presentation/screens/vibe_library/widgets/vibe_library_content_view.dart:455— _VibeLibraryContentViewState._sendEntryToGenerationWithParams has cognitive complexity 68 (threshold 15). Drivers by points: if/else 12 (39 pts), ternaries 5 (21 pts), boolean chains 4, error handling 1 (4 pts) (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SessionJsonlCodec.encode (cognitive 65) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:8— SessionJsonlCodec.encode has cognitive complexity 65 (threshold 15). Drivers by points: if/else 18 (46 pts), loops 6 (13 pts), match/switch 2 (6 pts) (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.
AgentChatMessages._messageTile (cognitive 65) lib/presentation/agent_chat/widgets/agent_chat_messages.dart:374— AgentChatMessages._messageTile has cognitive complexity 65 (threshold 15). Drivers by points: if/else 15 (27 pts), ternaries 8 (23 pts), boolean chains 8, loops 2 (7 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.
_Img2ImgUpscaleSectionState.build (cognitive 63) lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:99— _Img2ImgUpscaleSectionState.build has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (36 pts), ternaries 8 (18 pts), boolean chains 9 (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.
MetadataImportOptions.selectedCountFor (cognitive 62) lib/data/models/metadata/metadata_import_options.dart:166— MetadataImportOptions.selectedCountFor has cognitive complexity 62 (threshold 15). Drivers by points: boolean chains 41, if/else 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.
McpImageResponseService.prepare (cognitive 62) lib/presentation/mcp/services/mcp_image_response_service.dart:103— McpImageResponseService.prepare has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (43 pts), boolean chains 10, ternaries 2 (6 pts), loops 1 (2 pts), error handling 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.
VibeFileParser._extractBundleFromPngIsolate (cognitive 61) lib/core/utils/vibe_file_parser.dart:224— VibeFileParser._extractBundleFromPngIsolate has cognitive complexity 61 (threshold 15). Drivers by points: if/else 10 (41 pts), error handling 3 (8 pts), loops 2 (8 pts), boolean chains 4 (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.
GalleryStreamScanner._processSingleFile (cognitive 61) lib/data/services/gallery/gallery_stream_scanner.dart:463— GalleryStreamScanner._processSingleFile has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (34 pts), ternaries 7 (18 pts), boolean chains 8, error handling 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.
ContiguousRegionSelector.selectRgba (cognitive 60) lib/core/utils/contiguous_region_selector.dart:46— ContiguousRegionSelector.selectRgba has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 17, loops 8 (17 pts), 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.
_MetadataImportDialogState._buildPromptSection (cognitive 60) lib/presentation/widgets/metadata/metadata_import_dialog.dart:264— _MetadataImportDialogState._buildPromptSection has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (36 pts), ternaries 6 (18 pts), boolean chains 6 (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.
_VibeLibraryContentViewState._sendEntryToGeneration (cognitive 59) lib/presentation/screens/vibe_library/widgets/vibe_library_content_view.dart:308— _VibeLibraryContentViewState._sendEntryToGeneration has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (42 pts), ternaries 2 (9 pts), boolean chains 4, error handling 1 (4 pts) (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.
AiTagGenerationInfoSection.build (cognitive 59) lib/presentation/widgets/online_gallery/ai_tag_generation_info_section.dart:20— AiTagGenerationInfoSection.build has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (30 pts), boolean chains 13, ternaries 5 (12 pts), loops 3 (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.
VibeFileParser._parsePngIsolate (cognitive 56) lib/core/utils/vibe_file_parser.dart:360— VibeFileParser._parsePngIsolate has cognitive complexity 56 (threshold 15). Drivers by points: if/else 11 (40 pts), error handling 3 (8 pts), boolean chains 6, loops 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.
VibeImportService._importParsedSources (cognitive 56) lib/data/services/vibe_import_service.dart:307— VibeImportService._importParsedSources has cognitive complexity 56 (threshold 15). Drivers by points: if/else 8 (25 pts), ternaries 6 (24 pts), boolean chains 3, error handling 1 (3 pts), loops 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.
GalleryCategoryNotifier._moveCategoryToSlot (cognitive 55) lib/presentation/providers/gallery_category_provider.dart:314— GalleryCategoryNotifier._moveCategoryToSlot has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 10 (25 pts), if/else 10 (21 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (2 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.
_OfficialRecipeEngine._legacyCharacter (cognitive 54) lib/data/services/official_random_prompt_generator.dart:256— _OfficialRecipeEngine._legacyCharacter has cognitive complexity 54 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 8, loops 2, match/switch 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.
WebDavCapabilityProbe.run (cognitive 51) lib/core/cloud_sync/backend/webdav_capability_probe.dart:32— WebDavCapabilityProbe.run has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 11, error handling 2 (6 pts), 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.
AnthropicMessagesAdapter.buildAgentPayload (cognitive 51) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:245— AnthropicMessagesAdapter.buildAgentPayload has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 5 (13 pts), match/switch 1 (4 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.
ImageGenerationNotifier.generate (cognitive 51) lib/presentation/providers/image_generation_provider.dart:292— ImageGenerationNotifier.generate has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (31 pts), error handling 4 (9 pts), boolean chains 6, ternaries 2 (3 pts), loops 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.
_WatermarkEditorScreenState._buildActions (cognitive 51) lib/presentation/screens/watermark/watermark_editor_screen.dart:761— _WatermarkEditorScreenState._buildActions has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 12 (31 pts), boolean chains 11, if/else 7 (9 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.
QuickTagCloudQueryEngine.matchingRecords (cognitive 50) lib/data/datasources/remote/online_gallery/quick_tag_cloud_query_engine.dart:28— QuickTagCloudQueryEngine.matchingRecords has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 8, loops 3 (5 pts), ternaries 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.
SkillArchiveExtractor.extract (cognitive 49) lib/core/agent/skill_archive_extractor.dart:38— SkillArchiveExtractor.extract has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (32 pts), error handling 4 (8 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NaiGenerationResponseProcessor.processMessagePackStream (cognitive 49) lib/data/datasources/remote/nai_generation_response_processor.dart:95— NaiGenerationResponseProcessor.processMessagePackStream has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 3 (7 pts), error handling 2 (5 pts), boolean chains 4, 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.
InputHandler.handleKeyEvent (cognitive 49) lib/presentation/widgets/image_editor/core/input_handler.dart:193— InputHandler.handleKeyEvent has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 10, match/switch 2 (4 pts), ternaries 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.
WebDavOperationInventory.findExisting (cognitive 48) lib/core/cloud_sync/backend/webdav_operation_inventory.dart:38— WebDavOperationInventory.findExisting has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (38 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 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.
TagSubCategoryHelper.classifyTag (cognitive 48) lib/data/models/prompt/tag_category.dart:162— TagSubCategoryHelper.classifyTag has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 34, if/else 8 (11 pts), loops 2 (3 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.
OpenAiResponsesAdapter._buildAgentPayload (cognitive 48) lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:289— OpenAiResponsesAdapter._buildAgentPayload has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 5 (12 pts), ternaries 2 (5 pts), match/switch 1 (4 pts), 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.
_OfficialRecipeEngine.generateFurry (cognitive 47) lib/data/services/official_random_prompt_generator.dart:386— _OfficialRecipeEngine.generateFurry has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (30 pts), loops 8 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentChatThreadModel.fromMessages (cognitive 47) lib/presentation/agent_chat/widgets/agent_chat_turn.dart:22— AgentChatThreadModel.fromMessages has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 5 (9 pts), ternaries 2 (4 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.
BackendHttp.request (cognitive 46) lib/core/cloud_sync/backend/backend_http.dart:40— BackendHttp.request has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 5 (10 pts), error handling 3 (7 pts), boolean chains 6, loops 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.
CloudRecordMerger.merge (cognitive 46) lib/core/cloud_sync/record_merge.dart:17— CloudRecordMerger.merge has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 6 (15 pts), boolean chains 9, 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.
AiTagGenerationParser.parse (cognitive 46) lib/data/services/metadata/ai_tag_generation_parser.dart:13— AiTagGenerationParser.parse has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (38 pts), boolean chains 3, ternaries 3, error handling 1 (2 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.
ImageCardSurface._buildSurface (cognitive 46) lib/presentation/widgets/common/image_card_surface.dart:47— ImageCardSurface._buildSurface has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 23, ternaries 10 (12 pts), if/else 10, loops 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.
VerifiedResumableDownloader._downloadToPartFile (cognitive 45) lib/core/services/verified_resumable_downloader.dart:273— VerifiedResumableDownloader._downloadToPartFile has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (29 pts), ternaries 3 (8 pts), boolean chains 4, loops 2 (4 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.
ComfyUiParser.parse (cognitive 45) lib/data/services/metadata/metadata_text_decoder.dart:507— ComfyUiParser.parse has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (35 pts), boolean chains 6, loops 1 (3 pts), error handling 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.
OnlineGalleryToolbarAuthControls._buildUserButton (cognitive 45) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_auth.dart:47— OnlineGalleryToolbarAuthControls._buildUserButton has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 17 (34 pts), if/else 7 (9 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.
NAIImageRequestBuilder.buildVibeTransferParameters (cognitive 44) lib/core/network/request_builders/nai_image_request_builder.dart:319— NAIImageRequestBuilder.buildVibeTransferParameters has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (32 pts), error handling 2 (7 pts), loops 3 (5 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.
InpaintMaskUtils._officialWorkerBlur (cognitive 44) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1434— InpaintMaskUtils._officialWorkerBlur has cognitive complexity 44 (threshold 15). Drivers by points: loops 13 (25 pts), if/else 7 (18 pts), boolean chains 1 (nesting depth added 23). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
OpenAiChatCompletionsAdapter._mapAgentMessage (cognitive 44) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:438— OpenAiChatCompletionsAdapter._mapAgentMessage has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 4 (11 pts), match/switch 1 (4 pts), ternaries 2 (4 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.
InpaintMaskGeometry.expandBinary (cognitive 43) lib/core/utils/inpaint_mask/inpaint_mask_geometry.dart:138— InpaintMaskGeometry.expandBinary has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 7 (16 pts), ternaries 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.
_OfficialRecipeEngine.generateLegacy (cognitive 43) lib/data/services/official_random_prompt_generator.dart:154— _OfficialRecipeEngine.generateLegacy has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (26 pts), loops 10 (16 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.
_AgentChatComposerState._editor (cognitive 43) lib/presentation/agent_chat/widgets/agent_chat_composer.dart:236— _AgentChatComposerState._editor has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 19, if/else 12 (15 pts), ternaries 7 (9 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.
VibeImportController.importDrop (cognitive 43) lib/presentation/screens/vibe_library/vibe_import_controller.dart:150— VibeImportController.importDrop has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 6 (13 pts), ternaries 1 (5 pts), boolean chains 2, 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.
_VibeExportDialogAdvancedState._export (cognitive 43) lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:429— _VibeExportDialogAdvancedState._export has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (42 pts), error handling 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.
NaiImageMetadata.upgradeFromRawJsonIfNeeded (cognitive 42) lib/data/models/gallery/nai_image_metadata.dart:238— NaiImageMetadata.upgradeFromRawJsonIfNeeded has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 15 (29 pts), boolean chains 9, if/else 2 (3 pts), error handling 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.
_DanbooruPostCardState._buildActions (cognitive 42) lib/presentation/widgets/danbooru_post_card.dart:382— _DanbooruPostCardState._buildActions has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (24 pts), ternaries 6 (9 pts), boolean chains 5, error handling 2 (3 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.
SkillArchiveService.exportSkills (cognitive 41) lib/core/agent/skill_archive_service.dart:62— SkillArchiveService.exportSkills has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 3 (4 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.
AiTagGallerySourceAdapter._fetchList (cognitive 41) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:178— AiTagGallerySourceAdapter._fetchList has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (21 pts), ternaries 4 (10 pts), error handling 4 (6 pts), boolean chains 2, loops 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.
OnlineGalleryLocalFavoritesRepository.query (cognitive 41) lib/data/repositories/online_gallery_local_favorites_repository.dart:146— OnlineGalleryLocalFavoritesRepository.query has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 16, loops 2 (3 pts), ternaries 1 (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.
OnlineGalleryToolbox._executeBrowse (cognitive 41) lib/presentation/agent_chat/services/online_gallery_toolbox.dart:107— OnlineGalleryToolbox._executeBrowse has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 10, loops 2 (5 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.
GenerationImageBatchActions._packSelectedImages (cognitive 40) lib/presentation/screens/generation/services/generation_image_batch_actions.dart:83— GenerationImageBatchActions._packSelectedImages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts), 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.
_PreciseRefSelectorDialogState.build (cognitive 40) lib/presentation/screens/precise_ref_library/widgets/precise_ref_selector_dialog.dart:129— _PreciseRefSelectorDialogState.build has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 8 (13 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.
_TagEditorViewState._key (cognitive 40) lib/presentation/widgets/prompt/tag_editor_view.dart:537— _TagEditorViewState._key has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 11, ternaries 2 (4 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.
SqliteGalleryAlbumRepository._moveAlbumToSlot (cognitive 39) lib/core/database/datasources/gallery_album_repository.dart:791— SqliteGalleryAlbumRepository._moveAlbumToSlot has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 7 (10 pts), ternaries 5 (10 pts), boolean chains 4, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InpaintMaskUtils._dilateMask (cognitive 39) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1638— InpaintMaskUtils._dilateMask has cognitive complexity 39 (threshold 15). Drivers by points: if/else 3 (17 pts), loops 5 (15 pts), ternaries 1 (4 pts), boolean chains 3 (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.
_OfficialRecipeEngine.generateCharacterPrompts (cognitive 39) lib/data/services/official_random_prompt_generator.dart:694— _OfficialRecipeEngine.generateCharacterPrompts has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (23 pts), loops 8 (15 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.
ArtistChainParser._parseRange (cognitive 39) lib/data/services/online_gallery/artist_chain_parser.dart:96— ArtistChainParser._parseRange has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (7 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnlineGalleryLocalFavoritesRepository._migrateQuickTagCloudFavorites (cognitive 38) lib/data/repositories/online_gallery_local_favorites_repository.dart:374— OnlineGalleryLocalFavoritesRepository._migrateQuickTagCloudFavorites has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (22 pts), error handling 3 (9 pts), loops 3 (5 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.
PromptWeightEditing._resolveTarget (cognitive 38) lib/presentation/widgets/prompt/prompt_weight_editing.dart:98— PromptWeightEditing._resolveTarget has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 12, loops 4 (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.
SkillArchiveExtractor._preflightZipHeaders (cognitive 37) lib/core/agent/skill_archive_extractor.dart:190— SkillArchiveExtractor._preflightZipHeaders has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 14, 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.
SafeWebReader.read (cognitive 37) lib/core/network/web_access/safe_web_reader.dart:38— SafeWebReader.read has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (23 pts), ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 3, 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.
GalleryStreamScanner.startScanning (cognitive 37) lib/data/services/gallery/gallery_stream_scanner.dart:173— GalleryStreamScanner.startScanning has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 6 (16 pts), boolean chains 2, 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.
LocalGalleryRepository.loadRecords (cognitive 37) lib/data/services/gallery/local_gallery_repository.dart:87— LocalGalleryRepository.loadRecords has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 9 (13 pts), error handling 2 (4 pts), 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.
VibeImportHandler.saveToLibrary (cognitive 37) lib/presentation/screens/generation/handlers/vibe_import_handler.dart:355— VibeImportHandler.saveToLibrary has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 3 (9 pts), boolean chains 5, loops 1 (3 pts), error handling 1 (2 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.
_LocalGalleryToolbarState.build (cognitive 37) lib/presentation/widgets/gallery/local_gallery_toolbar.dart:167— _LocalGalleryToolbarState.build has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 14 (21 pts), if/else 11 (13 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.
SessionState.applyMutation (cognitive 36) lib/core/agent/harness/session/session_state.dart:152— SessionState.applyMutation has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 2, 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.
CooccurrenceDataPackService._install (cognitive 36) lib/core/autocomplete/cooccurrence_data_pack_service.dart:187— CooccurrenceDataPackService._install has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 11, ternaries 3 (6 pts), error handling 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.
PipeParser._splitPipeSegments (cognitive 36) lib/core/utils/comfyui_prompt_parser/pipe_parser.dart:98— PipeParser._splitPipeSegments has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 5, 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.
VibeFileParser._extractEncodingDetails (cognitive 36) lib/core/utils/vibe_file_parser.dart:940— VibeFileParser._extractEncodingDetails has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 4 (6 pts), boolean chains 4, loops 2 (3 pts), 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.
AiTagGallerySourceAdapter._parseMetadata (cognitive 36) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:471— AiTagGallerySourceAdapter._parseMetadata has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 9, ternaries 1 (5 pts), loops 1 (4 pts), error handling 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.
_AgentChatComposerState._contextIndicator (cognitive 36) lib/presentation/agent_chat/widgets/agent_chat_composer.dart:527— _AgentChatComposerState._contextIndicator has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 22 (26 pts), boolean chains 9, if/else 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.
AgentChatMessages.build (cognitive 36) lib/presentation/agent_chat/widgets/agent_chat_messages.dart:35— AgentChatMessages.build has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 17, ternaries 6 (9 pts), if/else 8, loops 2 (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.
_OnlineGalleryContentPresenter._buildResolvedPostCard (cognitive 36) lib/presentation/screens/online_gallery/online_gallery_content.dart:369— _OnlineGalleryContentPresenter._buildResolvedPostCard has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 20, boolean chains 11, if/else 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.
EditorCanvasResizeController.changeCanvasSize (cognitive 36) lib/presentation/widgets/image_editor/controllers/editor_canvas_resize_controller.dart:40— EditorCanvasResizeController.changeCanvasSize has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (28 pts), boolean chains 5, 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.
BoundedTransferScheduler.run (cognitive 35) lib/core/cloud_sync/bounded_transfer_scheduler.dart:80— BoundedTransferScheduler.run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 9, loops 3 (5 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.
AuthState.parseError (cognitive 35) lib/data/services/auth_provider.dart:152— AuthState.parseError has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 4, match/switch 1 (4 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.
DanbooruAuth._loadSavedCredentials (cognitive 35) lib/data/services/danbooru_auth_service.dart:144— DanbooruAuth._loadSavedCredentials has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (25 pts), error handling 2 (5 pts), boolean chains 3, match/switch 1 (2 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.
GenerationCharacterOrchestrator.normalizeExplicit (cognitive 35) lib/presentation/agent_chat/services/generation_character_orchestration.dart:38— GenerationCharacterOrchestrator.normalizeExplicit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 7, ternaries 2 (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.
PromptAssistantService._toContentParts (cognitive 35) lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:644— PromptAssistantService._toContentParts has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (28 pts), ternaries 1 (5 pts), loops 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.
MosaicEditorActionsBar.build (cognitive 35) lib/presentation/screens/mosaic/mosaic_editor_actions_bar.dart:32— MosaicEditorActionsBar.build has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (19 pts), boolean chains 10, if/else 5 (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.
OnlineGalleryToolbarSourceControls._buildSecondaryControls (cognitive 35) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:387— OnlineGalleryToolbarSourceControls._buildSecondaryControls has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 8, ternaries 1 (3 pts), loops 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.
GenerationPromptTransferService.replaceMainPrompt (cognitive 35) lib/presentation/services/generation_prompt_transfer_service.dart:192— GenerationPromptTransferService.replaceMainPrompt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 12 (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.
WorkflowAnalyzer.analyze (cognitive 34) lib/core/comfyui/workflow_analyzer.dart:41— WorkflowAnalyzer.analyze has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 3 (11 pts), loops 2 (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.
InpaintMaskUtils._erodeMask (cognitive 34) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1674— InpaintMaskUtils._erodeMask has cognitive complexity 34 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 2 (11 pts), boolean chains 4, ternaries 1 (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.
PromptEditDocument._parse (cognitive 34) lib/core/utils/prompt_edit_document.dart:103— PromptEditDocument._parse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 9, loops 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.
AgentSkillsCloudSyncAdapter.validateRecord (cognitive 34) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:252— AgentSkillsCloudSyncAdapter.validateRecord has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (14 pts) (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.
ReversePromptNotifier.runChain (cognitive 34) lib/presentation/providers/reverse_prompt_provider.dart:368— ReversePromptNotifier.runChain has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (30 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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.
_PreciseRefLibraryScreenState._importImages (cognitive 34) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:108— _PreciseRefLibraryScreenState._importImages has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 2 (4 pts), loops 2 (4 pts), ternaries 1 (4 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.
_VibeCategoryItemState.build (cognitive 34) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:65— _VibeCategoryItemState.build has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 12 (14 pts), if/else 8 (12 pts), boolean chains 6, match/switch 1 (2 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.
VibeExportEmbedImageOptionCard.build (cognitive 34) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_embed_and_encoding_sections.dart:40— VibeExportEmbedImageOptionCard.build has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 8 (14 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.
CardActionButtons.build (cognitive 34) lib/presentation/widgets/common/card_action_buttons.dart:93— CardActionButtons.build has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (9 pts), ternaries 6 (8 pts), loops 5 (6 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.
_PromptCopyDialogState._buildExportOptions (cognitive 34) lib/presentation/widgets/common/image_detail/components/prompt_copy_dialog.dart:264— _PromptCopyDialogState._buildExportOptions has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 6 (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.
_CategoryItemState.build (cognitive 34) lib/presentation/widgets/gallery/gallery_category_tree_view.dart:423— _CategoryItemState.build has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 11 (13 pts), boolean chains 5, 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.
CompletionOrchestrator.query (cognitive 33) lib/core/autocomplete/completion_orchestrator.dart:62— CompletionOrchestrator.query has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (11 pts), ternaries 5 (7 pts), error handling 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.
KritaBridgeServer._handleSocket (cognitive 33) lib/core/krita/krita_bridge_server.dart:170— KritaBridgeServer._handleSocket has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (23 pts), ternaries 2 (8 pts), loops 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.
PreciseRefImageCodec.detectExtension (cognitive 33) lib/data/services/precise_ref_portable_importer.dart:13— PreciseRefImageCodec.detectExtension has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 28, if/else 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.
KritaBridgeService._generateImage (cognitive 33) lib/presentation/providers/krita/krita_bridge_service.dart:354— KritaBridgeService._generateImage has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts), error handling 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.
VibeImportHandler.importFromLibrary (cognitive 33) lib/presentation/screens/generation/handlers/vibe_import_handler.dart:179— VibeImportHandler.importFromLibrary has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, ternaries 1 (4 pts), loops 1 (2 pts), 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.
_ComfyUISettingsSectionState.build (cognitive 33) lib/presentation/screens/settings/sections/comfyui_settings_section.dart:37— _ComfyUISettingsSectionState.build has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 10 (15 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.
CompactIconButton.build (cognitive 33) lib/presentation/widgets/common/compact_icon_button.dart:37— CompactIconButton.build has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (15 pts), ternaries 9 (14 pts), boolean chains 4 (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.
EditorResultExporter.buildEditorResult (cognitive 33) lib/presentation/widgets/image_editor/export/editor_result_exporter.dart:66— EditorResultExporter.buildEditorResult has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 22, ternaries 10, 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.
SkillInstallTransactionManager.recoverTransaction (cognitive 32) lib/core/agent/skill_install_transaction.dart:41— SkillInstallTransactionManager.recoverTransaction has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 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.
DanbooruCompletionSource.search (cognitive 32) lib/core/autocomplete/danbooru_completion_source.dart:46— DanbooruCompletionSource.search has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 2 (5 pts), boolean chains 3, error handling 2, loops 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.
NAIImageRequestBuilder.build (cognitive 32) lib/core/network/request_builders/nai_image_request_builder.dart:563— NAIImageRequestBuilder.build has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 12, loops 2 (3 pts), ternaries 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.
SearxngSearchClient.search (cognitive 32) lib/core/network/web_access/searxng_search_client.dart:13— SearxngSearchClient.search has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 2 (6 pts), error handling 3, boolean chains 2, 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.
PngShareSource.parse (cognitive 32) lib/core/utils/png_share_source.dart:12— PngShareSource.parse has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 7, 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.
PromptTagUtils.splitTopLevel (cognitive 32) lib/core/utils/prompt_tag_utils.dart:9— PromptTagUtils.splitTopLevel has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, match/switch 1 (2 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.
MetadataWorkerPool._initializeWorkers (cognitive 32) lib/data/services/metadata/metadata_worker_pool.dart:63— MetadataWorkerPool._initializeWorkers has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 5 (9 pts), boolean chains 5, 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.
_OfficialRecipeEngine._dressInSeparates (cognitive 32) lib/data/services/official_random_prompt_generator.dart:884— _OfficialRecipeEngine._dressInSeparates has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 4 (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.
AgentChatSessionController.beginRewindLastUserMessage (cognitive 32) lib/presentation/agent_chat/services/agent_chat_session_controller.dart:714— AgentChatSessionController.beginRewindLastUserMessage has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (6 pts), error handling 2 (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.
GenerationInterrogationService._interrogateBytes (cognitive 32) lib/presentation/agent_chat/services/generation_interrogation_service.dart:86— GenerationInterrogationService._interrogateBytes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (24 pts), error handling 2 (5 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.
OnlineGalleryBlacklistNotifier.pushToCloud (cognitive 32) lib/presentation/providers/online_gallery_blacklist_provider.dart:418— OnlineGalleryBlacklistNotifier.pushToCloud has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 5, 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.
_PrivacySettingsSectionState.build (cognitive 32) lib/presentation/screens/settings/sections/privacy_settings_section.dart:94— _PrivacySettingsSectionState.build has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 19 (21 pts), boolean chains 8, if/else 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.
_StorageSettingsSectionState.build (cognitive 32) lib/presentation/screens/settings/sections/storage_settings_section.dart:176— _StorageSettingsSectionState.build has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 11 (16 pts), if/else 10 (14 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.
_AddToLibraryDialogState._save (cognitive 32) lib/presentation/widgets/common/add_to_library_dialog.dart:142— _AddToLibraryDialogState._save has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 2 (6 pts), loops 1 (2 pts), error handling 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.
krita_bridge_direct_probe_no_write._main (cognitive 32) REDACTED:48— krita_bridge_direct_probe_no_write._main has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, if/else 3 (8 pts), ternaries 4 (7 pts), loops 1 (2 pts) (nesting depth added 9). 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.
ReadHarnessTool.executeWithContext (cognitive 31) lib/core/agent/harness/tools/read.dart:105— ReadHarnessTool.executeWithContext has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (21 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.
SafeWebReader._isBlockedIpv4 (cognitive 31) lib/core/network/web_access/safe_web_reader.dart:282— SafeWebReader._isBlockedIpv4 has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 20, 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.
VibeImageEmbedder._extractEncodingFromVibe (cognitive 31) lib/core/utils/vibe_image_embedder.dart:755— VibeImageEmbedder._extractEncodingFromVibe has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 3 (4 pts), ternaries 3, 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.
UserTagLibraryCloudSyncAdapter.apply (cognitive 31) lib/data/cloud_sync/user_tag_library_cloud_sync_adapter.dart:101— UserTagLibraryCloudSyncAdapter.apply has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (9 pts), ternaries 2 (6 pts), 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.
NovelAiParser.parse (cognitive 31) lib/data/services/metadata/metadata_text_decoder.dart:296— NovelAiParser.parse has cognitive complexity 31 (threshold 15). Drivers by points: error handling 4 (16 pts), if/else 5 (13 pts), boolean chains 1, 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.
VibeFileDocumentCodec._findStableVibeIndex (cognitive 31) lib/data/services/vibe_file_document_codec.dart:94— VibeFileDocumentCodec._findStableVibeIndex has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (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.
VibeFolderSync.syncFolderToHive (cognitive 31) lib/data/services/vibe_folder_sync.dart:20— VibeFolderSync.syncFolderToHive has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (6 pts), error handling 2 (5 pts), ternaries 2 (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.
PromptInputEditor.build (cognitive 31) lib/presentation/screens/generation/widgets/prompt_input_editor.dart:35— PromptInputEditor.build has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 17 (19 pts), boolean chains 9, if/else 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.
EditorSessionInitializer._loadInitialImage (cognitive 31) lib/presentation/widgets/image_editor/controllers/editor_session_initializer.dart:97— EditorSessionInitializer._loadInitialImage has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 7, 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.
MagicWandController.apply (cognitive 31) lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart:42— MagicWandController.apply has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 10, ternaries 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.
TagEditorSession.apply (cognitive 31) lib/presentation/widgets/prompt/tag_editor_session.dart:330— TagEditorSession.apply has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 9, loops 4 (5 pts), 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.
SessionJsonlLineStorage.readCompleteLinesSync (cognitive 30) lib/core/agent/harness/session/jsonl/session_jsonl_line_storage.dart:16— SessionJsonlLineStorage.readCompleteLinesSync has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (5 pts), ternaries 1 (4 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.
TagTranslationLookup.translateBatch (cognitive 30) lib/core/autocomplete/tag_translation_lookup.dart:112— TagTranslationLookup.translateBatch has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (10 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.
SqliteGalleryImageRepository.batchUpsertImages (cognitive 30) lib/core/database/datasources/gallery_image_repository.dart:536— SqliteGalleryImageRepository.batchUpsertImages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (8 pts), ternaries 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.
CharacterPromptBlockParser.parse (cognitive 30) lib/core/utils/character_prompt_block_parser.dart:91— CharacterPromptBlockParser.parse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 3, match/switch 1 (2 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.
PromptEditDocument.emphasisRanges (cognitive 30) lib/core/utils/prompt_edit_document.dart:240— PromptEditDocument.emphasisRanges has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 9, ternaries 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.
AiTagGallerySourceAdapter.detail (cognitive 30) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:304— AiTagGallerySourceAdapter.detail has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (8 pts), boolean chains 4, error handling 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.
LocalOnnxModelService.importTaggerFiles (cognitive 30) lib/data/services/local_onnx_model_service.dart:231— LocalOnnxModelService.importTaggerFiles has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts), error handling 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.
CharacterTagGenerator.generate (cognitive 30) lib/data/services/strategies/character_tag_generator.dart:80— CharacterTagGenerator.generate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 5 (15 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.
TagToolbox._searchTags (cognitive 30) lib/presentation/agent_chat/services/tag_toolbox.dart:97— TagToolbox._searchTags has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 4 (5 pts), ternaries 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.
_ProviderQueue._execute (cognitive 30) lib/presentation/prompt_assistant/services/assistant_request_scheduler.dart:117— _ProviderQueue._execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 6, ternaries 1 (2 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.
OpenAiResponsesAdapter._extractResponseContent (cognitive 30) lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:450— OpenAiResponsesAdapter._extractResponseContent has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (9 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.
FixedTagsNotifier.restoreUsageSnapshot (cognitive 30) lib/presentation/providers/fixed_tags_provider.dart:626— FixedTagsNotifier.restoreUsageSnapshot has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 5 (10 pts), boolean chains 6, 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.
OnlineGalleryBlacklistNotifier._syncIncrementally (cognitive 30) lib/presentation/providers/online_gallery_blacklist_provider.dart:714— OnlineGalleryBlacklistNotifier._syncIncrementally has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 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.
_OnlineGalleryScreenState._handleGalleryStateChanged (cognitive 30) lib/presentation/screens/online_gallery/online_gallery_screen.dart:303— _OnlineGalleryScreenState._handleGalleryStateChanged has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 18, if/else 5 (7 pts), ternaries 2 (5 pts) (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.
_VibeCardState._buildCard (cognitive 30) lib/presentation/screens/vibe_library/widgets/vibe_card.dart:291— _VibeCardState._buildCard has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 16, if/else 9 (10 pts), ternaries 2 (4 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.
WatermarkEditorControls.build (cognitive 30) lib/presentation/screens/watermark/watermark_editor_controls.dart:38— WatermarkEditorControls.build has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (18 pts), if/else 5 (6 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.
_FavoriteIconButtonState.build (cognitive 30) lib/presentation/widgets/common/animated_favorite_button.dart:162— _FavoriteIconButtonState.build has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (19 pts), if/else 8 (10 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.
ImageCardController.update (cognitive 30) lib/presentation/widgets/common/image_card_controller.dart:68— ImageCardController.update has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 16, if/else 12 (14 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.
TagEditorSession._changed (cognitive 30) lib/presentation/widgets/prompt/tag_editor_session.dart:183— TagEditorSession._changed has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 9, 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.
_UnifiedPromptInputState._handleHardwareKeyEvent (cognitive 30) lib/presentation/widgets/prompt/unified/unified_prompt_input.dart:156— _UnifiedPromptInputState._handleHardwareKeyEvent has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 18, if/else 11 (12 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.
NaiPromptParser._splitByDelimiters (cognitive 29) lib/core/utils/nai_prompt_parser.dart:73— NaiPromptParser._splitByDelimiters has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 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.
WatermarkRenderService.render (cognitive 29) lib/core/watermark/watermark_render_service.dart:107— WatermarkRenderService.render has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 7, error handling 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.
VerifiedBlobStore.putStream (cognitive 29) lib/data/cloud_sync/verified_blob_store.dart:62— VerifiedBlobStore.putStream has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 8, error handling 2 (3 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.
MetadataImportOptions.selectedCount (cognitive 29) lib/data/models/metadata/metadata_import_options.dart:255— MetadataImportOptions.selectedCount has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, 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.
GenerationSettingsService.updateSettings (cognitive 29) lib/presentation/agent_chat/services/generation_settings_service.dart:68— GenerationSettingsService.updateSettings has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 9, 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.
VibeImportHandler.importFromFiles (cognitive 29) lib/presentation/screens/generation/handlers/vibe_import_handler.dart:42— VibeImportHandler.importFromFiles has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (19 pts), error handling 2 (6 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.
MobileCollapsedPromptLauncher.build (cognitive 29) lib/presentation/screens/generation/mobile_generation_workspace.dart:225— MobileCollapsedPromptLauncher.build has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, ternaries 2 (4 pts), loops 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.
_ImagePreviewWidgetState._buildGeneratedImageCard (cognitive 29) lib/presentation/screens/generation/widgets/image_preview.dart:656— _ImagePreviewWidgetState._buildGeneratedImageCard has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 25, boolean chains 3, if/else 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.
_BulkProgressDialogState.build (cognitive 29) lib/presentation/widgets/bulk_progress_dialog.dart:64— _BulkProgressDialogState.build has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7, ternaries 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.
CooccurrenceDataPackService._initialize (cognitive 28) lib/core/autocomplete/cooccurrence_data_pack_service.dart:71— CooccurrenceDataPackService._initialize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 6, error handling 2 (3 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.
ThreeWayMerger.merge (cognitive 28) lib/core/cloud_sync/merge.dart:58— ThreeWayMerger.merge has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, match/switch 1 (2 pts), ternaries 1 (2 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.
ComfyUIWebSocketService._handleJsonMessage (cognitive 28) lib/core/comfyui/comfyui_websocket_service.dart:105— ComfyUIWebSocketService._handleJsonMessage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 4, match/switch 1 (2 pts), error handling 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.
AvatarService.pickAndSaveAvatar (cognitive 28) lib/core/services/avatar_service.dart:64— AvatarService.pickAndSaveAvatar has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 4 (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.
OnnxTaggerLabelFiles._parseVocabularyLabels (cognitive 28) lib/data/services/local_onnx_tagger_labels.dart:302— OnnxTaggerLabelFiles._parseVocabularyLabels has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (7 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.
_AgentChatResourcePickerBodyState._buildLocalGallery (cognitive 28) lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:723— _AgentChatResourcePickerBodyState._buildLocalGallery has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (11 pts), 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.
_ZhDictionaryStatus.build (cognitive 28) lib/presentation/screens/settings/widgets/data_source_cache_settings.dart:463— _ZhDictionaryStatus.build has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 7 (9 pts), error handling 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.
_AutocompleteWrapperState._onKeyEvent (cognitive 28) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:625— _AutocompleteWrapperState._onKeyEvent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 10 (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.
_CollapsibleImagePanelState.build (cognitive 28) lib/presentation/widgets/common/collapsible_image_panel.dart:278— _CollapsibleImagePanelState.build has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 10, ternaries 7 (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.
_Model3dEditorScreenState.build (cognitive 28) lib/presentation/widgets/model3d_editor/model3d_editor_screen.dart:389— _Model3dEditorScreenState.build has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 6 (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.
BashHarnessTool.executeWithContext (cognitive 27) lib/core/agent/harness/tools/bash.dart:93— BashHarnessTool.executeWithContext has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 4 (6 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.
ZhDictionaryService.installOrUpdate (cognitive 27) lib/core/autocomplete/zh_dictionary_service.dart:137— ZhDictionaryService.installOrUpdate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 4 (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.
WebDavCloudSyncBackend.listSnapshotIds (cognitive 27) lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:392— WebDavCloudSyncBackend.listSnapshotIds has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (5 pts), boolean chains 3, ternaries 1 (3 pts), 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.
ResumableSnapshotUploader.resume (cognitive 27) lib/core/cloud_sync/snapshot_uploader.dart:33— ResumableSnapshotUploader.resume has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 3 (4 pts), ternaries 3, boolean chains 1 (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.
NaiPromptExportCodec._project (cognitive 27) lib/data/models/gallery/nai_prompt_export_codec.dart:236— NaiPromptExportCodec._project has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 11 (14 pts), if/else 9, loops 3, 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.
CharacterCountResolver.getCountTag (cognitive 27) lib/data/services/character_count_resolver.dart:66— CharacterCountResolver.getCountTag has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 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.
AgentImagePresentationService.present (cognitive 27) lib/presentation/agent_chat/services/image_presentation_toolbox.dart:40— AgentImagePresentationService.present has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (6 pts), loops 4, boolean chains 3, ternaries 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.
_AgentChatWorkTrailState.build (cognitive 27) lib/presentation/agent_chat/widgets/agent_chat_turn.dart:379— _AgentChatWorkTrailState.build has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 6 (8 pts), boolean chains 4, 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.
GenerationResultLifecycleService.saveImages (cognitive 27) lib/presentation/providers/generation/generation_result_lifecycle_service.dart:160— GenerationResultLifecycleService.saveImages has cognitive complexity 27 (threshold 15). Drivers by points: error handling 6 (13 pts), if/else 6 (13 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.
OnlineGallerySelectionActions._buildReplicationTask (cognitive 27) lib/presentation/screens/online_gallery/online_gallery_selection_actions.dart:100— OnlineGallerySelectionActions._buildReplicationTask has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 8, if/else 3 (6 pts), loops 1 (2 pts), error handling 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.
_OnlineGalleryToolbarPresenter._buildPrimaryActions (cognitive 27) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart:659— _OnlineGalleryToolbarPresenter._buildPrimaryActions has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 15 (22 pts), if/else 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.
ImageWorkflowLauncher._openEditor (cognitive 27) lib/presentation/services/image_workflow_launcher.dart:63— ImageWorkflowLauncher._openEditor has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, ternaries 8 (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.
ImageCardContextMenu.show (cognitive 27) lib/presentation/widgets/common/image_card_context_menu.dart:49— ImageCardContextMenu.show has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (18 pts), if/else 5 (7 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.
comparePngs (cognitive 27) tool/diagnostics/nai_inpaint_parity_browser.cjs:68— comparePngs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 3 (7 pts), loops 3 (6 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.
LocalGalleryThumbnailMigration.cleanup (cognitive 26) lib/core/cache/local_gallery_thumbnail_migration.dart:101— LocalGalleryThumbnailMigration.cleanup has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (6 pts), error handling 2 (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.
GoogleDriveCloudSyncBackend._fetchInventory (cognitive 26) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:584— GoogleDriveCloudSyncBackend._fetchInventory has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 5, 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.
SnapshotManifest.SnapshotManifest (cognitive 26) lib/core/cloud_sync/models.dart:128— SnapshotManifest.SnapshotManifest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 4 (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.
ConnectionPool.release (cognitive 26) lib/core/database/connection_pool.dart:214— ConnectionPool.release has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (26 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.
DanbooruTagsRefreshService._fetchPage (cognitive 26) lib/core/services/danbooru_tags_refresh_service.dart:212— DanbooruTagsRefreshService._fetchPage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), error handling 3 (6 pts), ternaries 1 (3 pts), boolean chains 1, 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.
InpaintMaskUtils.fillMaskRegionAtPoint (cognitive 26) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:392— InpaintMaskUtils.fillMaskRegionAtPoint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, loops 2, 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.
AgentSkillsCloudSyncAdapter._prepareRestorePlans (cognitive 26) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:338— AgentSkillsCloudSyncAdapter._prepareRestorePlans has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 5, 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.
NaiImageMetadataRawDecoder._extractCharacterPrompts (cognitive 26) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:442— NaiImageMetadataRawDecoder._extractCharacterPrompts has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (5 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.
_OfficialRecipeEngine._characterPromptCharacter (cognitive 26) lib/data/services/official_random_prompt_generator.dart:811— _OfficialRecipeEngine._characterPromptCharacter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 2, loops 2, 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.
KritaBridgeNotifier.enable (cognitive 26) lib/presentation/providers/krita/krita_bridge_notifier.dart:207— KritaBridgeNotifier.enable has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 3 (6 pts), boolean chains 2, 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.
_MosaicCanvasPainter._paintRegionGuide (cognitive 26) lib/presentation/screens/mosaic/mosaic_editor_canvas.dart:545— _MosaicCanvasPainter._paintRegionGuide has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 7 (10 pts), loops 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.
OnlineGalleryDetailLauncher.show (cognitive 26) lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:51— OnlineGalleryDetailLauncher.show has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 5 (9 pts), error handling 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.
OnlineGalleryScrollPrefetchCoordinator.scheduleVisiblePrefetch (cognitive 26) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:530— OnlineGalleryScrollPrefetchCoordinator.scheduleVisiblePrefetch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8, loops 3, 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.
GenerationTransferConfiguration._resolveModel (cognitive 26) lib/presentation/services/generation_prompt_transfer_service.dart:144— GenerationTransferConfiguration._resolveModel has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 2, ternaries 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.
CompletionOverlayHeader.build (cognitive 26) lib/presentation/widgets/autocomplete/completion_overlay_header.dart:27— CompletionOverlayHeader.build has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 8 (11 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.
_DiscordShareDialogState._send (cognitive 26) lib/presentation/widgets/discord_share/discord_share_dialog.dart:343— _DiscordShareDialogState._send has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, ternaries 1 (3 pts), 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.
_AutoSaveToggleChipState.build (cognitive 26) lib/presentation/widgets/generation/auto_save_toggle_chip.dart:68— _AutoSaveToggleChipState.build has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 19 (20 pts), boolean chains 3, if/else 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.
QueueTaskDetailView.build (cognitive 26) lib/presentation/widgets/queue/task_list_item.dart:799— QueueTaskDetailView.build has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 2 (5 pts), ternaries 2, boolean chains 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.
BackendHttp._request (cognitive 25) lib/core/cloud_sync/backend/backend_http.dart:276— BackendHttp._request has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (6 pts), boolean chains 4, error handling 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.
WebDavNamespaceCleaner._scan (cognitive 25) lib/core/cloud_sync/backend/webdav_namespace_cleaner.dart:98— WebDavNamespaceCleaner._scan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 5, loops 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.
SqliteGalleryAlbumRepository.rebindPendingPaths (cognitive 25) lib/core/database/datasources/gallery_album_repository.dart:683— SqliteGalleryAlbumRepository.rebindPendingPaths has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), loops 3 (5 pts), error handling 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.
DiagnosticLogExportService._writeSanitizedCopy (cognitive 25) lib/core/services/diagnostic_log_export_service.dart:257— DiagnosticLogExportService._writeSanitizedCopy has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 2 (4 pts), loops 1 (2 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.
EditorCompressionPlan.resolve (cognitive 25) lib/core/utils/editor_compression_utils.dart:80— EditorCompressionPlan.resolve has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, loops 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.
InpaintMaskUtils._alignMaskToLatentGrid (cognitive 25) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1708— InpaintMaskUtils._alignMaskToLatentGrid has cognitive complexity 25 (threshold 15). Drivers by points: loops 6 (17 pts), if/else 2 (8 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.
DonmaiGallerySourceAdapter.search (cognitive 25) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:52— DonmaiGallerySourceAdapter.search has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 4 (5 pts), ternaries 2 (4 pts), boolean chains 3, 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.
AgentChatConfig.fromJson (cognitive 25) lib/data/models/agent/agent_settings.dart:220— AgentChatConfig.fromJson has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 5, loops 1 (2 pts), match/switch 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DependencyConfig._matchMapping (cognitive 25) lib/data/models/prompt/dependency_config.dart:100— DependencyConfig._matchMapping has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (6 pts), boolean chains 2 (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.
PromptAssistantConfigState._isUntouchedLegacyPollinationsDefault (cognitive 25) lib/data/models/prompt_assistant/prompt_assistant_models.dart:1322— PromptAssistantConfigState._isUntouchedLegacyPollinationsDefault has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (11 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.
GalleryCategoryRepository._scanAndAddNewFolders (cognitive 25) lib/data/repositories/gallery_category_repository.dart:646— GalleryCategoryRepository._scanAndAddNewFolders has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 1 (2 pts), error handling 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.
JsonGenericParser.parse (cognitive 25) lib/data/services/metadata/metadata_text_decoder.dart:655— JsonGenericParser.parse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 2 (4 pts), error handling 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.
AgentToolPermissionController.beforeToolCall (cognitive 25) lib/presentation/agent_chat/services/agent_tool_permission_controller.dart:49— AgentToolPermissionController.beforeToolCall has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 8, ternaries 5 (6 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.
AgentChatPanelCoordinator._send (cognitive 25) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:124— AgentChatPanelCoordinator._send has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 4, 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.
OpenAiChatCompletionsAdapter._maxTokensField (cognitive 25) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:662— OpenAiChatCompletionsAdapter._maxTokensField has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 24, ternaries 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.
OpenAiChatCompletionsAdapter._extractResponseContent (cognitive 25) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:736— OpenAiChatCompletionsAdapter._extractResponseContent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (24 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.
AliasResolverService.searchEntries (cognitive 25) lib/presentation/providers/alias_resolver_service.dart:95— AliasResolverService.searchEntries has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (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.
ImageGenerationNotifier._reduce (cognitive 25) lib/presentation/providers/image_generation_provider.dart:520— ImageGenerationNotifier._reduce has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (8 pts), loops 3 (6 pts), boolean chains 2, 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.
LocalGalleryActionCoordinator.packSelectedImages (cognitive 25) lib/presentation/screens/local_gallery/local_gallery_action_coordinator.dart:260— LocalGalleryActionCoordinator.packSelectedImages has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, 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, 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.
NetworkSettingsSectionState.build (cognitive 25) lib/presentation/screens/settings/sections/network_settings_section.dart:47— NetworkSettingsSectionState.build has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (9 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.
_CooccurrenceDataPackStatus.build (cognitive 25) lib/presentation/screens/settings/widgets/data_source_cache_settings.dart:242— _CooccurrenceDataPackStatus.build has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 6 (9 pts), boolean chains 2, 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.
_StackedAreaChartState._buildChartData (cognitive 25) lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.dart:127— _StackedAreaChartState._buildChartData has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 6 (10 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.
_ElevatedCardState.build (cognitive 25) lib/presentation/widgets/common/elevated_card.dart:112— _ElevatedCardState.build has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 6 (9 pts), boolean chains 5 (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.
ImageCardFrame.build (cognitive 25) lib/presentation/widgets/common/image_card_frame.dart:52— ImageCardFrame.build has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12, boolean chains 11, if/else 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.
_ImageDetailViewerState._buildMainContent (cognitive 25) lib/presentation/widgets/common/image_detail/image_detail_viewer.dart:602— _ImageDetailViewerState._buildMainContent has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14 (16 pts), if/else 4 (6 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.
GlobalDropActionCoordinator.processDroppedFile (cognitive 25) lib/presentation/widgets/drop/global_drop_action_coordinator.dart:232— GlobalDropActionCoordinator.processDroppedFile 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.
_PromptLibraryEntryDialogState._save (cognitive 25) lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:508— _PromptLibraryEntryDialogState._save has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 1 (2 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.
_AlbumItemState.build (cognitive 25) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:550— _AlbumItemState.build has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 5 (7 pts), boolean chains 4, match/switch 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.
_NavRailAccountButtonState._showAccountMenu (cognitive 25) lib/presentation/widgets/navigation/nav_rail_account_button.dart:162— _NavRailAccountButtonState._showAccountMenu has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 4, ternaries 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.
OnlineGalleryCardLeftStatusOverlays.build (cognitive 25) lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:103— OnlineGalleryCardLeftStatusOverlays.build has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 11, if/else 8, ternaries 3 (6 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.
DanbooruCompletionSource._extractRelatedCandidates (cognitive 24) lib/core/autocomplete/danbooru_completion_source.dart:338— DanbooruCompletionSource._extractRelatedCandidates has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, ternaries 1 (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.
AssetDatabaseManager._validateDatabase (cognitive 24) lib/core/database/asset_database_manager.dart:209— AssetDatabaseManager._validateDatabase has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 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.
NAIImageRequestBuilder.buildBaseParameters (cognitive 24) lib/core/network/request_builders/nai_image_request_builder.dart:73— NAIImageRequestBuilder.buildBaseParameters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 5, 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.
WindowsProxyHelper._parseProxyServer (cognitive 24) lib/core/network/windows_proxy_helper.dart:88— WindowsProxyHelper._parseProxyServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 4, 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.
InteractiveWorkGate._drain (cognitive 24) lib/core/services/interactive_work_gate.dart:64— InteractiveWorkGate._drain has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), error handling 1 (3 pts), ternaries 1 (3 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.
AppLogger._cleanupOldLogs (cognitive 24) lib/core/utils/app_logger.dart:223— AppLogger._cleanupOldLogs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 3 (8 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.
SdToNaiConverter._parsePromptAttention (cognitive 24) lib/core/utils/sd_to_nai_converter.dart:134— SdToNaiConverter._parsePromptAttention has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, ternaries 1 (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.
DanbooruApiService.batchGetTagPostCounts (cognitive 24) lib/data/datasources/remote/danbooru_api_service.dart:673— DanbooruApiService.batchGetTagPostCounts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (5 pts), error handling 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.
DanbooruTagGroupService.syncTagGroup (cognitive 24) lib/data/datasources/remote/danbooru_tag_group_service.dart:168— DanbooruTagGroupService.syncTagGroup has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (8 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.
DlssRuntimeManager.install (cognitive 24) lib/data/services/dlss/dlss_runtime_manager.dart:123— DlssRuntimeManager.install has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 3 (5 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.
LocalGalleryQuery.applyFilter (cognitive 24) lib/data/services/gallery/local_gallery_query.dart:114— LocalGalleryQuery.applyFilter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
ImageMetadataService._parseAndCache (cognitive 24) lib/data/services/image_metadata_service.dart:608— ImageMetadataService._parseAndCache has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 3 (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.
ImageMetadataContainerCodec._scanValidatedPngChunks (cognitive 24) lib/data/services/metadata/image_metadata_container_codec.dart:356— ImageMetadataContainerCodec._scanValidatedPngChunks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 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.
_ArchiveRecord.parse (cognitive 24) lib/data/services/precise_ref_library_archive_service.dart:361— _ArchiveRecord.parse has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 20, if/else 2, ternaries 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.
CatalogRandomGeneratorStrategy._generateLegacyPrompt (cognitive 24) lib/data/services/strategies/catalog_random_generator_strategy.dart:234— CatalogRandomGeneratorStrategy._generateLegacyPrompt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (6 pts), ternaries 2 (4 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. This shape REPEATS in the file: one other method here (CatalogRandomGeneratorStrategy._generateMultiCharacterPrompt) 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.
CatalogRandomGeneratorStrategy._generateMultiCharacterPrompt (cognitive 24) lib/data/services/strategies/catalog_random_generator_strategy.dart:324— CatalogRandomGeneratorStrategy._generateMultiCharacterPrompt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (6 pts), ternaries 2 (4 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. This shape REPEATS in the file: one other method here (CatalogRandomGeneratorStrategy._generateLegacyPrompt) 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.
VibeLibraryEntryReader.detail (cognitive 24) lib/data/services/vibe_library_entry_reader.dart:67— VibeLibraryEntryReader.detail has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 5 (11 pts), boolean chains 1, 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.
AgentChatSessionController._restoreLegacyReadImageDetails (cognitive 24) lib/presentation/agent_chat/services/agent_chat_session_controller.dart:617— AgentChatSessionController._restoreLegacyReadImageDetails has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 6, loops 2 (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.
GeminiGenerateContentAdapter._extractResponseContent (cognitive 24) lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:446— GeminiGenerateContentAdapter._extractResponseContent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 1 (3 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.
_MobileGenerateButton.build (cognitive 24) lib/presentation/screens/generation/mobile_generation_chrome.dart:309— _MobileGenerateButton.build has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (14 pts), if/else 6, 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.
OnlineGalleryScrollPrefetchCoordinator.jumpToPageTarget (cognitive 24) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:312— OnlineGalleryScrollPrefetchCoordinator.jumpToPageTarget has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 5 (7 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.
_SizeComparisonPainter._drawPattern (cognitive 24) lib/presentation/widgets/image_editor/widgets/panels/canvas_size_dialog.dart:684— _SizeComparisonPainter._drawPattern has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (20 pts), if/else 4 (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.
NaiSyntaxController._applyComposingUnderline (cognitive 24) lib/presentation/widgets/prompt/nai_syntax_controller.dart:183— NaiSyntaxController._applyComposingUnderline has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 2 (3 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.
PromptWeightEditing._partialTarget (cognitive 24) lib/presentation/widgets/prompt/prompt_weight_editing.dart:241— PromptWeightEditing._partialTarget has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (8 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.
PromptTokenParser.editChangesActiveToken (cognitive 23) lib/core/autocomplete/prompt_token_parser.dart:205— PromptTokenParser.editChangesActiveToken has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, if/else 7, loops 2, ternaries 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.
SqliteGalleryMetadataRepository.batchUpsertMetadata (cognitive 23) lib/core/database/datasources/gallery_metadata_repository.dart:143— SqliteGalleryMetadataRepository.batchUpsertMetadata has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 2 (3 pts), loops 2 (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.
ExaSearchClient._searchMcpTool (cognitive 23) lib/core/network/web_access/exa_search_client.dart:136— ExaSearchClient._searchMcpTool has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (6 pts), error handling 3, 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.
PixelSnapEngine._selectPitch (cognitive 23) lib/core/services/pixel_snap/pixel_snap_engine.dart:188— PixelSnapEngine._selectPitch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 8 (9 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.
SmartTagRecommendationService.getRecommendations (cognitive 23) lib/core/services/smart_tag_recommendation_service.dart:81— SmartTagRecommendationService.getRecommendations has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (4 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.
NovelAiVibeCodec.validateSingleMap (cognitive 23) lib/core/utils/novelai_vibe_codec.dart:123— NovelAiVibeCodec.validateSingleMap has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (11 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.
VibeFileParser._parseBundleBytesSync (cognitive 23) lib/core/utils/vibe_file_parser.dart:847— VibeFileParser._parseBundleBytesSync has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (4 pts), boolean chains 2, error handling 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.
LocalOnnxModelService._recoverInterruptedImports (cognitive 23) lib/data/services/local_onnx_model_service.dart:406— LocalOnnxModelService._recoverInterruptedImports has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, 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.
OnlineGalleryArtistHuntService.resolve (cognitive 23) lib/data/services/online_gallery/online_gallery_artist_hunt_service.dart:42— OnlineGalleryArtistHuntService.resolve has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), boolean chains 3, 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.
OnlineGallerySearchService.buildPlan (cognitive 23) lib/data/services/online_gallery/online_gallery_search_service.dart:36— OnlineGallerySearchService.buildPlan has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 6, boolean chains 4, ternaries 1 (3 pts), error handling 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.
VibeLibraryEntryWriter.updateEncodingModel (cognitive 23) lib/data/services/vibe_library_entry_writer.dart:162— VibeLibraryEntryWriter.updateEncodingModel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (9 pts), boolean chains 3, 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.
GenerationExecutionService.generate (cognitive 23) lib/presentation/agent_chat/services/generation_execution_service.dart:29— GenerationExecutionService.generate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, error handling 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.
AgentChatPanelCoordinator._editUserMessage (cognitive 23) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:315— AgentChatPanelCoordinator._editUserMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 2 (4 pts), 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.
ImageGenerationService._execute (cognitive 23) lib/presentation/providers/generation/image_generation_service.dart:133— ImageGenerationService._execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (6 pts), boolean chains 5, match/switch 1 (3 pts), error handling 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.
LocalGalleryNotifier.loadPage (cognitive 23) lib/presentation/providers/local_gallery_provider.dart:356— LocalGalleryNotifier.loadPage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 4 (7 pts), error handling 3, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubscriptionNotifier._doFetchSubscription (cognitive 23) lib/presentation/providers/subscription_provider.dart:374— SubscriptionNotifier._doFetchSubscription has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, 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.
HistoryImageCard.build (cognitive 23) lib/presentation/screens/generation/widgets/history_panel/history_image_card.dart:90— HistoryImageCard.build has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 21, 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.
_MosaicEditorCanvasState._resizeRegion (cognitive 23) lib/presentation/screens/mosaic/mosaic_editor_canvas.dart:391— _MosaicEditorCanvasState._resizeRegion 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.
_GalleryCacheActionsState._rescanGallery (cognitive 23) lib/presentation/screens/settings/widgets/gallery_cache_actions.dart:75— _GalleryCacheActionsState._rescanGallery has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (22 pts), 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.
VibeImportController._encodeImage (cognitive 23) lib/presentation/screens/vibe_library/vibe_import_controller.dart:473— VibeImportController._encodeImage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, error handling 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.
VibeExportAdvancedExecutor.resolveEntryVibes (cognitive 23) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_advanced_executor.dart:286— VibeExportAdvancedExecutor.resolveEntryVibes has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 9, ternaries 4 (8 pts), if/else 4 (5 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.
_VibeExportDialogAdvancedState.build (cognitive 23) lib/presentation/screens/vibe_library/widgets/vibe_export_dialog_advanced.dart:191— _VibeExportDialogAdvancedState.build has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 1 (3 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.
CompletionOverlay.build (cognitive 23) lib/presentation/widgets/autocomplete/completion_overlay.dart:61— CompletionOverlay.build has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 17, if/else 5, 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.
_PromptLibraryEntryDialogState.build (cognitive 23) lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:208— _PromptLibraryEntryDialogState.build has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 5 (8 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.
KeyboardState.updateFromEvent (cognitive 23) lib/presentation/widgets/image_editor/core/input_handler.dart:24— KeyboardState.updateFromEvent 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.
_FillRequest.floodFill (cognitive 23) lib/presentation/widgets/image_editor/tools/fill_tool.dart:201— _FillRequest.floodFill has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 9, 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.
_TaskListItemState.build (cognitive 23) lib/presentation/widgets/queue/task_list_item.dart:95— _TaskListItemState.build has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, ternaries 8, if/else 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.
OleDataInspector.WrapDibAsBmp (cognitive 22) tool/ole_drag_inspector/windows/Program.cs:884— OleDataInspector.WrapDibAsBmp has cognitive complexity 22 (threshold 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.
SessionState.createForkMutations (cognitive 22) lib/core/agent/harness/session/session_state.dart:350— SessionState.createForkMutations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (8 pts), loops 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompletionRanker.mergeAndSort (cognitive 22) lib/core/autocomplete/completion_ranker.dart:6— CompletionRanker.mergeAndSort has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 5 (10 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.
_DriveFile.fromJson (cognitive 22) lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart:894— _DriveFile.fromJson has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 5, ternaries 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.
WebDavEtagReader.read (cognitive 22) lib/core/cloud_sync/backend/webdav_etag_reader.dart:14— WebDavEtagReader.read has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (5 pts), boolean chains 3, error handling 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.
LoopbackCloudDriveOAuthClient._validatedIdentity (cognitive 22) lib/core/cloud_sync/oauth/loopback_oauth_client.dart:494— LoopbackCloudDriveOAuthClient._validatedIdentity has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (10 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.
AssetDatabaseManager._install (cognitive 22) lib/core/database/asset_database_manager.dart:82— AssetDatabaseManager._install has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 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.
CharacterPromptBlockParser._removeBlocks (cognitive 22) lib/core/utils/character_prompt_block_parser.dart:232— CharacterPromptBlockParser._removeBlocks has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (7 pts), boolean chains 5 (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.
InpaintMaskGeometry._fillPolygon (cognitive 22) lib/core/utils/inpaint_mask/inpaint_mask_geometry.dart:276— InpaintMaskGeometry._fillPolygon has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 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.
PromptLiteralScanner._angleEnd (cognitive 22) lib/core/utils/prompt_literal_scanner.dart:49— PromptLiteralScanner._angleEnd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, 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.
TextSpaceConverter.convert (cognitive 22) lib/core/utils/text_space_converter.dart:25— TextSpaceConverter.convert has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4, boolean chains 3, 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.
WatermarkLogoService._detectExtension (cognitive 22) lib/core/watermark/watermark_logo_service.dart:151— WatermarkLogoService._detectExtension has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 19, 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.
AppCloudSyncDataSource.readVerifiedCloudObjects (cognitive 22) lib/data/cloud_sync/app_cloud_sync_data_source.dart:686— AppCloudSyncDataSource.readVerifiedCloudObjects has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 7, loops 1 (2 pts), error handling 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.
NAIAuthApiService.validateToken (cognitive 22) lib/data/datasources/remote/nai_auth_api_service.dart:56— NAIAuthApiService.validateToken has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 5 (7 pts), boolean chains 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.
DonmaiGallerySourceAdapter._randomSearch (cognitive 22) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:328— DonmaiGallerySourceAdapter._randomSearch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (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.
DlssWorker.run (cognitive 22) lib/data/services/dlss/dlss_worker.dart:40— DlssWorker.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 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.
QuickTagCloudParser.parseCodex (cognitive 22) lib/data/services/online_gallery/quick_tag_cloud_parser.dart:249— QuickTagCloudParser.parseCodex has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 14, if/else 4 (5 pts), boolean chains 2, 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.
QuickTagCloudParser.normalizeImages (cognitive 22) lib/data/services/online_gallery/quick_tag_cloud_parser.dart:450— QuickTagCloudParser.normalizeImages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, ternaries 3, 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.
PreciseRefLibraryArchiveService.exportToPath (cognitive 22) lib/data/services/precise_ref_library_archive_service.dart:34— PreciseRefLibraryArchiveService.exportToPath has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 1 (3 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.
TagLibraryPortableThumbnailStore.stage (cognitive 22) lib/data/services/tag_library_portable_thumbnail_store.dart:47— TagLibraryPortableThumbnailStore.stage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2 (3 pts), 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.
AgentChatNotifier._compactContext (cognitive 22) lib/presentation/agent_chat/providers/agent_chat_notifier.dart:505— AgentChatNotifier._compactContext has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, ternaries 1 (3 pts), 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.
_AgentChatResourcePickerBodyState._loadLocalGallery (cognitive 22) lib/presentation/agent_chat/widgets/agent_chat_resource_widgets.dart:817— _AgentChatResourcePickerBodyState._loadLocalGallery has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, ternaries 2 (3 pts), error handling 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.
AssistantModelCatalog._resolvePiProvider (cognitive 22) lib/presentation/prompt_assistant/models/assistant_model_capability.dart:361— AssistantModelCatalog._resolvePiProvider has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 1, 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.
_PromptAssistantOverlayState._runAction (cognitive 22) lib/presentation/prompt_assistant/widgets/prompt_assistant_overlay.dart:242— _PromptAssistantOverlayState._runAction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8, 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.
SubscriptionNotifier.build (cognitive 22) lib/presentation/providers/subscription_provider.dart:52— SubscriptionNotifier.build has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 10, 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.
HistoryPanelHeader.build (cognitive 22) lib/presentation/screens/generation/widgets/history_panel/history_panel_header.dart:30— HistoryPanelHeader.build has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 4 (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.
SidebarLinkPainter.paint (cognitive 22) lib/presentation/screens/generation/widgets/sidebar_link_painter.dart:28— SidebarLinkPainter.paint has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (9 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.
OnlineGalleryScrollPrefetchCoordinator.onScroll (cognitive 22) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:94— OnlineGalleryScrollPrefetchCoordinator.onScroll has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, ternaries 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.
_ProviderModelListState.build (cognitive 22) lib/presentation/screens/settings/sections/model_services/provider_models_card.dart:144— _ProviderModelListState.build has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (6 pts), ternaries 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.
_EntryCardState.build (cognitive 22) lib/presentation/screens/tag_library_page/widgets/entry_card.dart:82— _EntryCardState.build has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 7 (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.
_EntryListItemState.build (cognitive 22) lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:64— _EntryListItemState.build has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 7 (8 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.
_AutocompleteWrapperState._buildOverlay (cognitive 22) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:507— _AutocompleteWrapperState._buildOverlay has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 11, boolean chains 9, if/else 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.
ImageCardActionCatalog.build (cognitive 22) lib/presentation/widgets/common/image_card_actions.dart:56— ImageCardActionCatalog.build has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 5 (7 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.
UpdateCheckDialog._buildActions (cognitive 22) lib/presentation/widgets/common/update_check_dialog.dart:682— UpdateCheckDialog._buildActions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 2 (4 pts), boolean chains 1, 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.
InpaintMaskActionsController.fillClosedMaskRegionsAt (cognitive 22) lib/presentation/widgets/image_editor/controllers/inpaint_mask_actions_controller.dart:38— InpaintMaskActionsController.fillClosedMaskRegionsAt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, error handling 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.
_GalleryDetailActionRailState._entries (cognitive 22) lib/presentation/widgets/online_gallery/gallery_detail_action_rail.dart:67— _GalleryDetailActionRailState._entries has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, ternaries 5 (8 pts), if/else 3 (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.
GalleryDetailInfoPanel._buildCodexOverview (cognitive 22) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:565— GalleryDetailInfoPanel._buildCodexOverview has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (7 pts), loops 2 (3 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.
OnlineGalleryCardStatusOverlays.build (cognitive 22) lib/presentation/widgets/online_gallery/online_gallery_card_status_overlays.dart:25— OnlineGalleryCardStatusOverlays.build has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8, 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.
_TaskEditDialogState._buildParametersSection (cognitive 22) lib/presentation/widgets/queue/task_edit_dialog.dart:238— _TaskEditDialogState._buildParametersSection has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 7, 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.
OnlineGalleryPrefetchCoordinator._run (cognitive 21) lib/core/cache/online_gallery_prefetch_coordinator.dart:412— OnlineGalleryPrefetchCoordinator._run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 1 (3 pts), 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.
SqliteGalleryImageRepository.getImagesByIds (cognitive 21) lib/core/database/datasources/gallery_image_repository.dart:303— SqliteGalleryImageRepository.getImagesByIds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (8 pts), error handling 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.
PromptTokenCounterService._normalizePromptForCounting (cognitive 21) lib/core/services/prompt_token_counter_service.dart:185— PromptTokenCounterService._normalizePromptForCounting has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, 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.
ExifContainer.jpegHeaderSegments (cognitive 21) lib/core/utils/exif_container.dart:48— ExifContainer.jpegHeaderSegments has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, 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.
FileExplorerUtils._tryRevealFileWithShellApiUnsafe (cognitive 21) lib/core/utils/file_explorer_utils.dart:140— FileExplorerUtils._tryRevealFileWithShellApiUnsafe 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.
HiveStorageHelper._cleanupMigratedOldFiles (cognitive 21) lib/core/utils/hive_storage_helper.dart:339— HiveStorageHelper._cleanupMigratedOldFiles has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), error handling 1 (3 pts), loops 2 (3 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.
InpaintMaskUtils.prepareNovelAiInpaintMaskArtifacts (cognitive 21) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:755— InpaintMaskUtils.prepareNovelAiInpaintMaskArtifacts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6, 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, 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.
InpaintOutpaintUtils.materializeVirtualFrame (cognitive 21) lib/core/utils/inpaint_outpaint_utils.dart:509— InpaintOutpaintUtils.materializeVirtualFrame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, loops 2 (3 pts), 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.
VibeLibraryCloudSyncAdapter.apply (cognitive 21) lib/data/cloud_sync/vibe_library_cloud_sync_adapter.dart:138— VibeLibraryCloudSyncAdapter.apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 1 (3 pts), error handling 1 (2 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.
QuickTagCloudGalleryRepository.recordFor (cognitive 21) lib/data/datasources/remote/online_gallery/quick_tag_cloud_gallery_repository.dart:140— QuickTagCloudGalleryRepository.recordFor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), boolean chains 1, error handling 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.
NaiImageMetadataRawDecoder._extractVibeReferences (cognitive 21) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:533— NaiImageMetadataRawDecoder._extractVibeReferences has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (8 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.
NaiImageMetadataRawDecoder._modelIdFromSourceText (cognitive 21) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:975— NaiImageMetadataRawDecoder._modelIdFromSourceText has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 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.
ChunkedGalleryItems.mergePage (cognitive 21) lib/data/models/online_gallery/chunked_gallery_items.dart:67— ChunkedGalleryItems.mergePage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (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.
GalleryPromptCopyProjection.buildText (cognitive 21) lib/data/models/online_gallery/gallery_prompt_projection.dart:123— GalleryPromptCopyProjection.buildText has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, 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.
TagLibraryEntry.promptTagCount (cognitive 21) lib/data/models/tag_library/tag_library_entry.dart:118— TagLibraryEntry.promptTagCount has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 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.
GalleryAlbumImportCoordinator._importFromLegacyCollections (cognitive 21) lib/data/services/gallery/gallery_album_import_coordinator.dart:140— GalleryAlbumImportCoordinator._importFromLegacyCollections has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (4 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.
FilterCriteria.hasFilters (cognitive 21) lib/data/services/gallery/gallery_filter_service.dart:154— FilterCriteria.hasFilters 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.
FilterCriteria.cacheKey (cognitive 21) lib/data/services/gallery/gallery_filter_service.dart:196— FilterCriteria.cacheKey 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.
InpaintDraftFileRepository._load (cognitive 21) lib/data/services/inpaint_draft_file_repository.dart:97— InpaintDraftFileRepository._load has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, error handling 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.
ImageMetadataContainerCodec.embedTextChunkOnly (cognitive 21) lib/data/services/metadata/image_metadata_container_codec.dart:238— ImageMetadataContainerCodec.embedTextChunkOnly has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), boolean chains 1, 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.
OnlineGalleryBlacklistFilterService.filter (cognitive 21) lib/data/services/online_gallery/online_gallery_blacklist_filter_service.dart:15— OnlineGalleryBlacklistFilterService.filter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (7 pts), error handling 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.
PreciseRefPortableImporter.import (cognitive 21) lib/data/services/precise_ref_portable_importer.dart:107— PreciseRefPortableImporter.import has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, error handling 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.
VibeFileDocumentCodec._mergeCompatibleEncodings (cognitive 21) lib/data/services/vibe_file_document_codec.dart:252— VibeFileDocumentCodec._mergeCompatibleEncodings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (7 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.
GenerationInterrogationService._loadImage (cognitive 21) lib/presentation/agent_chat/services/generation_interrogation_service.dart:183— GenerationInterrogationService._loadImage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, error handling 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.
ManualInpaintToolbox._observeEditor (cognitive 21) lib/presentation/agent_chat/services/manual_inpaint_toolbox.dart:507— ManualInpaintToolbox._observeEditor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 3 (7 pts), error handling 2 (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.
AgentChatInputController.buildTextSpan (cognitive 21) lib/presentation/agent_chat/widgets/agent_chat_input_controller.dart:43— AgentChatInputController.buildTextSpan has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (15 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.
OnlineGalleryBlacklistNotifier.pullFromCloud (cognitive 21) lib/presentation/providers/online_gallery_blacklist_provider.dart:293— OnlineGalleryBlacklistNotifier.pullFromCloud has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 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.
OnlineGalleryNotifier.goToPage (cognitive 21) lib/presentation/providers/online_gallery_provider.dart:532— OnlineGalleryNotifier.goToPage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, 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.
OnlineGalleryGrid.build (cognitive 21) lib/presentation/screens/online_gallery/online_gallery_grid.dart:87— OnlineGalleryGrid.build has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 6, if/else 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.
OnlineGalleryPagination._buildBar (cognitive 21) lib/presentation/screens/online_gallery/online_gallery_pagination.dart:35— OnlineGalleryPagination._buildBar has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 7, 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.
OnlineGalleryScrollPrefetchCoordinator._requestNextIfNeeded (cognitive 21) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:177— OnlineGalleryScrollPrefetchCoordinator._requestNextIfNeeded has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 6, ternaries 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.
_GenerationSettingsSectionState.build (cognitive 21) lib/presentation/screens/settings/sections/generation_settings_section.dart:115— _GenerationSettingsSectionState.build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 7 (8 pts), error handling 2, 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.
_WorkflowImportWizardState._pickWorkflowFile (cognitive 21) lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:318— _WorkflowImportWizardState._pickWorkflowFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, 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.
VibeImportController._processSources (cognitive 21) lib/presentation/screens/vibe_library/vibe_import_controller.dart:300— VibeImportController._processSources has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, 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.
DroppedFileReader.downloadRemoteMetadataPrefix (cognitive 21) lib/presentation/utils/dropped_file_reader.dart:511— DroppedFileReader.downloadRemoteMetadataPrefix has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
_CredentialsLoginFormState.build (cognitive 21) lib/presentation/widgets/auth/credentials_login_form.dart:50— _CredentialsLoginFormState.build has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (6 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.
AutocompleteUtils._parseCurrentTagSegment (cognitive 21) lib/presentation/widgets/autocomplete/autocomplete_utils.dart:161— AutocompleteUtils._parseCurrentTagSegment has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 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.
_AutocompleteWrapperState._onTextChanged (cognitive 21) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:281— _AutocompleteWrapperState._onTextChanged has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 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.
_IncomingImageShareHandlerState._drain (cognitive 21) lib/presentation/widgets/drop/incoming_image_share_handler.dart:85— _IncomingImageShareHandlerState._drain has cognitive complexity 21 (threshold 15). Drivers by points: if/else 2 (9 pts), loops 2 (5 pts), error handling 1 (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.
_GalleryCategoryTreeViewState._buildCategoryNode (cognitive 21) lib/presentation/widgets/gallery/gallery_category_tree_view.dart:191— _GalleryCategoryTreeViewState._buildCategoryNode has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 7, if/else 4 (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.
InputHandler.handlePointerDown (cognitive 21) lib/presentation/widgets/image_editor/core/input_handler.dart:371— InputHandler.handlePointerDown has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 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.
SessionState.findEntriesOnBranch (cognitive 20) lib/core/agent/harness/session/session_state.dart:267— SessionState.findEntriesOnBranch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 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.
PromptTokenParser.apply (cognitive 20) lib/core/autocomplete/prompt_token_parser.dart:293— PromptTokenParser.apply has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 5, if/else 4 (5 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.
FocusedInpaintUtils._findBinaryMaskBounds (cognitive 20) lib/core/utils/focused_inpaint_utils.dart:596— FocusedInpaintUtils._findBinaryMaskBounds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 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.
InpaintMaskUtils.encodeEditorOverlayPatch (cognitive 20) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:217— InpaintMaskUtils.encodeEditorOverlayPatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (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.
NaiPromptParser._extractWeight (cognitive 20) lib/core/utils/nai_prompt_parser.dart:167— NaiPromptParser._extractWeight has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 2, ternaries 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.
PromptEditDocument._span (cognitive 20) lib/core/utils/prompt_edit_document.dart:170— PromptEditDocument._span has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 8. 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.
PromptEditDocument.effectiveText (cognitive 20) lib/core/utils/prompt_edit_document.dart:346— PromptEditDocument.effectiveText has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 3 (4 pts), ternaries 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.
VibeLibraryPathHelper._migrateFromOldLocationIfNeeded (cognitive 20) lib/core/utils/vibe_library_path_helper.dart:86— VibeLibraryPathHelper._migrateFromOldLocationIfNeeded has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (4 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.
CloudSyncOperationStorage._validRecordIndex (cognitive 20) lib/data/cloud_sync/cloud_sync_operation_storage.dart:488— CloudSyncOperationStorage._validRecordIndex has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 20. 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.
AiTagGenerationInfo.toJson (cognitive 20) lib/data/models/online_gallery/ai_tag_generation_info.dart:87— AiTagGenerationInfo.toJson has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AccountManagerNotifier.addAccount (cognitive 20) lib/data/services/account_manager_provider.dart:148— AccountManagerNotifier.addAccount has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 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.
AgentChatSessionController._finishTurn (cognitive 20) lib/presentation/agent_chat/services/agent_chat_session_controller.dart:516— AgentChatSessionController._finishTurn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, 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.
KritaBridgeService._generate (cognitive 20) lib/presentation/providers/krita/krita_bridge_service.dart:199— KritaBridgeService._generate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 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.
QueueExecutionNotifier._onGenerationStateChanged (cognitive 20) lib/presentation/providers/queue_execution_provider.dart:584— QueueExecutionNotifier._onGenerationStateChanged 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.
RandomPresetNotifier._loadPresets (cognitive 20) lib/presentation/providers/random_preset_provider.dart:115— RandomPresetNotifier._loadPresets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (4 pts), loops 3, boolean chains 2, error handling 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.
_HeatmapChartState.build (cognitive 20) lib/presentation/screens/statistics/widgets/charts/heatmap_chart.dart:94— _HeatmapChartState.build has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12, boolean chains 5, loops 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.
_CategoryItemState.build (cognitive 20) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:359— _CategoryItemState.build has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12 (14 pts), boolean chains 3, if/else 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.
_VibeDetailViewerState._imageBytes (cognitive 20) lib/presentation/screens/vibe_library/widgets/vibe_detail_viewer.dart:408— _VibeDetailViewerState._imageBytes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 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.
DroppedFileReader._resolve (cognitive 20) lib/presentation/utils/dropped_file_reader.dart:95— DroppedFileReader._resolve has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, ternaries 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.
_AutocompleteWrapperState._onCompletionStateChanged (cognitive 20) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:449— _AutocompleteWrapperState._onCompletionStateChanged has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), ternaries 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.
_ActionButton.build (cognitive 20) lib/presentation/widgets/bulk_action_bar.dart:381— _ActionButton.build has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, ternaries 6 (9 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.
AppStateView.build (cognitive 20) lib/presentation/widgets/common/app_state_view.dart:49— AppStateView.build has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 5 (6 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.
_ThemedInputState.build (cognitive 20) lib/presentation/widgets/common/themed_input.dart:291— _ThemedInputState.build has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (7 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.
_HoverPreviewCardInnerState.build (cognitive 20) lib/presentation/widgets/danbooru_post_card.dart:979— _HoverPreviewCardInnerState.build has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 4 (6 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.
EditorExitCoordinator.exportAndClose (cognitive 20) lib/presentation/widgets/image_editor/controllers/editor_exit_coordinator.dart:70— EditorExitCoordinator.exportAndClose has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, ternaries 1 (2 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.
InpaintMaskActionsController.loadMaskFile (cognitive 20) lib/presentation/widgets/image_editor/controllers/inpaint_mask_actions_controller.dart:118— InpaintMaskActionsController.loadMaskFile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, error handling 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.
_GlobalSettingsDialogState._showAddTagOptionDialog (cognitive 20) lib/presentation/widgets/prompt/global_settings_dialog.dart:492— _GlobalSettingsDialogState._showAddTagOptionDialog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 5 (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.
_TaskListItemState._buildActionButtons (cognitive 20) lib/presentation/widgets/queue/task_list_item.dart:440— _TaskListItemState._buildActionButtons has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, match/switch 1 (2 pts), 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.
acceptance_report._manual_evidence_from_args (cognitive 20) krita_plugin/acceptance_report.py:477— acceptance_report._manual_evidence_from_args has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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.
editor.applySceneState (cognitive 20) assets/model3d_editor/editor.js:486— editor.applySceneState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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.
AgentProfileService.previewImport (cognitive 19) lib/core/agent/agent_profile_service.dart:35— AgentProfileService.previewImport has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 3, 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.
SkillArchiveService.install (cognitive 19) lib/core/agent/skill_archive_service.dart:205— SkillArchiveService.install has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), error handling 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.
TagCatalogRepository.search (cognitive 19) lib/core/autocomplete/tag_catalog_repository.dart:47— TagCatalogRepository.search has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 3, 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.
TagCatalogRepository.searchTranslations (cognitive 19) lib/core/autocomplete/tag_catalog_repository.dart:268— TagCatalogRepository.searchTranslations has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 3 (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.
OnlineGalleryDetailCoordinator.request (cognitive 19) lib/core/cache/online_gallery_detail_coordinator.dart:52— OnlineGalleryDetailCoordinator.request 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.
SyncOperationRunner.run (cognitive 19) lib/core/cloud_sync/sync_operation_runner.dart:60— SyncOperationRunner.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, error handling 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.
ConnectionPoolHolder.warmup (cognitive 19) lib/core/database/connection_pool_holder.dart:162— ConnectionPoolHolder.warmup has cognitive complexity 19 (threshold 15). Drivers by points: error handling 5 (13 pts), if/else 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.
AuthInterceptor.onError (cognitive 19) lib/core/network/dio_client.dart:140— AuthInterceptor.onError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, error handling 1 (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.
DanbooruTagsRefreshService._fetchCategory (cognitive 19) lib/core/services/danbooru_tags_refresh_service.dart:157— DanbooruTagsRefreshService._fetchCategory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 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.
DiagnosticLogExportService._buildArchive (cognitive 19) lib/core/services/diagnostic_log_export_service.dart:160— DiagnosticLogExportService._buildArchive has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), ternaries 1 (4 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.
InpaintMaskUtils.fillClosedMaskRegions (cognitive 19) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:334— InpaintMaskUtils.fillClosedMaskRegions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4, 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.
InpaintOutpaintUtils._createExpandedMask (cognitive 19) lib/core/utils/inpaint_outpaint_utils.dart:1043— InpaintOutpaintUtils._createExpandedMask has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (8 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.
NovelAiVibeCodec._imageMimeType (cognitive 19) lib/core/utils/novelai_vibe_codec.dart:288— NovelAiVibeCodec._imageMimeType has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, 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.
StrictHiveCloudSyncAdapter._deepEquals (cognitive 19) lib/data/cloud_sync/strict_hive_cloud_sync_adapter.dart:274— StrictHiveCloudSyncAdapter._deepEquals has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 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.
NaiImageMetadataRawDecoder._extractNestedEncoding (cognitive 19) lib/data/models/gallery/nai_image_metadata_raw_decoder.dart:768— NaiImageMetadataRawDecoder._extractNestedEncoding has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, 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.
OnlineGalleryBlacklistRepository._isValidV2 (cognitive 19) lib/data/repositories/online_gallery_blacklist_repository.dart:80— OnlineGalleryBlacklistRepository._isValidV2 has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 3 (5 pts), loops 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.
DiscordShareService.authenticate (cognitive 19) lib/data/services/discord_share_service.dart:200— DiscordShareService.authenticate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, error handling 1 (2 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.
LocalOnnxModelService._inferKind (cognitive 19) lib/data/services/local_onnx_model_service.dart:597— LocalOnnxModelService._inferKind has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, 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.
NaiCommentComposer._fieldsComment (cognitive 19) lib/data/services/metadata/nai_comment_composer.dart:52— NaiCommentComposer._fieldsComment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, loops 3 (6 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.
OnlineGallerySearchService.filterByPlan (cognitive 19) lib/data/services/online_gallery/online_gallery_search_service.dart:134— OnlineGallerySearchService.filterByPlan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 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.
PreciseRefLibraryArchiveService._stageVerifiedResources (cognitive 19) lib/data/services/precise_ref_library_archive_service.dart:192— PreciseRefLibraryArchiveService._stageVerifiedResources has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 4, 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.
GenerationQueueTaskService.queueTask (cognitive 19) lib/presentation/agent_chat/services/generation_queue_task_service.dart:20— GenerationQueueTaskService.queueTask has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 1 (3 pts), boolean chains 2, ternaries 2, error handling 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.
InpaintDraftAuthoringService._commit (cognitive 19) lib/presentation/agent_chat/services/inpaint_draft_authoring_service.dart:256— InpaintDraftAuthoringService._commit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, 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.
ManualInpaintToolbox._create (cognitive 19) lib/presentation/agent_chat/services/manual_inpaint_toolbox.dart:405— ManualInpaintToolbox._create has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, error handling 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.
_AgentChatSessionPickerBodyState.build (cognitive 19) lib/presentation/agent_chat/widgets/agent_chat_session_picker.dart:232— _AgentChatSessionPickerBodyState.build has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 15, if/else 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.
_ToolResultResourcePreviewState._openOriginal (cognitive 19) lib/presentation/agent_chat/widgets/agent_chat_tool_resource_preview.dart:96— _ToolResultResourcePreviewState._openOriginal has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 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.
_WorkItemGroupTileState.build (cognitive 19) lib/presentation/agent_chat/widgets/agent_chat_turn.dart:644— _WorkItemGroupTileState.build has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 5 (7 pts), loops 1 (2 pts), 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.
AgentSettingsNotifier._load (cognitive 19) lib/presentation/agent_settings/providers/agent_settings_provider.dart:103— AgentSettingsNotifier._load has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (3 pts), 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.
McpImageResponseService._imageContent (cognitive 19) lib/presentation/mcp/services/mcp_image_response_service.dart:216— McpImageResponseService._imageContent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, error handling 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.
PromptAssistantService._detectImageMime (cognitive 19) lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:687— PromptAssistantService._detectImageMime has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 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.
ImageUpscaleCoordinator._runSeedVr2 (cognitive 19) lib/presentation/providers/generation/image_upscale_coordinator.dart:180— ImageUpscaleCoordinator._runSeedVr2 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (7 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.
VibeExportHandler.embedIntoImage (cognitive 19) lib/presentation/screens/generation/handlers/vibe_export_handler.dart:208— VibeExportHandler.embedIntoImage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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.
GenerateButtonWithCost._buildPrimaryButton (cognitive 19) lib/presentation/screens/generation/widgets/generation_controls/generate_button.dart:111— GenerateButtonWithCost._buildPrimaryButton has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (12 pts), if/else 4, 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.
PromptInputToolbar.build (cognitive 19) lib/presentation/screens/generation/widgets/prompt_input_toolbar.dart:40— PromptInputToolbar.build has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (8 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.
OnlineGalleryScrollPrefetchCoordinator._loadNextForDemand (cognitive 19) lib/presentation/screens/online_gallery/online_gallery_scroll_prefetch_coordinator.dart:232— OnlineGalleryScrollPrefetchCoordinator._loadNextForDemand has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, 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.
_AnimatedRefreshButtonState.build (cognitive 19) lib/presentation/screens/statistics/widgets/dashboard/animated_refresh_button.dart:54— _AnimatedRefreshButtonState.build has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 7, if/else 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.
_VibeLibraryContentViewState._updateEntryParams (cognitive 19) lib/presentation/screens/vibe_library/widgets/vibe_library_content_view.dart:699— _VibeLibraryContentViewState._updateEntryParams has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 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.
CardResourceDragFactory.create (cognitive 19) lib/presentation/utils/card_resource_drag_factory.dart:32— CardResourceDragFactory.create has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, 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.
_SaveVibeDialogState._save (cognitive 19) lib/presentation/widgets/common/save_vibe_dialog.dart:125— _SaveVibeDialogState._save has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, error handling 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.
_WeightAdjustToolbar.build (cognitive 19) lib/presentation/widgets/common/weight_adjust_toolbar.dart:383— _WeightAdjustToolbar.build has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 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.
_DanbooruPostCardState._buildNoImageContent (cognitive 19) lib/presentation/widgets/danbooru_post_card.dart:302— _DanbooruPostCardState._buildNoImageContent has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 4, 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.
_LocalImageHoverPreviewCardState._buildPreview (cognitive 19) lib/presentation/widgets/gallery/local_image_hover_preview.dart:238— _LocalImageHoverPreviewCardState._buildPreview has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 5, 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.
ColorPickerTool._updatePreviewDebounced (cognitive 19) lib/presentation/widgets/image_editor/tools/color_picker_tool.dart:283— ColorPickerTool._updatePreviewDebounced has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (9 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.
TagEditorSession.select (cognitive 19) lib/presentation/widgets/prompt/tag_editor_session.dart:247— TagEditorSession.select has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (6 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.
TagEditorSession.moveSelectedBefore (cognitive 19) lib/presentation/widgets/prompt/tag_editor_session.dart:536— TagEditorSession.moveSelectedBefore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 4 (5 pts), boolean chains 4, ternaries 4 (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.
SessionJsonlLineStorage._truncateIncompleteTailSync (cognitive 18) lib/core/agent/harness/session/jsonl/session_jsonl_line_storage.dart:59— SessionJsonlLineStorage._truncateIncompleteTailSync 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.
CooccurrenceSqliteRepository.validateAndOpen (cognitive 18) lib/core/autocomplete/cooccurrence_sqlite_repository.dart:26— CooccurrenceSqliteRepository.validateAndOpen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 3, 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.
ZhDictionaryDownloader.fetchLatestSource (cognitive 18) lib/core/autocomplete/zh_dictionary_download.dart:34— ZhDictionaryDownloader.fetchLatestSource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, error handling 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.
OneDriveApiClient.listChildren (cognitive 18) lib/core/cloud_sync/backend/onedrive_api_client.dart:301— OneDriveApiClient.listChildren has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 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.
SnapshotObjectPacker.pack (cognitive 18) lib/core/cloud_sync/snapshot_object_packer.dart:12— SnapshotObjectPacker.pack has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (7 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.
EnhancedBaseDataSource.execute (cognitive 18) lib/core/database/base_data_source.dart:41— EnhancedBaseDataSource.execute has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 2 (4 pts), ternaries 1 (4 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.
ConnectionPool._startEvictionTimer (cognitive 18) lib/core/database/connection_pool.dart:396— ConnectionPool._startEvictionTimer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 1 (4 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.
SqliteGalleryQuery.searchByDelimitedTextSegments (cognitive 18) lib/core/database/datasources/gallery_query.dart:278— SqliteGalleryQuery.searchByDelimitedTextSegments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 3 (8 pts), boolean chains 1, 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.
GalleryExceptionConverter.convert (cognitive 18) lib/core/exceptions/gallery_exceptions.dart:231— GalleryExceptionConverter.convert has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 6, if/else 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.
GalleryTagQueryParser.parse (cognitive 18) lib/core/online_gallery/gallery_tag_query.dart:157— GalleryTagQueryParser.parse has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (6 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.
DesktopAppShutdownService._performShutdown (cognitive 18) lib/core/services/desktop_app_shutdown_service.dart:38— DesktopAppShutdownService._performShutdown has cognitive complexity 18 (threshold 15). Drivers by points: error handling 7 (11 pts), boolean chains 4, if/else 2, 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.
QwenPromptTokenEncoder._mergeCount (cognitive 18) lib/core/services/tokenizers/qwen_prompt_token_encoder.dart:127— QwenPromptTokenEncoder._mergeCount has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (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.
VerifiedResumableDownloader._download (cognitive 18) lib/core/services/verified_resumable_downloader.dart:147— VerifiedResumableDownloader._download has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 5, ternaries 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.
InpaintMaskUtils.fillEditorMaskRegionAtPoint (cognitive 18) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:482— InpaintMaskUtils.fillEditorMaskRegionAtPoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, loops 2, error handling 1 (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.
PromptRegexReplacer.expandReplacement (cognitive 18) lib/core/utils/prompt_regex_replacer.dart:112— PromptRegexReplacer.expandReplacement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 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.
VibeExportUtils._buildBundleVibesFromEntry (cognitive 18) lib/core/utils/vibe_export_utils.dart:481— VibeExportUtils._buildBundleVibesFromEntry has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 6, if/else 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.
CloudSyncOperationStorage.readSnapshot (cognitive 18) lib/data/cloud_sync/cloud_sync_operation_storage.dart:125— CloudSyncOperationStorage.readSnapshot has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 1 (2 pts), loops 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.
VibeLibraryCloudSyncAdapter.validateRecord (cognitive 18) lib/data/cloud_sync/vibe_library_cloud_sync_adapter.dart:106— VibeLibraryCloudSyncAdapter.validateRecord has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (6 pts), ternaries 1 (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.
DanbooruTagGroupService.getTagGroup (cognitive 18) lib/data/datasources/remote/danbooru_tag_group_service.dart:37— DanbooruTagGroupService.getTagGroup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 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.
DanbooruTagGroupService.syncTagGroupMappings (cognitive 18) lib/data/datasources/remote/danbooru_tag_group_service.dart:286— DanbooruTagGroupService.syncTagGroupMappings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 1, error handling 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.
NaiGenerationTransport.buildGenerationMultipart (cognitive 18) lib/data/datasources/remote/nai_generation_transport.dart:154— NaiGenerationTransport.buildGenerationMultipart has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 1, 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.
NAIImageEnhancementApiService._mapDioError (cognitive 18) lib/data/datasources/remote/nai_image_enhancement_api_service.dart:321— NAIImageEnhancementApiService._mapDioError has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (3 pts), boolean chains 2, 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.
NaiPromptExportCodec.tryDecode (cognitive 18) lib/data/models/gallery/nai_prompt_export_codec.dart:124— NaiPromptExportCodec.tryDecode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (6 pts), loops 3, error handling 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.
AiTagGenerationInfo.hasAnyParam (cognitive 18) lib/data/models/online_gallery/ai_tag_generation_info.dart:62— AiTagGenerationInfo.hasAnyParam 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.
BulkImageStateService._resolveImageIds (cognitive 18) lib/data/services/bulk_image_state_service.dart:172— BulkImageStateService._resolveImageIds has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 3 (6 pts), error handling 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.
FilterCriteria.copyWith (cognitive 18) lib/data/services/gallery/gallery_filter_service.dart:72— FilterCriteria.copyWith has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 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.
ExifMetadataExtractor._fromTiff (cognitive 18) lib/data/services/metadata/exif_metadata_extractor.dart:153— ExifMetadataExtractor._fromTiff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, ternaries 2 (4 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.
ExifUserCommentDecoder._decodeUtf16 (cognitive 18) lib/data/services/metadata/exif_user_comment_decoder.dart:39— ExifUserCommentDecoder._decodeUtf16 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, 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.
ImageMetadataContainerCodec.copySupportedMetadata (cognitive 18) lib/data/services/metadata/image_metadata_container_codec.dart:132— ImageMetadataContainerCodec.copySupportedMetadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (4 pts), ternaries 1 (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.
ImageMetadataContainerCodec.embedTextChunks (cognitive 18) lib/data/services/metadata/image_metadata_container_codec.dart:310— ImageMetadataContainerCodec.embedTextChunks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 2 (3 pts), 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.
MetadataTextDecoder.tryCombineParsers (cognitive 18) lib/data/services/metadata/metadata_text_decoder.dart:80— MetadataTextDecoder.tryCombineParsers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, error handling 1 (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.
CatalogRandomGeneratorStrategy._generateNoHumanPrompt (cognitive 18) lib/data/services/strategies/catalog_random_generator_strategy.dart:160— CatalogRandomGeneratorStrategy._generateNoHumanPrompt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 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.
TempImageService.cleanupOldTempFiles (cognitive 18) lib/data/services/temp_image_service.dart:78— TempImageService.cleanupOldTempFiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), error handling 2 (5 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.
AdaptivePresenter.showForm (cognitive 18) lib/presentation/adaptive/adaptive_presenter.dart:24— AdaptivePresenter.showForm has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 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.
GenerationImageFavoriteToolbox.setFavorite (cognitive 18) lib/presentation/agent_chat/services/generation_image_favorite_toolbox.dart:80— GenerationImageFavoriteToolbox.setFavorite has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 3 (4 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GalleryAlbumNotifier.exportSidecar (cognitive 18) lib/presentation/providers/gallery_album_provider.dart:273— GalleryAlbumNotifier.exportSidecar has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 2 (6 pts), ternaries 1 (3 pts), boolean chains 1, error handling 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.
ImageGenerationCoordinator._runFallbackWithRetry (cognitive 18) lib/presentation/providers/generation/image_generation_coordinator.dart:485— ImageGenerationCoordinator._runFallbackWithRetry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 4, error handling 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.
OnlineGalleryOutputFilterSettings._isFullyWrapped (cognitive 18) lib/presentation/providers/online_gallery_output_filter_provider.dart:106— OnlineGalleryOutputFilterSettings._isFullyWrapped 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.
VibeImportHandler.importDroppedResources (cognitive 18) lib/presentation/screens/generation/handlers/vibe_import_handler.dart:127— VibeImportHandler.importDroppedResources has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 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.
GenerationImageDeletion.confirmAndDelete (cognitive 18) lib/presentation/screens/generation/services/generation_image_deletion.dart:34— GenerationImageDeletion.confirmAndDelete has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2, 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.
_GenerationToggleButtonState.build (cognitive 18) lib/presentation/screens/generation/widgets/generation_toggle_button.dart:25— _GenerationToggleButtonState.build has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 3, 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.
_PreciseReferencePanelState._applyDroppedReferences (cognitive 18) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:519— _PreciseReferencePanelState._applyDroppedReferences has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, ternaries 1 (2 pts), 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.
_VibeCardState._buildEncodingStatusChip (cognitive 18) lib/presentation/screens/generation/widgets/vibe_card.dart:331— _VibeCardState._buildEncodingStatusChip has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 4, if/else 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.
_WebAccessSettingsState.build (cognitive 18) lib/presentation/screens/settings/sections/web_access_settings.dart:49— _WebAccessSettingsState.build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, ternaries 7, loops 2, 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.
_PolarChartPainter.paint (cognitive 18) lib/presentation/screens/statistics/widgets/charts/polar_activity_chart.dart:134— _PolarChartPainter.paint has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), loops 5 (6 pts), if/else 3 (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.
VibeDetailParamPanel._buildActionBar (cognitive 18) lib/presentation/screens/vibe_library/widgets/vibe_detail/vibe_detail_param_panel.dart:400— VibeDetailParamPanel._buildActionBar has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 4, match/switch 1 (2 pts), if/else 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.
VibeExportAdvancedExecutor.exportEncodingFile (cognitive 18) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_advanced_executor.dart:339— VibeExportAdvancedExecutor.exportEncodingFile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 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.
MetadataImportApplier.applyPromptAndGenerationParams (cognitive 18) lib/presentation/utils/metadata_import_applier.dart:54— MetadataImportApplier.applyPromptAndGenerationParams has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), 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.
BulkActionBar.build (cognitive 18) lib/presentation/widgets/bulk_action_bar.dart:53— BulkActionBar.build has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5 (8 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.
_CardDragSourceState._prepareSession (cognitive 18) lib/presentation/widgets/common/card_drag_source.dart:98— _CardDragSourceState._prepareSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 4, ternaries 1 (2 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.
_ImagePickerCardState._buildDefaultContent (cognitive 18) lib/presentation/widgets/common/image_picker_card/image_picker_card.dart:196— _ImagePickerCardState._buildDefaultContent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 3 (4 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.
_DiscordShareDialogState._buildVerificationState (cognitive 18) lib/presentation/widgets/discord_share/discord_share_dialog.dart:459— _DiscordShareDialogState._buildVerificationState has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 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.
_GalleryAlbumTreeViewState._buildAlbumContent (cognitive 18) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:189— _GalleryAlbumTreeViewState._buildAlbumContent has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 2, 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.
ToolManager._restoreToolSettings (cognitive 18) lib/presentation/widgets/image_editor/core/tool_manager.dart:115— ToolManager._restoreToolSettings 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.
ImageEditorEffectsController._apply (cognitive 18) lib/presentation/widgets/image_editor/effects/image_editor_effects_controller.dart:156— ImageEditorEffectsController._apply has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, match/switch 1 (2 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.
_MetadataImportDialogState._buildReferenceSection (cognitive 18) lib/presentation/widgets/metadata/metadata_import_dialog.dart:600— _MetadataImportDialogState._buildReferenceSection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 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.
BranchConditionsEditor._buildConditionRow (cognitive 18) lib/presentation/widgets/prompt/diy/panels/branch_conditions_editor.dart:136— BranchConditionsEditor._buildConditionRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3, boolean chains 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.
FixedTagLinkPainter.paint (cognitive 18) lib/presentation/widgets/prompt/fixed_tags_link_layer.dart:342— FixedTagLinkPainter.paint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 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.
NaiSyntaxController._styleDisabled (cognitive 18) lib/presentation/widgets/prompt/nai_syntax_controller.dart:373— NaiSyntaxController._styleDisabled has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (5 pts), boolean chains 3, 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.
NaiSyntaxController._applyOfficialEmphasis (cognitive 18) lib/presentation/widgets/prompt/nai_syntax_controller.dart:467— NaiSyntaxController._applyOfficialEmphasis has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 4, ternaries 1 (3 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.
UnifiedPromptConfig.== (cognitive 18) lib/presentation/widgets/prompt/unified/unified_prompt_config.dart:227— UnifiedPromptConfig.== has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, 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.
_QueueManagementPageState.build (cognitive 18) lib/presentation/widgets/queue/queue_management_page.dart:47— _QueueManagementPageState.build has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 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.
_ShortcutBindingEditorState._processKeyCombination (cognitive 18) lib/presentation/widgets/shortcuts/shortcut_binding_editor.dart:364— _ShortcutBindingEditorState._processKeyCombination has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 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.
_StatisticsExportDialogState._generateCsvExport (cognitive 18) lib/presentation/widgets/statistics/export_dialog.dart:398— _StatisticsExportDialogState._generateCsvExport 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.
OleDataInspector.Inspect (cognitive 17) tool/ole_drag_inspector/windows/Program.cs:337— OleDataInspector.Inspect has cognitive complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionJsonlCodec._decodeAssistantContent (cognitive 17) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:229— SessionJsonlCodec._decodeAssistantContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), match/switch 1 (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.
_TranslatableTagSlice.parse (cognitive 17) lib/core/autocomplete/tag_translation_lookup.dart:373— _TranslatableTagSlice.parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
LocalGalleryThumbnailMigration._isVerifiedLegacyThumbnail (cognitive 17) lib/core/cache/local_gallery_thumbnail_migration.dart:204— LocalGalleryThumbnailMigration._isVerifiedLegacyThumbnail has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, error handling 1, loops 1 (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.
OnlineGalleryPrefetchCoordinator.submit (cognitive 17) lib/core/cache/online_gallery_prefetch_coordinator.dart:222— OnlineGalleryPrefetchCoordinator.submit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 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.
SnapshotRecordRef.SnapshotRecordRef (cognitive 17) lib/core/cloud_sync/models.dart:19— SnapshotRecordRef.SnapshotRecordRef has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5 (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.
AssetDatabaseManager._migrateBundledCooccurrence (cognitive 17) lib/core/database/asset_database_manager.dart:313— AssetDatabaseManager._migrateBundledCooccurrence has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, error handling 1 (2 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.
ExaSearchClient.searchApi (cognitive 17) lib/core/network/web_access/exa_search_client.dart:64— ExaSearchClient.searchApi has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), error handling 3, if/else 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.
AvatarService.cleanupOrphanedAvatars (cognitive 17) lib/core/services/avatar_service.dart:206— AvatarService.cleanupOrphanedAvatars has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), error handling 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.
HardEdgeMaskExporter.exportRaster (cognitive 17) lib/core/utils/hard_edge_mask_exporter.dart:117— HardEdgeMaskExporter.exportRaster has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 3, ternaries 1 (3 pts), boolean chains 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.
OutpaintResolvedGeometry.== (cognitive 17) lib/core/utils/inpaint_outpaint_utils.dart:147— OutpaintResolvedGeometry.== has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 17. 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.
PicaLanczosResizer._createTiles (cognitive 17) lib/core/utils/pica_lanczos_resizer.dart:549— PicaLanczosResizer._createTiles 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.
PromptEditDocument.singleSelected (cognitive 17) lib/core/utils/prompt_edit_document.dart:326— PromptEditDocument.singleSelected has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, loops 4 (5 pts), if/else 2 (4 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.
VibeFileParser._extractThumbnailFromJson (cognitive 17) lib/core/utils/vibe_file_parser.dart:719— VibeFileParser._extractThumbnailFromJson has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, 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.
AppCloudSyncDataSource.captureLocal (cognitive 17) lib/data/cloud_sync/app_cloud_sync_data_source.dart:247— AppCloudSyncDataSource.captureLocal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (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.
AppCloudSyncDataSource._encodePortable (cognitive 17) lib/data/cloud_sync/app_cloud_sync_data_source.dart:281— AppCloudSyncDataSource._encodePortable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (5 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.
CloudSyncOperationStorage._snapshotOwners (cognitive 17) lib/data/cloud_sync/cloud_sync_operation_storage.dart:321— CloudSyncOperationStorage._snapshotOwners 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.
CloudSyncOperationStorage._pruneOrphanedState (cognitive 17) lib/data/cloud_sync/cloud_sync_operation_storage.dart:411— CloudSyncOperationStorage._pruneOrphanedState 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.
DanbooruTagGroupService.getTopLevelTagGroups (cognitive 17) lib/data/datasources/remote/danbooru_tag_group_service.dart:540— DanbooruTagGroupService.getTopLevelTagGroups has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 1 (3 pts), error handling 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.
AiTagGenerationInfo.modelBadgeLabel (cognitive 17) lib/data/models/online_gallery/ai_tag_generation_info.dart:187— AiTagGenerationInfo.modelBadgeLabel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 2 (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.
PostProcessRule.isTriggered (cognitive 17) lib/data/models/prompt/post_process_rule.dart:115— PostProcessRule.isTriggered has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 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.
EfficientVitSamModelManager.ensureModels (cognitive 17) lib/data/services/efficient_vit_sam_model_manager.dart:85— EfficientVitSamModelManager.ensureModels has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 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.
GalleryService._initializeService (cognitive 17) lib/data/services/gallery/unified_gallery_service.dart:48— GalleryService._initializeService has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 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.
AiTagGenerationParser._parseNaiJson (cognitive 17) lib/data/services/metadata/ai_tag_generation_parser.dart:407— AiTagGenerationParser._parseNaiJson has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (5 pts), error handling 1, ternaries 1 (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.
VibeFileRepository.overwriteBundleFile (cognitive 17) lib/data/services/vibe_file_repository.dart:146— VibeFileRepository.overwriteBundleFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (3 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.
MetadataFilterCriteria.matches (cognitive 17) lib/domain/entities/gallery_image_entity.dart:248— MetadataFilterCriteria.matches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7 (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.
AgentChatNotifier._init (cognitive 17) lib/presentation/agent_chat/providers/agent_chat_notifier.dart:180— AgentChatNotifier._init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 1 (2 pts), loops 1 (2 pts), 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.
AgentChatPanelCoordinator._editQueuedMessage (cognitive 17) lib/presentation/agent_chat/widgets/agent_chat_panel_coordinator.dart:367— AgentChatPanelCoordinator._editQueuedMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 1 (3 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.
_AgentChatToolResultTileState.build (cognitive 17) lib/presentation/agent_chat/widgets/agent_chat_tool_widgets.dart:147— _AgentChatToolResultTileState.build has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 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.
ComfyUITask._waitForWebSocketResult (cognitive 17) lib/presentation/providers/comfyui/comfyui_provider.dart:353— ComfyUITask._waitForWebSocketResult has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 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.
ComfyUISeedvr2Models._fetchFromServer (cognitive 17) lib/presentation/providers/comfyui/comfyui_provider.dart:597— ComfyUISeedvr2Models._fetchFromServer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 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.
RandomPresetNotifier.resetToDefault (cognitive 17) lib/presentation/providers/random_preset_provider.dart:648— RandomPresetNotifier.resetToDefault has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (7 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.
_PreciseReferencePanelState.build (cognitive 17) lib/presentation/screens/generation/widgets/precise_reference_panel.dart:59— _PreciseReferencePanelState.build has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 13, if/else 3, 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.
_MosaicEditorCanvasState._hitRegion (cognitive 17) lib/presentation/screens/mosaic/mosaic_editor_canvas.dart:292— _MosaicEditorCanvasState._hitRegion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 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.
OnlineGalleryDetailLauncher._downloadGalleryMediaBatch (cognitive 17) lib/presentation/screens/online_gallery/online_gallery_detail_launcher.dart:350— OnlineGalleryDetailLauncher._downloadGalleryMediaBatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (6 pts), loops 1 (2 pts), 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.
_OnlineGalleryScreenState._goToPage (cognitive 17) lib/presentation/screens/online_gallery/online_gallery_screen.dart:231— _OnlineGalleryScreenState._goToPage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, ternaries 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.
OnlineGalleryToolbarSearch._buildSearchFields (cognitive 17) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:130— OnlineGalleryToolbarSearch._buildSearchFields has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 6, 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.
_PreciseRefLibraryScreenState.build (cognitive 17) lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:589— _PreciseRefLibraryScreenState.build has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7, if/else 5 (6 pts), boolean chains 4 (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.
_EntryListItemState._buildActions (cognitive 17) lib/presentation/screens/tag_library_page/widgets/entry_list_item.dart:316— _EntryListItemState._buildActions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (7 pts), 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.
VibeExportAdvancedExecutor.exportSelectedInternalVibes (cognitive 17) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_advanced_executor.dart:179— VibeExportAdvancedExecutor.exportSelectedInternalVibes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2, ternaries 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.
_WatermarkEditorScreenState._chooseLogo (cognitive 17) lib/presentation/screens/watermark/watermark_editor_screen.dart:345— _WatermarkEditorScreenState._chooseLogo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 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.
GenerationHistoryStorageService._decodeRecord (cognitive 17) lib/presentation/services/generation_history_storage_service.dart:165— GenerationHistoryStorageService._decodeRecord has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, 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.
_TokenLoginCardState.build (cognitive 17) lib/presentation/widgets/auth/token_login_card.dart:37— _TokenLoginCardState.build has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 5 (7 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.
GalleryDetailInfoPanel._buildItemBadges (cognitive 17) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:282— GalleryDetailInfoPanel._buildItemBadges has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 2, loops 1 (2 pts), ternaries 1 (2 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.
FixedTagsDialogView.build (cognitive 17) lib/presentation/widgets/prompt/fixed_tags_dialog_view.dart:26— FixedTagsDialogView.build has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 13, boolean chains 3, if/else 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.
PromptDisplayController.value (cognitive 17) lib/presentation/widgets/prompt/prompt_display_controller.dart:109— PromptDisplayController.value has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 5, ternaries 3 (5 pts), loops 2 (4 pts), if/else 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.
TagEditorSession.replaceLabel (cognitive 17) lib/presentation/widgets/prompt/tag_editor_session.dart:412— TagEditorSession.replaceLabel has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10, if/else 3, boolean chains 2, loops 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.
_PromptScrollCoordinatorState._scrollAncestors (cognitive 17) lib/presentation/widgets/prompt/unified/prompt_scroll_coordinator.dart:226— _PromptScrollCoordinatorState._scrollAncestors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (5 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.
editor.clearCurrentModel (cognitive 17) assets/model3d_editor/editor.js:174— editor.clearCurrentModel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 179). The decisions are inside the literal, 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 literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
OneDriveApiClient._decodeItem (cognitive 16) lib/core/cloud_sync/backend/onedrive_api_client.dart:520— OneDriveApiClient._decodeItem has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, 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.
OneDriveCloudSyncBackend._commitMutable (cognitive 16) lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:357— OneDriveCloudSyncBackend._commitMutable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 2, error handling 1 (2 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.
SyncCoordinator.previewRestore (cognitive 16) lib/core/cloud_sync/coordinator.dart:276— SyncCoordinator.previewRestore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, ternaries 1 (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.
CloudDriveOAuthConfig.diagnose (cognitive 16) lib/core/cloud_sync/oauth/cloud_drive_oauth_config.dart:136— CloudDriveOAuthConfig.diagnose has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7 (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.
SqliteGalleryFavoriteTagRepository.getTagsByImageIds (cognitive 16) lib/core/database/datasources/gallery_favorite_tag_repository.dart:280— SqliteGalleryFavoriteTagRepository.getTagsByImageIds has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 2 (5 pts), boolean chains 1, error handling 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.
McpStreamableHttpTransport._handlePost (cognitive 16) lib/core/mcp/mcp_streamable_http_transport.dart:114— McpStreamableHttpTransport._handlePost has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 5, error handling 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.
ExaSearchClient._parseRpcEnvelope (cognitive 16) lib/core/network/web_access/exa_search_client.dart:288— ExaSearchClient._parseRpcEnvelope 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.
PixelSnapEngine._refineGrid (cognitive 16) lib/core/services/pixel_snap/pixel_snap_engine.dart:312— PixelSnapEngine._refineGrid has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 4 (7 pts) (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.
UpdateInstallerService.restorePendingUpdate (cognitive 16) lib/core/services/update_installer_service.dart:330— UpdateInstallerService.restorePendingUpdate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, ternaries 1 (2 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.
EfficientVitSamImageProcessor.parseLowResolutionMask (cognitive 16) lib/core/utils/efficient_vit_sam_image_processor.dart:138— EfficientVitSamImageProcessor.parseLowResolutionMask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 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.
InpaintOutpaintUtils._createResizedMask (cognitive 16) lib/core/utils/inpaint_outpaint_utils.dart:1092— InpaintOutpaintUtils._createResizedMask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 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.
PromptEditDocument.numericClosings (cognitive 16) lib/core/utils/prompt_edit_document.dart:284— PromptEditDocument.numericClosings 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.
AgentSystemPromptCloudSyncAdapter.validateRecord (cognitive 16) lib/data/cloud_sync/agent_cloud_sync_adapters.dart:55— AgentSystemPromptCloudSyncAdapter.validateRecord has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 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.
CloudSyncOperationStorage._reserveRef (cognitive 16) lib/data/cloud_sync/cloud_sync_operation_storage.dart:516— CloudSyncOperationStorage._reserveRef has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (3 pts), error handling 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.
DonmaiGallerySourceAdapter.ranking (cognitive 16) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:142— DonmaiGallerySourceAdapter.ranking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 2 (4 pts), error handling 3, loops 1 (2 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.
PromptAssistantConfigState.decode (cognitive 16) lib/data/models/prompt_assistant/prompt_assistant_models.dart:1225— PromptAssistantConfigState.decode has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (4 pts), 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.
DlssFloatFrame.decode (cognitive 16) lib/data/services/dlss/dlss_float_frame.dart:36— DlssFloatFrame.decode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, ternaries 1 (2 pts), 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.
EfficientVitSamService.selectRgba (cognitive 16) lib/data/services/efficient_vit_sam_service.dart:58— EfficientVitSamService.selectRgba has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), 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.
AiTagGenerationParser._buildNaiInfo (cognitive 16) lib/data/services/metadata/ai_tag_generation_parser.dart:478— AiTagGenerationParser._buildNaiInfo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 5, boolean chains 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.
MetadataWorkerPool._initializeReplacementWorker (cognitive 16) lib/data/services/metadata/metadata_worker_pool.dart:443— MetadataWorkerPool._initializeReplacementWorker has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 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.
VibeFileDocumentCodec.mergeCompatibleBundleMap (cognitive 16) lib/data/services/vibe_file_document_codec.dart:31— VibeFileDocumentCodec.mergeCompatibleBundleMap 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.
AgentImageObservationLedger._identityKeys (cognitive 16) lib/presentation/agent_chat/services/agent_image_observation_ledger.dart:92— AgentImageObservationLedger._identityKeys has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 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.
TagLibraryToolbox._createEntryWithThumbnail (cognitive 16) lib/presentation/agent_chat/services/tag_library_toolbox.dart:234— TagLibraryToolbox._createEntryWithThumbnail has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 2 (4 pts), ternaries 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.
AssistantModelCatalog.resolveProvider (cognitive 16) lib/presentation/prompt_assistant/models/assistant_model_capability.dart:198— AssistantModelCatalog.resolveProvider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, match/switch 1 (2 pts), ternaries 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.
PromptAssistantConfigNotifier.addProviderModels (cognitive 16) lib/presentation/prompt_assistant/providers/prompt_assistant_config_provider.dart:214— PromptAssistantConfigNotifier.addProviderModels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 5 (6 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.
CloudSyncApplicationService._detectRemote (cognitive 16) lib/presentation/providers/cloud_sync/cloud_sync_application_service.dart:131— CloudSyncApplicationService._detectRemote has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (4 pts), boolean chains 3, 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.
ComfyUITask.execute (cognitive 16) lib/presentation/providers/comfyui/comfyui_provider.dart:180— ComfyUITask.execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, error handling 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.
DlssController._enhance (cognitive 16) lib/presentation/providers/dlss_provider.dart:345— DlssController._enhance has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 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.
BatchGenerationNotifier._generateSingle (cognitive 16) lib/presentation/providers/generation/batch_generation_notifier.dart:327— BatchGenerationNotifier._generateSingle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (2 pts), boolean chains 1, 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.
QueueExecutionNotifier._generateReadyTask (cognitive 16) lib/presentation/providers/queue_execution_provider.dart:440— QueueExecutionNotifier._generateReadyTask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (6 pts), 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.
DerivativeEditorLauncher.openForLocalPath (cognitive 16) lib/presentation/screens/derivatives/derivative_editor_launcher.dart:110— DerivativeEditorLauncher.openForLocalPath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, 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.
_DlssEnhancementPanelState._controls (cognitive 16) lib/presentation/screens/dlss/dlss_enhancement_panel.dart:229— _DlssEnhancementPanelState._controls has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 4, 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.
_EnhancePanelState.build (cognitive 16) lib/presentation/screens/generation/widgets/img2img_adjustment_section.dart:157— _EnhancePanelState.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 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.
_TooltipFinalPromptSectionState.build (cognitive 16) lib/presentation/screens/generation/widgets/prompt_tooltip_components.dart:375— _TooltipFinalPromptSectionState.build has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 4, 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.
OnlineGalleryRatingDropdown.build (cognitive 16) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar.dart:692— OnlineGalleryRatingDropdown.build has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10, if/else 4, 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.
MetadataImportCoordinator._applyFixedTags (cognitive 16) lib/presentation/utils/metadata_import_coordinator.dart:94— MetadataImportCoordinator._applyFixedTags has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, 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.
_AutocompleteWrapperState._onPointerUp (cognitive 16) lib/presentation/widgets/autocomplete/autocomplete_wrapper.dart:778— _AutocompleteWrapperState._onPointerUp has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 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.
_SaveVibeDialogState.build (cognitive 16) lib/presentation/widgets/common/save_vibe_dialog.dart:181— _SaveVibeDialogState.build has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 5, 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.
UpdateNoticeBanner.build (cognitive 16) lib/presentation/widgets/common/update_notice_banner.dart:42— UpdateNoticeBanner.build has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 11, boolean chains 3, if/else 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.
_DanbooruPostCardState._handleDownload (cognitive 16) lib/presentation/widgets/danbooru_post_card.dart:258— _DanbooruPostCardState._handleDownload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 pts), 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.
_DiscordShareDialogState._initialize (cognitive 16) lib/presentation/widgets/discord_share/discord_share_dialog.dart:167— _DiscordShareDialogState._initialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2, 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.
GlobalDropActionCoordinator._handleVibeTransfer (cognitive 16) lib/presentation/widgets/drop/global_drop_action_coordinator.dart:410— GlobalDropActionCoordinator._handleVibeTransfer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (3 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
_PromptSelectionCardState.build (cognitive 16) lib/presentation/widgets/drop/image_destination_dialog.dart:1140— _PromptSelectionCardState.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 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.
_LocalGalleryToolbarState._pickDateAndJump (cognitive 16) lib/presentation/widgets/gallery/local_gallery_toolbar.dart:520— _LocalGalleryToolbarState._pickDateAndJump has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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.
_GelbooruCredentialsDialogState.build (cognitive 16) lib/presentation/widgets/gelbooru_credentials_dialog.dart:115— _GelbooruCredentialsDialogState.build has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 6, 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.
WorkspaceDesktopMenuBar.build (cognitive 16) lib/presentation/widgets/image_editor/workspace/workspace_desktop_layout.dart:195— WorkspaceDesktopMenuBar.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 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.
PromptWeightEditing.protectNegativeBlockSyntax (cognitive 16) lib/presentation/widgets/prompt/prompt_weight_editing.dart:42— PromptWeightEditing.protectNegativeBlockSyntax has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, 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.
PromptWeightEditing.parseWeightSyntax (cognitive 16) lib/presentation/widgets/prompt/prompt_weight_editing.dart:309— PromptWeightEditing.parseWeightSyntax has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, 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.
_TagEditorViewState.build (cognitive 16) lib/presentation/widgets/prompt/tag_editor_view.dart:849— _TagEditorViewState.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 4 (5 pts), boolean chains 4 (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.
FunctionTooLong: nai_inpaint_parity_browser.main tool/diagnostics/nai_inpaint_parity_browser.cjs:161— FunctionTooLong — main runs 378 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× 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.
D4 · Code Duplication· Near-duplicate member family (4 members, 33 shared lines) · ×1
Near-duplicate member family (4 members, 33 shared lines) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:359— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:359-499 | lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:65-251 | lib/presentation/widgets/gallery/gallery_album_tree_view.dart:550-731 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:423-624 — These 4 members are variants of one another: a block of 33 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.
Near-duplicate member pair (64 shared lines) lib/presentation/widgets/auth/third_party_api_login_card.dart:41— lib/presentation/widgets/auth/third_party_api_login_card.dart:41-204 | lib/presentation/widgets/auth/token_login_card.dart:37-242 — These two members are variants of one another: 64 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 (27 shared lines) lib/data/services/official_random_prompt_generator.dart:154— lib/data/services/official_random_prompt_generator.dart:154-254 | lib/data/services/official_random_prompt_generator.dart:386-500 — These two members are variants of one another: 27 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 (154 corresponding lines) · ×1
Edited copy of a member (154 corresponding lines) lib/presentation/widgets/danbooru_login_dialog.dart:59— lib/presentation/widgets/danbooru_login_dialog.dart:59-224 | lib/presentation/widgets/gelbooru_credentials_dialog.dart:115-268 — These two members are one piece of code written twice and then edited apart: 154 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 (122 corresponding lines) · ×1
Edited copy of a member (122 corresponding lines) lib/presentation/screens/statistics/widgets/charts/parameter_distribution_bar.dart:69— lib/presentation/screens/statistics/widgets/charts/parameter_distribution_bar.dart:69-190 | lib/presentation/screens/statistics/widgets/charts/weekday_bar_chart.dart:84-229 — These two members are one piece of code written twice and then edited apart: 122 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 (78 corresponding lines) · ×1
Edited copy of a member (78 corresponding lines) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:171— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:171-248 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:191-284 — These two members are one piece of code written twice and then edited apart: 78 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 (92 corresponding lines) · ×1
Edited copy of a member (92 corresponding lines) lib/presentation/screens/generation/widgets/prompt_input_tooltips.dart:38— lib/presentation/screens/generation/widgets/prompt_input_tooltips.dart:38-146 | lib/presentation/screens/generation/widgets/prompt_input_tooltips.dart:217-308 — These two members are one piece of code written twice and then edited apart: 92 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 (77 corresponding lines) · ×1
Edited copy of a member (77 corresponding lines) lib/presentation/screens/generation/desktop_layout.dart:145— lib/presentation/screens/generation/desktop_layout.dart:145-221 | lib/presentation/screens/generation/web_style_layout.dart:127-203 — These two members are one piece of code written twice and then edited apart: 77 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 (68 corresponding lines) · ×1
Edited copy of a member (68 corresponding lines) lib/presentation/widgets/character/add_character_buttons.dart:145— lib/presentation/widgets/character/add_character_buttons.dart:145-212 | lib/presentation/widgets/character/add_character_buttons.dart:237-306 — These two members are one piece of code written twice and then edited apart: 68 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 (84 corresponding lines) · ×1
Edited copy of a member (84 corresponding lines) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:606— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:606-689 | lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:691-781 — These two members are one piece of code written twice and then edited apart: 84 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 (79 corresponding lines) · ×1
Edited copy of a member (79 corresponding lines) lib/data/services/image_metadata_service.dart:198— lib/data/services/image_metadata_service.dart:198-276 | lib/data/services/image_metadata_service.dart:306-394 — These two members are one piece of code written twice and then edited apart: 79 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 (57 corresponding lines) · ×1
Edited copy of a member (57 corresponding lines) lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:173— lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:173-231 | lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:135-191 — These two members are one piece of code written twice and then edited apart: 57 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 (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) lib/presentation/widgets/prompt/quality_tags_selector.dart:54— lib/presentation/widgets/prompt/quality_tags_selector.dart:54-109 | lib/presentation/widgets/prompt/uc_preset_selector.dart:46-117 — These two members are one piece of code written twice and then edited apart: 56 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 (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:424— lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:424-470 | lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:472-520 — These two members are one piece of code written twice and then edited apart: 47 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 (63 corresponding lines) · ×1
Edited copy of a member (63 corresponding lines) lib/core/utils/inpaint_outpaint_utils.dart:403— lib/core/utils/inpaint_outpaint_utils.dart:403-465 | lib/core/utils/inpaint_outpaint_utils.dart:704-774 — These two members are one piece of code written twice and then edited apart: 63 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 (71 corresponding lines) · ×1
Edited copy of a member (71 corresponding lines) lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:230— lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:230-308 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:407-477 — These two members are one piece of code written twice and then edited apart: 71 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 (61 corresponding lines) · ×1
Edited copy of a member (61 corresponding lines) lib/core/database/datasources/gallery_image_repository.dart:373— lib/core/database/datasources/gallery_image_repository.dart:373-434 | lib/core/database/datasources/gallery_image_repository.dart:436-496 — These two members are one piece of code written twice and then edited apart: 61 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 copies of one member (3 members, 48+ corresponding lines) · ×1
Edited copies of one member (3 members, 48+ corresponding lines) lib/presentation/widgets/prompt/diy/panels/conditional_branch_panel.dart:111— lib/presentation/widgets/prompt/diy/panels/conditional_branch_panel.dart:111-172 | lib/presentation/widgets/prompt/diy/panels/post_process_rule_panel.dart:82-141 | lib/presentation/widgets/prompt/diy/panels/visibility_rule_panel.dart:73-120 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 48 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) lib/presentation/widgets/prompt/quality_tags_selector.dart:171— lib/presentation/widgets/prompt/quality_tags_selector.dart:171-248 | lib/presentation/widgets/prompt/uc_preset_selector.dart:232-291 — These two members are one piece of code written twice and then edited apart: 60 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 (72 corresponding lines) · ×1
Edited copy of a member (72 corresponding lines) lib/presentation/screens/settings/sections/appearance_settings_section.dart:240— lib/presentation/screens/settings/sections/appearance_settings_section.dart:240-312 | lib/presentation/screens/settings/sections/appearance_settings_section.dart:314-385 — These two members are one piece of code written twice and then edited apart: 72 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 (58 corresponding lines) · ×1
Edited copy of a member (58 corresponding lines) lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:26— lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:26-83 | lib/presentation/widgets/prompt/random_manager/danbooru_preview_content.dart:103-161 — These two members are one piece of code written twice and then edited apart: 58 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 copies of one member (3 members, 56+ corresponding lines) · ×1
Edited copies of one member (3 members, 56+ corresponding lines) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:443— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:443-510 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:512-568 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:570-625 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 56 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (51 corresponding lines) · ×1
Edited copy of a member (51 corresponding lines) lib/presentation/widgets/library_export/library_export_panel.dart:153— lib/presentation/widgets/library_export/library_export_panel.dart:153-213 | lib/presentation/widgets/library_export/library_export_panel.dart:245-295 — These two members are one piece of code written twice and then edited apart: 51 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 (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) lib/data/services/vibe_import_service.dart:206— lib/data/services/vibe_import_service.dart:206-259 | lib/data/services/vibe_import_service.dart:261-305 — 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 copies of one member (3 members, 27+ corresponding lines) · ×1
Edited copies of one member (3 members, 27+ corresponding lines) lib/core/autocomplete/tag_catalog_repository.dart:160— lib/core/autocomplete/tag_catalog_repository.dart:160-202 | lib/core/autocomplete/tag_catalog_repository.dart:204-238 | lib/core/autocomplete/tag_catalog_repository.dart:240-266 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) lib/data/services/tag_library_import_planner.dart:75— lib/data/services/tag_library_import_planner.dart:75-111 | lib/data/services/tag_library_import_planner.dart:113-148 — 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· Edited copies of one member (3 members, 40+ corresponding lines) · ×1
Edited copies of one member (3 members, 40+ corresponding lines) lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:374— lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:374-413 | lib/presentation/widgets/image_editor/widgets/toolbar/desktop_toolbar.dart:455-495 | lib/presentation/widgets/image_editor/widgets/toolbar/mobile_toolbar.dart:198-238 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 40 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) lib/presentation/widgets/autocomplete/completion_overlay_footer.dart:231— lib/presentation/widgets/autocomplete/completion_overlay_footer.dart:231-269 | lib/presentation/widgets/autocomplete/completion_overlay_footer.dart:271-308 — These two members are one piece of code written twice and then edited apart: 38 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 (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:707— lib/presentation/widgets/online_gallery/gallery_detail_info_panel.dart:707-748 | lib/presentation/widgets/online_gallery/gallery_detail_overview_card.dart:230-270 — These two members are one piece of code written twice and then edited apart: 41 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 copies of one member (3 members, 28+ corresponding lines) · ×1
Edited copies of one member (3 members, 28+ corresponding lines) lib/data/datasources/remote/danbooru_api_service.dart:265— lib/data/datasources/remote/danbooru_api_service.dart:265-292 | lib/data/datasources/remote/danbooru_api_service.dart:431-460 | lib/data/datasources/remote/danbooru_api_service.dart:464-493 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 25+ corresponding lines) · ×1
Edited copies of one member (4 members, 25+ corresponding lines) lib/presentation/screens/cloud_sync/cloud_sync_ffdkj_prompt.dart:34— lib/presentation/screens/cloud_sync/cloud_sync_ffdkj_prompt.dart:34-62 | lib/presentation/widgets/online_gallery/output_filter_settings_panel.dart:96-120 | lib/presentation/widgets/prompt/random_manager/preset_selector_bar.dart:314-347 | lib/presentation/widgets/prompt/random_manager/preset_selector_bar.dart:349-379 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 25 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 31+ corresponding lines) · ×1
Edited copies of one member (3 members, 31+ corresponding lines) lib/core/autocomplete/autocomplete_settings.dart:36— lib/core/autocomplete/autocomplete_settings.dart:36-67 | lib/core/cloud_sync/content_selection.dart:49-79 | lib/presentation/providers/share_image_settings_provider.dart:51-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:27— lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:27-52 | lib/presentation/widgets/online_gallery/gallery_generation_transfer_dialog.dart:21-48 | lib/presentation/widgets/prompt/new_preset_dialog.dart:30-56 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 22+ corresponding lines) · ×1
Edited copies of one member (6 members, 22+ corresponding lines) lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:25— lib/presentation/screens/tag_library_page/widgets/export_dialog.dart:25-55 | lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:26-51 | lib/presentation/screens/tag_library_page/widgets/send_to_home_dialog.dart:41-68 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:91-121 | lib/presentation/widgets/drop/prompt_library_entry_dialog.dart:80-110 | lib/presentation/widgets/shortcuts/shortcut_help_dialog.dart:22-43 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 22 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 21+ corresponding lines) · ×1
Edited copies of one member (4 members, 21+ corresponding lines) lib/presentation/services/library_sidebar_move_service.dart:21— lib/presentation/services/library_sidebar_move_service.dart:21-41 | lib/presentation/services/library_sidebar_move_service.dart:43-63 | lib/presentation/services/library_sidebar_move_service.dart:65-92 | lib/presentation/services/library_sidebar_move_service.dart:94-119 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) lib/presentation/screens/generation/widgets/history_panel/history_panel_header.dart:165— lib/presentation/screens/generation/widgets/history_panel/history_panel_header.dart:165-181 | lib/presentation/widgets/gallery/gallery_library_toolbar.dart:135-151 | lib/presentation/widgets/queue/task_list_item.dart:1034-1050 | lib/presentation/widgets/shortcuts/shortcut_tooltip.dart:363-382 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×1
Edited copies of one member (3 members, 16+ corresponding lines) lib/core/agent/harness/session/session_state.dart:250— lib/core/agent/harness/session/session_state.dart:250-265 | lib/core/agent/harness/session/session_state.dart:300-316 | lib/core/agent/harness/session/session_state.dart:327-342 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (8 members, 17+ corresponding lines) · ×1
Edited copies of one member (8 members, 17+ corresponding lines) lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:20— lib/presentation/themes/modules/color/palettes/apple_light_palette.dart:20-36 | lib/presentation/themes/modules/color/palettes/brutalist_palette.dart:20-36 | lib/presentation/themes/modules/color/palettes/minimal_glass_palette.dart:23-40 | lib/presentation/themes/modules/color/palettes/neo_dark_palette.dart:23-39 | lib/presentation/themes/modules/color/palettes/pro_ai_palette.dart:23-39 | lib/presentation/themes/modules/color/palettes/retro_palette.dart:22-38 | lib/presentation/themes/modules/color/palettes/retro_wave_palette.dart:25-41 | lib/presentation/themes/modules/color/palettes/social_palette.dart:23-39 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×1
Edited copies of one member (4 members, 15+ corresponding lines) lib/presentation/themes/modules/color/palettes/flat_palette.dart:21— lib/presentation/themes/modules/color/palettes/flat_palette.dart:21-37 | lib/presentation/themes/modules/color/palettes/flat_palette.dart:39-53 | lib/presentation/themes/modules/color/palettes/material_you_palette.dart:21-40 | lib/presentation/themes/modules/color/palettes/zen_palette.dart:29-43 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 15+ corresponding lines) · ×1
Edited copies of one member (5 members, 15+ corresponding lines) lib/core/storage/secure_storage_service.dart:292— lib/core/storage/secure_storage_service.dart:292-306 | lib/core/storage/secure_storage_service.dart:358-372 | lib/core/storage/secure_storage_service.dart:398-412 | lib/core/storage/secure_storage_service.dart:444-459 | lib/core/storage/secure_storage_service.dart:488-504 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 14+ corresponding lines) · ×1
Edited copies of one member (5 members, 14+ corresponding lines) lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:199— lib/presentation/agent_chat/services/fixed_tags_toolbox.dart:199-212 | lib/presentation/agent_chat/services/precise_reference_toolbox.dart:248-262 | lib/presentation/agent_chat/services/queue_toolbox.dart:166-180 | lib/presentation/agent_chat/services/queue_toolbox.dart:301-318 | lib/presentation/agent_chat/services/tag_library_toolbox.dart:367-385 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 6+ corresponding lines) · ×1
Edited copies of one member (4 members, 6+ corresponding lines) lib/presentation/screens/settings/sections/mcp_server/mcp_client_config_snippets.dart:57— lib/presentation/screens/settings/sections/mcp_server/mcp_client_config_snippets.dart:57-62 | lib/presentation/widgets/danbooru_login_dialog.dart:226-231 | lib/presentation/widgets/navigation/nav_rail_items.dart:107-112 | lib/presentation/widgets/prompt/random_manager/add_tag_group_dialog.dart:488-493 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×1
Edited copies of one member (3 members, 6+ corresponding lines) lib/data/models/tag/danbooru_tag.dart:24— lib/data/models/tag/danbooru_tag.dart:24-29 | lib/data/models/tag/local_tag.dart:146-151 | lib/data/models/tag/tag_suggestion.dart:26-31 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 4+ corresponding lines) · ×1
Edited copies of one member (4 members, 4+ corresponding lines) lib/core/autocomplete/tag_catalog_repository.dart:381— lib/core/autocomplete/tag_catalog_repository.dart:381-384 | lib/core/autocomplete/zh_dictionary_service.dart:486-489 | lib/core/database/datasources/translation_data_source.dart:222-225 | lib/presentation/screens/generation/widgets/img2img_upscale_section.dart:444-448 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (38 lines × 2) lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:337— lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:337-374 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:381-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:337` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (36 lines × 2) lib/core/database/datasources/gallery_query.dart:584— lib/core/database/datasources/gallery_query.dart:584-619 | lib/core/database/datasources/gallery_query.dart:623-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (35 lines × 2) lib/presentation/widgets/character/character_prompt_button.dart:132— lib/presentation/widgets/character/character_prompt_button.dart:132-166 | lib/presentation/widgets/character/inline_character_row.dart:605-639 — before extracting anything, compare `lib/presentation/widgets/character/character_prompt_button.dart` and `lib/presentation/widgets/character/inline_character_row.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/widgets/character/inline_character_row.dart:604` calls `Offset` and `lib/presentation/widgets/character/character_prompt_button.dart:131` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20–33 lines × 3) lib/core/watermark/watermark_logo_service.dart:152— lib/core/watermark/watermark_logo_service.dart:152-179 | lib/data/services/precise_ref_portable_importer.dart:14-46 | lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:694-713 — before extracting anything, compare `lib/core/watermark/watermark_logo_service.dart` and `lib/data/services/precise_ref_portable_importer.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/precise_ref_portable_importer.dart:14` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (30–32 lines × 2) lib/core/database/datasources/gallery_album_repository.dart:484— lib/core/database/datasources/gallery_album_repository.dart:484-515 | lib/core/database/datasources/gallery_album_repository.dart:576-605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_album_repository.dart:484` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (32 lines × 2) lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:200— lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:200-231 | lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:160-191 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:200` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/screens/generation/widgets/comfyui_workflow_dialog.dart:198` calls `LayoutBuilder` and `lib/presentation/screens/settings/widgets/workflow_import_wizard.dart:159` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (30–31 lines × 2) lib/presentation/services/image_workflow_launcher.dart:394— lib/presentation/services/image_workflow_launcher.dart:394-424 | lib/presentation/utils/metadata_import_coordinator.dart:46-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/services/image_workflow_launcher.dart:394` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) lib/presentation/widgets/prompt/quality_tags_selector.dart:114— lib/presentation/widgets/prompt/quality_tags_selector.dart:114-144 | lib/presentation/widgets/prompt/uc_preset_selector.dart:188-218 — before extracting anything, compare `lib/presentation/widgets/prompt/quality_tags_selector.dart` and `lib/presentation/widgets/prompt/uc_preset_selector.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/quality_tags_selector.dart:114` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (28–30 lines × 2) lib/core/database/datasources/gallery_image_repository.dart:375— lib/core/database/datasources/gallery_image_repository.dart:375-404 | lib/core/database/datasources/gallery_image_repository.dart:438-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_image_repository.dart:375` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28–29 lines × 2) lib/presentation/widgets/character/character_prompt_button.dart:180— lib/presentation/widgets/character/character_prompt_button.dart:180-207 | lib/presentation/widgets/character/inline_character_row.dart:695-723 — before extracting anything, compare `lib/presentation/widgets/character/character_prompt_button.dart` and `lib/presentation/widgets/character/inline_character_row.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 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) lib/core/database/datasources/gallery_metadata_repository.dart:43— lib/core/database/datasources/gallery_metadata_repository.dart:43-69 | lib/core/database/datasources/gallery_metadata_repository.dart:167-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/core/database/datasources/gallery_metadata_repository.dart:198` calls `_batchUpdateFtsIndex` and `lib/core/database/datasources/gallery_metadata_repository.dart:70` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26–27 lines × 2) lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:82— lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:82-107 | lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:334-360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/online_gallery/quick_tag_cloud_remote_catalog_service.dart:334` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) lib/presentation/widgets/prompt/quality_tags_selector.dart:81— lib/presentation/widgets/prompt/quality_tags_selector.dart:81-106 | lib/presentation/widgets/prompt/uc_preset_selector.dart:90-115 — before extracting anything, compare `lib/presentation/widgets/prompt/quality_tags_selector.dart` and `lib/presentation/widgets/prompt/uc_preset_selector.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/prompt/quality_tags_selector.dart:81` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–25 lines × 3) lib/core/database/datasources/gallery_query.dart:108— lib/core/database/datasources/gallery_query.dart:108-132 | lib/core/database/datasources/gallery_query.dart:169-189 | lib/core/database/datasources/gallery_query.dart:254-276 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_query.dart:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23–25 lines × 3) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:430— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:430-454 | lib/presentation/widgets/gallery/gallery_album_tree_view.dart:585-607 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:486-508 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_album_tree_view.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:430` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23–25 lines × 2) lib/core/autocomplete/danbooru_completion_source.dart:52— lib/core/autocomplete/danbooru_completion_source.dart:52-76 | lib/core/autocomplete/danbooru_completion_source.dart:149-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/autocomplete/danbooru_completion_source.dart:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24–25 lines × 2) lib/presentation/screens/generation/desktop_layout.dart:195— lib/presentation/screens/generation/desktop_layout.dart:195-219 | lib/presentation/screens/generation/web_style_layout.dart:177-200 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/generation/desktop_layout.dart:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (47–48 lines × 3) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:451— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:451-497 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:521-568 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:578-625 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:521` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (24 lines × 2) lib/data/services/image_metadata_service.dart:250— lib/data/services/image_metadata_service.dart:250-273 | lib/data/services/image_metadata_service.dart:368-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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/image_metadata_service.dart:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22–24 lines × 2) lib/presentation/widgets/auth/third_party_api_login_card.dart:92— lib/presentation/widgets/auth/third_party_api_login_card.dart:92-113 | lib/presentation/widgets/auth/token_login_card.dart:71-94 — before extracting anything, compare `lib/presentation/widgets/auth/third_party_api_login_card.dart` and `lib/presentation/widgets/auth/token_login_card.dart` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 69 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/auth/third_party_api_login_card.dart:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 3) lib/presentation/router/app_router_config.dart:320— lib/presentation/router/app_router_config.dart:320-342 | lib/presentation/screens/image_comparison_screen.dart:334-356 | lib/presentation/screens/slideshow_screen.dart:424-446 — before extracting anything, compare `lib/presentation/router/app_router_config.dart` and `lib/presentation/screens/image_comparison_screen.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/router/app_router_config.dart:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–23 lines × 2) lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:126— lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart:126-148 | lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.dart:180-200 — before extracting anything, compare `lib/presentation/screens/precise_ref_library/widgets/precise_ref_hover_preview.dart` and `lib/presentation/screens/vibe_library/widgets/vibe_hover_preview.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. 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 × 4) lib/core/utils/pica_lanczos_resizer.dart:317— lib/core/utils/pica_lanczos_resizer.dart:317-337 | lib/core/utils/pica_lanczos_resizer.dart:361-381 | lib/core/utils/pica_lanczos_resizer.dart:409-429 | lib/core/utils/pica_lanczos_resizer.dart:457-477 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/pica_lanczos_resizer.dart:317` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20–21 lines × 3) lib/presentation/router/app_router_config.dart:275— lib/presentation/router/app_router_config.dart:275-295 | lib/presentation/screens/image_comparison_screen.dart:279-298 | lib/presentation/screens/slideshow_screen.dart:381-400 — before extracting anything, compare `lib/presentation/router/app_router_config.dart` and `lib/presentation/screens/image_comparison_screen.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/router/app_router_config.dart:275` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20–21 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:252— lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:252-272 | lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:309-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_bundle_sections.dart:252` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–20 lines × 4) lib/core/database/datasources/gallery_query.dart:111— lib/core/database/datasources/gallery_query.dart:111-130 | lib/core/database/datasources/gallery_query.dart:172-187 | lib/core/database/datasources/gallery_query.dart:257-274 | lib/core/database/datasources/gallery_query.dart:407-425 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_query.dart:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20 lines × 4) lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:199— lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:199-218 | lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart:233-252 | lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:234-253 | lib/presentation/prompt_assistant/services/provider_adapters/openai_responses_adapter.dart:256-275 — before extracting anything, compare `lib/presentation/prompt_assistant/services/provider_adapters/gemini_generate_content_adapter.dart` and `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/services/provider_adapters/anthropic_messages_adapter.dart:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (19–20 lines × 2) lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:296— lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:296-314 | lib/presentation/screens/vibe_library/widgets/vibe_export_dialog.dart:319-338 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/vibe_export_advanced/vibe_export_option_card.dart:296` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 4) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:441— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:441-459 | lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:153-171 | lib/presentation/widgets/gallery/gallery_album_tree_view.dart:594-612 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:495-513 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:441` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–19 lines × 2) lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:128— lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:128-146 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:477-491 — before extracting anything, compare `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 125 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–19 lines × 2) lib/presentation/widgets/gallery/gallery_album_tree_view.dart:566— lib/presentation/widgets/gallery/gallery_album_tree_view.dart:566-581 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:463-481 — before extracting anything, compare `lib/presentation/widgets/gallery/gallery_album_tree_view.dart` and `lib/presentation/widgets/gallery/gallery_category_tree_view.dart` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 97 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/gallery/gallery_album_tree_view.dart:566` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17–18 lines × 5) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:85— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:85-101 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:168-184 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:463-480 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:533-550 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:590-607 — 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 (15–18 lines × 2) lib/core/database/datasources/gallery_image_repository.dart:417— lib/core/database/datasources/gallery_image_repository.dart:417-434 | lib/core/database/datasources/gallery_image_repository.dart:482-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_image_repository.dart:417` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–17 lines × 4) lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:399— lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:399-415 | lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.dart:106-122 | lib/presentation/widgets/gallery/gallery_album_tree_view.dart:559-572 | lib/presentation/widgets/gallery/gallery_category_tree_view.dart:456-471 — before extracting anything, compare `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart` and `lib/presentation/screens/vibe_library/widgets/category/vibe_category_item.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/category_tree_view.dart:399` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–17 lines × 3) lib/core/database/datasources/gallery_query.dart:74— lib/core/database/datasources/gallery_query.dart:74-90 | lib/core/database/datasources/gallery_query.dart:136-150 | lib/core/database/datasources/gallery_query.dart:195-210 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_query.dart:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 3) lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:63— lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart:63-79 | lib/presentation/screens/statistics/widgets/charts/radar_chart.dart:69-85 | lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.dart:66-82 — before extracting anything, compare `lib/presentation/screens/statistics/widgets/charts/funnel_chart.dart` and `lib/presentation/screens/statistics/widgets/charts/stacked_area_chart.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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–15 lines × 6) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:94— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:94-107 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:177-190 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:473-487 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:543-557 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:600-614 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:846-860 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:863` calls `take`, `toList` and `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:491` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 5) lib/presentation/router/app_router_config.dart:282— lib/presentation/router/app_router_config.dart:282-294 | lib/presentation/screens/auth/login_screen.dart:103-115 | lib/presentation/screens/image_comparison_screen.dart:286-298 | lib/presentation/screens/slideshow_screen.dart:388-400 | lib/presentation/screens/splash/splash_screen.dart:87-100 — before extracting anything, compare `lib/presentation/router/app_router_config.dart` and `lib/presentation/screens/image_comparison_screen.dart` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/router/app_router_config.dart:282` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 4) lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:411— lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:411-424 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:127-140 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:208-221 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:497-510 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:411` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) lib/data/datasources/remote/danbooru_api_service.dart:279— lib/data/datasources/remote/danbooru_api_service.dart:279-292 | lib/data/datasources/remote/danbooru_api_service.dart:480-493 | lib/data/datasources/remote/danbooru_api_service.dart:608-621 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/danbooru_api_service.dart:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–14 lines × 2) lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:355— lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:355-366 | lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:399-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/tag_library_page/widgets/import_dialog.dart:355` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13 lines × 4) lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:159— lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:159-171 | lib/presentation/screens/tag_library_page/widgets/entry_add_dialog.dart:436-448 | lib/presentation/widgets/character/add_to_library_dialog.dart:387-399 | lib/presentation/widgets/metadata/metadata_import_dialog.dart:199-211 — before extracting anything, compare `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart` and `lib/presentation/widgets/metadata/metadata_import_dialog.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–13 lines × 3) lib/data/cloud_sync/vibe_library_cloud_sync_adapter.dart:203— lib/data/cloud_sync/vibe_library_cloud_sync_adapter.dart:203-215 | lib/data/services/vibe_library_entry_reader.dart:131-141 | lib/data/services/vibe_library_entry_writer.dart:335-343 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/cloud_sync/vibe_library_cloud_sync_adapter.dart:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 5) lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:38— lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart:38-49 | lib/presentation/screens/statistics/widgets/animated/animated_number.dart:39-50 | lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart:38-49 | lib/presentation/screens/statistics/widgets/charts/heatmap_chart.dart:75-86 | lib/presentation/screens/statistics/widgets/charts/polar_activity_chart.dart:45-56 — before extracting anything, compare `lib/presentation/screens/statistics/widgets/animated/animated_bar_chart.dart` and `lib/presentation/screens/statistics/widgets/animated/animated_pie_chart.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 4) lib/presentation/widgets/image_editor/tools/blur_tool.dart:161— lib/presentation/widgets/image_editor/tools/blur_tool.dart:161-171 | lib/presentation/widgets/image_editor/tools/clone_stamp_tool.dart:311-321 | lib/presentation/widgets/image_editor/tools/fill_tool.dart:121-131 | lib/presentation/widgets/image_editor/tools/magic_wand_tool.dart:81-91 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/widgets/image_editor/tools/blur_tool.dart:161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 3) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:757— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:757-767 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:784-794 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:835-847 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:757` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 7) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:93— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:93-102 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:176-185 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:472-481 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:542-551 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:599-608 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:718-727 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:845-854 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:717` calls `usableItems` and `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:92` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 4) lib/core/database/datasources/gallery_favorite_tag_repository.dart:150— lib/core/database/datasources/gallery_favorite_tag_repository.dart:150-159 | lib/core/database/datasources/gallery_favorite_tag_repository.dart:289-298 | lib/core/database/datasources/gallery_image_repository.dart:225-234 | lib/core/database/datasources/gallery_metadata_repository.dart:302-311 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_favorite_tag_repository.dart:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–10 lines × 2) lib/data/services/vibe_folder_sync.dart:164— lib/data/services/vibe_folder_sync.dart:164-170 | lib/data/services/vibe_import_service.dart:787-796 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/services/vibe_import_service.dart:787` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 5) lib/core/utils/novelai_vibe_codec.dart:290— lib/core/utils/novelai_vibe_codec.dart:290-298 | lib/core/watermark/watermark_logo_service.dart:157-165 | lib/data/services/precise_ref_portable_importer.dart:19-27 | lib/data/services/precise_ref_portable_importer.dart:36-44 | lib/presentation/prompt_assistant/services/prompt_assistant_service.dart:691-699 — before extracting anything, compare `lib/core/watermark/watermark_logo_service.dart` and `lib/data/services/precise_ref_portable_importer.dart` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/novelai_vibe_codec.dart:290` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 4) lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:231— lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:231-240 | lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:144-152 | lib/presentation/widgets/metadata/metadata_import_dialog.dart:182-190 | lib/presentation/widgets/prompt/comfyui_import_dialog.dart:158-166 — before extracting anything, compare `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart` and `lib/presentation/widgets/metadata/metadata_import_dialog.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/widgets/prompt_assistant_custom_dialog.dart:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `lib/presentation/screens/settings/sections/agent/agent_profile_actions.dart:141` calls `Key` and `lib/presentation/widgets/prompt/comfyui_import_dialog.dart:156` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 3) lib/core/utils/inpaint_outpaint_utils.dart:1017— lib/core/utils/inpaint_outpaint_utils.dart:1017-1025 | lib/core/utils/inpaint_outpaint_utils.dart:1096-1104 | lib/core/utils/inpaint_outpaint_utils.dart:1131-1138 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_outpaint_utils.dart:1017` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 3) lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1339— lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1339-1346 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1356-1362 | lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1609-1616 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/utils/inpaint_mask/inpaint_mask_operations.dart:1339` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6–8 lines × 3) lib/presentation/screens/statistics/widgets/cards/chart_card.dart:102— lib/presentation/screens/statistics/widgets/cards/chart_card.dart:102-109 | lib/presentation/screens/statistics/widgets/charts/polar_activity_chart.dart:328-333 | lib/presentation/screens/statistics/widgets/charts/weekday_bar_chart.dart:379-384 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/statistics/widgets/cards/chart_card.dart:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:247— lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:247-253 | lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:265-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/agent/harness/session/jsonl/session_jsonl_codec.dart:247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–8 lines × 2) lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:159— lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:159-166 | lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:742-747 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/prompt_assistant/services/provider_adapters/openai_chat_completions_adapter.dart:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) lib/presentation/screens/derivatives/derivative_editor_launcher.dart:140— lib/presentation/screens/derivatives/derivative_editor_launcher.dart:140-146 | lib/presentation/screens/precise_ref_library/precise_ref_library_screen.dart:507-514 | lib/presentation/widgets/common/update_check_dialog.dart:823-831 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/presentation/screens/derivatives/derivative_editor_launcher.dart:140` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 4) lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:261— lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:261-268 | lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:882-889 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:190-197 | lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:444-451 — before extracting anything, compare `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart` and `lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart:261` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `GallerySearchRequest` in one and `GalleryRandomSearchRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 3) lib/core/database/datasources/gallery_album_repository.dart:853— lib/core/database/datasources/gallery_album_repository.dart:853-858 | lib/core/database/datasources/gallery_album_repository.dart:863-868 | lib/core/database/datasources/gallery_album_repository.dart:891-896 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/database/datasources/gallery_album_repository.dart:853` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (4–5 lines × 3) lib/core/services/file_export_service.dart:299— lib/core/services/file_export_service.dart:299-303 | lib/core/services/file_export_service.dart:328-332 | lib/data/services/precise_ref_library_archive_service.dart:82-85 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `lib/core/services/file_export_service.dart:299` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 8) lib/presentation/themes/modules/typography/presets/editorial_typography.dart:12— lib/presentation/themes/modules/typography/presets/editorial_typography.dart:12-22 | lib/presentation/themes/modules/typography/presets/flat_typography.dart:12-22 | lib/presentation/themes/modules/typography/presets/fluid_typography.dart:12-22 | lib/presentation/themes/modules/typography/presets/grunge_typography.dart:13-23 | lib/presentation/themes/modules/typography/presets/hand_drawn_typography.dart:13-23 | lib/presentation/themes/modules/typography/presets/material_typography.dart:12-22 | lib/presentation/themes/modules/typography/presets/retro_typography.dart:13-23 | lib/presentation/themes/modules/typography/presets/zen_typography.dart:12-22 — 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 8 call sites, so a change lands once.
Duplicated block (5 lines × 6) lib/presentation/themes/presets/minimal_glass_theme.dart:31— lib/presentation/themes/presets/minimal_glass_theme.dart:31-35 | lib/presentation/themes/presets/neo_dark_theme.dart:25-29 | lib/presentation/themes/presets/pro_ai_theme.dart:25-29 | lib/presentation/themes/presets/retro_wave_theme.dart:25-29 | lib/presentation/themes/presets/social_theme.dart:25-29 | lib/presentation/themes/presets/system_theme.dart:25-29 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:212— lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:212-216 | lib/core/cloud_sync/backend/onedrive_cloud_sync_backend.dart:98-102 | lib/core/cloud_sync/backend/webdav_cloud_sync_backend.dart:157-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 × 5) lib/presentation/screens/online_gallery/online_gallery_content.dart:79— lib/presentation/screens/online_gallery/online_gallery_content.dart:79-84 | lib/presentation/screens/online_gallery/online_gallery_selection_actions.dart:76-81 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_dialogs.dart:32-37 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_search.dart:27-32 | lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart:41-46 — 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 predicate lib/core/agent/skill_archive_extractor.dart:316— `!RegExp(r'^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$').hasMatch(name) || name.contains('--')` appears character-identically in 2 files — lib/core/agent/skill_archive_extractor.dart, lib/core/agent/skill_catalog.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/screens/generation/desktop_layout.dart:87— `!_isBusy && !ref.read(generationCooldownProvider).isActive` appears character-identically in 2 files — lib/presentation/screens/generation/desktop_layout.dart, lib/presentation/screens/generation/web_style_layout.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/data/datasources/local/pool_cache_service.dart:232— `!_isInitialized || _box == null || !_box!.isOpen` appears character-identically in 2 files — lib/data/datasources/local/pool_cache_service.dart, lib/data/datasources/local/tag_group_cache_service.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/autocomplete/cooccurrence_pack_repository.dart:76— `!await target.exists() && await backup.exists()` appears character-identically in 2 files — lib/core/autocomplete/cooccurrence_pack_repository.dart, lib/data/services/inpaint_draft_file_store.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart:85— `!context.mounted || !session.accepts(epoch)` appears character-identically in 2 files — lib/presentation/widgets/image_editor/controllers/magic_wand_controller.dart, lib/presentation/widgets/image_editor/effects/image_editor_effects_controller.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/agent_chat/services/generation_character_orchestration.dart:212— `!coordinate.isFinite || coordinate < 0 || coordinate > 1` appears character-identically in 2 files — lib/presentation/agent_chat/services/generation_character_orchestration.dart, lib/presentation/agent_chat/services/prompt_toolbox.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/data/models/fixed_tag/fixed_tag_entry.dart:261— `!e.enabled && e.promptType == FixedTagPromptType.positive` appears character-identically in 2 files — lib/data/models/fixed_tag/fixed_tag_entry.dart, lib/presentation/providers/fixed_tags_provider.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/data/models/prompt/random_category.dart:162— `!genderRestrictionEnabled || applicableGenders.isEmpty` appears character-identically in 2 files — lib/data/models/prompt/random_category.dart, lib/data/models/prompt/random_tag_group.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/screens/tag_library_page/widgets/tag_library_toolbar.dart:294— `!keyboard.isControlPressed && !keyboard.isMetaPressed` appears character-identically in 2 files — lib/presentation/screens/tag_library_page/widgets/tag_library_toolbar.dart, lib/presentation/widgets/gallery/local_gallery_toolbar.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/autocomplete/fast_tag_service.dart:42— `!locale.toLowerCase().startsWith('zh') || canonicalTags.isEmpty` appears character-identically in 2 files — lib/core/autocomplete/fast_tag_service.dart, lib/core/autocomplete/zh_dictionary_service.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/cloud_sync/backend/github_cloud_sync_backend.dart:262— `!payloadVerified && _hashBytes(bytes) != expectedHash` appears character-identically in 2 files — lib/core/cloud_sync/backend/github_cloud_sync_backend.dart, lib/core/cloud_sync/backend/google_drive_cloud_sync_backend.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/utils/text_selection_utils.dart:54— `!selection.isValid || selection.isCollapsed` appears character-identically in 5 files — lib/presentation/utils/text_selection_utils.dart, lib/presentation/widgets/prompt/prompt_display_controller.dart, lib/presentation/widgets/prompt/prompt_weight_editing.dart, lib/presentation/widgets/prompt/unified/prompt_search_session.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/screens/cloud_sync/cloud_sync_dashboard.dart:92— `!state.isBusy && !state.needsPreviewConfirmation` appears character-identically in 2 files — lib/presentation/screens/cloud_sync/cloud_sync_dashboard.dart, lib/presentation/screens/cloud_sync/cloud_sync_security_section.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/windowing/agent_chat_dock_contract.dart:36— `!workspaceWidth.isFinite || workspaceWidth <= 0` appears character-identically in 2 files — lib/core/windowing/agent_chat_dock_contract.dart, lib/core/windowing/workspace_side_panel_contract.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/network/dio_client.dart:249— `(first == '"' && last == '"') || (first == '\'' && last == '\'')` appears character-identically in 3 files — lib/core/network/dio_client.dart, lib/core/storage/secure_storage_service.dart, lib/data/datasources/remote/nai_auth_api_service.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate tool/testing/verify_regression_detection.dart:209— `(previousStatus == 'error' || previousStatus == 'failure') && currentStatus == 'success'` appears character-identically in 2 files — tool/testing/verify_regression_detection.dart, tool/testing/verify_regression_simple.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/providers/cloud_sync/cloud_sync_provider_wiring.dart:112— `CloudSyncBackendKind.googleDrive || CloudSyncBackendKind.oneDrive` appears character-identically in 2 files — lib/presentation/providers/cloud_sync/cloud_sync_provider_wiring.dart, lib/presentation/screens/cloud_sync/cloud_sync_setup_draft.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/cloud_sync/backend/backend_http.dart:357— `DioExceptionType.connectionTimeout || DioExceptionType.sendTimeout || DioExceptionType.receiveTimeout` appears character-identically in 2 files — lib/core/cloud_sync/backend/backend_http.dart, lib/core/network/error_mappers/api_error_mapper.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/data/models/online_gallery/gallery_source.dart:295— `GallerySourceId.danbooru || GallerySourceId.safebooru` appears character-identically in 2 files — lib/data/models/online_gallery/gallery_source.dart, lib/presentation/services/gallery_prompt_projection_service.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart:467— `GelbooruApiErrorType.cancelled || GelbooruApiErrorType.unknown` appears character-identically in 2 files — lib/data/datasources/remote/online_gallery/gelbooru_gallery_source_adapter.dart, lib/data/services/online_gallery/online_gallery_error_mapper.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/agent_chat/services/image_upscale_service.dart:362— `ImageUpscaleFailure.engineUnavailable || ImageUpscaleFailure.nativeVaeUnavailable` appears character-identically in 2 files — lib/presentation/agent_chat/services/image_upscale_service.dart, lib/presentation/screens/generation/widgets/img2img_upscale_section.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/core/services/sqflite_bootstrap_service.dart:28— `Platform.isWindows || Platform.isLinux || Platform.isMacOS` appears character-identically in 2 files — lib/core/services/sqflite_bootstrap_service.dart, lib/main.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/providers/queue_execution_provider.dart:351— `PlatformCapabilities.current.supportsKritaBridge && ref.read(kritaBridgeNotifierProvider).isBridgeGenerating` appears character-identically in 6 files — lib/presentation/providers/queue_execution_provider.dart, lib/presentation/screens/generation/desktop_layout.dart, lib/presentation/screens/generation/handlers/generation_action_handlers.dart, lib/presentation/screens/generation/mobile_generation_controller.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/adaptive/interaction_policy.dart:58— `PointerDeviceKind.touch || PointerDeviceKind.stylus || PointerDeviceKind.invertedStylus` appears character-identically in 2 files — lib/presentation/adaptive/interaction_policy.dart, lib/presentation/widgets/image_editor/core/layer_transform_controller.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate lib/presentation/widgets/prompt/tag_editor_commands.dart:179— `TagEditorAction.previous || TagEditorAction.next || TagEditorAction.first || TagEditorAction.last` appears character-identically in 2 files — lib/presentation/widgets/prompt/tag_editor_commands.dart, lib/presentation/widgets/prompt/tag_editor_view.dart. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default in catch lib/core/autocomplete/cooccurrence_pack_repository.dart:44— `partialLength` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/autocomplete/fast_tag_service.dart:76— `resolveFuzzy` turns every thrown error into `{}` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/autocomplete/fast_tag_service.dart:86— `_searchOptionalDictionary` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/autocomplete/zh_dictionary_service.dart:447— `_readMetadata` turns every thrown error into `{}` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/database/datasources/gallery_records.dart:438— `parsePending` (in `fromMap`) turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/database/datasources/gallery_schema.dart:442— `_getTableCount` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/services/app_installation_service.dart:88— `getAndroidSupportedAbis` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/services/verified_resumable_downloader.dart:476— `_safeLength` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/storage/queue_state_storage.dart:143— `loadFailedTasks` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/storage/tag_favorite_storage.dart:54— `getFavorites` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/core/storage/tag_template_storage.dart:65— `getTemplates` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/data/datasources/remote/danbooru_api_service.dart:73— `_getAuthQueryParams` turns every thrown error into `{}` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/data/datasources/remote/online_gallery/ai_tag_gallery_source_adapter.dart:886— `_decodeList` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/presentation/agent_chat/services/agent_chat_session_summary_cache.dart:55— `_readName` turns every thrown error into `''` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/presentation/mcp/providers/mcp_server_notifier.dart:513— `_appVersion` turns every thrown error into `'unknown'` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default in catch lib/presentation/screens/generation/widgets/img2img_source_section.dart:233— `_comfyChips` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or rethrow it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Orphaned file tool/metadata/check_metadata_extraction.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lib/presentation/screens/settings/widgets/gallery_cache_actions.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lib/data/services/gallery/scan_config.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lib/presentation/providers/gallery_scan_progress_provider.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file tool/metadata/check_metadata_simple.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lib/domain/entities/gallery_image_entity.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lib/core/exceptions/gallery_exceptions.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lib/domain/entities/gallery_entity_mapper.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file tool/diagnostics/diagnose_sync.dart:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file tool/macos_icon/make_macos_icons.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Fat interface: FileSystem (18 abstract methods) lib/core/agent/harness/harness_types.dart:231— `FileSystem` declares 18 abstract methods: `cwd`, `absolutePath`, `joinPath`, `readTextFile`, `readTextLines`, `readBinaryFile`, `writeFile`, `appendFile`, `renameFile`, `fileInfo`, `listDir`, `canonicalPath`, `exists`, `createDir`, `remove`, `createTempDir`, `createTempFile`, `cleanup`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: SessionStorage (17 abstract methods) lib/core/agent/harness/session/session_types.dart:623— `SessionStorage` declares 17 abstract methods: `getMetadata`, `getLanes`, `createLane`, `moveLane`, `appendEntry`, `appendRecord`, `getEntry`, `findEntries`, `findEntriesOnBranch`, `findRecords`, `findOpenOperations`, `getLog`, `getName`, `setName`, `getLabel`, `setLabel`, `getStats`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: GalleryAlbumRepository (17 abstract methods) lib/core/database/datasources/gallery_album_repository.dart:16— `GalleryAlbumRepository` declares 17 abstract methods: `createAlbum`, `renameAlbum`, `updateAlbumDescription`, `moveAlbum`, `updateAlbumCover`, `deleteAlbum`, `getAlbums`, `addImagesToAlbum`, `removeImagesFromAlbum`, `getAlbumImageIdsWithDescendants`, `getAlbumFilePathsWithDescendants`, `getAllAlbumMemberPaths`, `clearAllAlbums`, `importAlbums`, `applyCloudSyncAlbums`, `rebindPendingPaths`, `moveAlbumToSlot`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: LocalGalleryService (24 abstract methods) lib/data/services/gallery/local_gallery_service.dart:24— `LocalGalleryService` declares 24 abstract methods: `isInitialized`, `initialize`, `getPage`, `queryPage`, `getImageIdByPath`, `applyFilter`, `toggleFavorite`, `isFavorite`, `getFavoriteCount`, `getMetadata`, `refresh`, `addNewImageImmediately`, `removeDeletedImagesImmediately`, `filteredCount`, `totalCount`, `currentFilter`, `setSearchQuery`, `setDateRange`, `setShowFavoritesOnly`, `setPageSize`, `clearFilters`, `dispose`, `getRecordsByPaths`, `getFilteredImagePaths`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: VibeLibraryRepositoryProtocol (27 abstract methods) lib/data/services/vibe_library_storage_protocol.dart:6— `VibeLibraryRepositoryProtocol` declares 27 abstract methods: `init`, `ensureInit`, `readEntry`, `putEntry`, `deleteEntry`, `clearEntries`, `readAllEntries`, `forEachEntry`, `firstEntryWhere`, `containsEntry`, `readDisplayEntries`, `replaceDisplayEntries`, `upsertDisplayEntryIfReady`, `deleteDisplayEntryIfReady`, `readThumbnail`, `putThumbnail`, `deleteThumbnail`, `clearThumbnails`, `isDisplayCacheReady`, `setDisplayCacheReady`, `readCategories`, `readCategory`, `putCategory`, `putCategories`, `deleteCategory`, `clearCategories`, `close`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: AppLocalizations (4672 abstract methods) lib/l10n/app_localizations.dart:14— `AppLocalizations` declares 4672 abstract methods: `sidebarSort_title`, `sidebarSort_saveAfterMoveFailed`, `sidebarSort_original`, `sidebarSort_nameAscending`, `sidebarSort_nameDescending`, `sidebarSort_countDescending`, `sidebarSort_countAscending`, `gallery_resizeSidebar`, `cardAction_singleScope`, `cardDrag_preparingCount`, `cardDrop_unsupported`, `cardAction_batchFailed`, `generation_enhancementFailed`, `generation_enhancementRetryHint`, `generation_enhancementPreparing`, `generation_enhancementRunning`, `generation_enhancementFinalizing`, `app_title`, `app_subtitle`, `desktopWindow_minimize`, `desktopWindow_maximize`, `desktopWindow_restore`, `desktopWindow_close`, `common_cancel`, `common_confirm`, `common_continue`, `common_selectAll`, `common_deselectAll`, `common_save`, `common_delete`, `common_edit`, `common_close`, `common_clear`, `common_copy`, `common_copied`, `common_export`, `common_import`, `common_loading`, `common_error`, `common_secureStorageUnavailable`, and 4632 more. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: CloudSyncUiPort (22 abstract methods) lib/presentation/providers/cloud_sync/cloud_sync_ui_provider.dart:376— `CloudSyncUiPort` declares 22 abstract methods: `testConnection`, `detectRemote`, `connect`, `authorizeCloudDrive`, `cancelCloudDriveAuthorization`, `discardCloudDriveAuthorization`, `pushNow`, `pullNow`, `applyPendingPreview`, `pause`, `resume`, `cancel`, `previewRestoreSnapshot`, `confirmRestoreSnapshot`, `refreshHistory`, `deleteRemoteNamespace`, `updateContentSelection`, `rebuildCompactBackup`, `disconnect`, `resolveConflict`, `resolveAllConflicts`, `respondToFfdkjInstallIntent`. Counted over its public methods with no body, once per name; concrete methods and `_`-private members are not counted, because no implementer that extends it is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 173 significant file(s) lose their only recent owner: lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_feature.dart, lib/presentation/widgets/prompt/tag_editor_view.dart, lib/presentation/widgets/online_gallery/quick_tag_cloud_toolbar.dart, lib/data/datasources/remote/online_gallery/donmai_gallery_source_adapter.dart, lib/data/cloud_sync/app_cloud_sync_data_source.dart, lib/presentation/widgets/common/pagination_bar.dart, lib/presentation/screens/online_gallery/widgets/online_gallery_toolbar/online_gallery_toolbar_source_controls.dart, lib/core/database/providers/data_source_cache_provider.dart (+165 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 142 significant file(s) lose their only recent owner: tool/ole_drag_inspector/windows/Program.cs, lib/core/database/datasources/gallery_query.dart, lib/data/services/official_random_prompt_generator.dart, lib/core/utils/inpaint_outpaint_utils.dart, krita_plugin/nai_launcher_bridge/ui.py, lib/presentation/widgets/image_editor/widgets/outpaint_edge_drag_overlay.dart, tool/ole_drag_inspector/validate_ole_dump.dart, lib/presentation/utils/dropped_file_reader.dart (+134 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 6 significant file(s) lose their only recent owner: lib/core/agent/harness/skills.dart, lib/core/network/web_access/safe_web_reader.dart, lib/core/agent/harness/tools/read.dart, lib/presentation/agent_chat/services/web_access_toolbox.dart, lib/core/network/web_access/web_access_http_transport.dart, lib/core/network/web_access/web_access_utils.dart. Pair on, review, or document these before any departure.
Silent fallback default on parse failure lib/core/cloud_sync/backend/onedrive_api_client.dart:686— `_graphErrorCodes` answers `[]` when `FormatException` is thrown, with no log or rethrow — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
Silent fallback default on parse failure lib/core/derivatives/derivative_registry.dart:182— `_read` answers `{}` when `FormatException` is thrown, with no log or rethrow — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch` or in the `///` doc, and the row stops firing.
No ADRs found macos/Runner.xcodeproj/project.pbxproj:1— 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/`. ADRs are expected here because `macos/Runner.xcodeproj/project.pbxproj` makes this repository a deployable product (line 1).
D21 · Naming Consistency· `testNovelAIConnection` spells `AI` where 20 names in the project spell it `Ai` · ×1
`testNovelAIConnection` spells `AI` where 20 names in the project spell it `Ai` lib/core/network/proxy_service.dart:219— 20 of 21 names in project repository.core spell the token `Ai` (20 of 21; unit: names in project repository.core containing `Ai`). Peers: AutocompleteCacheDatabase.getAiTranslations (lib/core/autocomplete/autocomplete_cache_database.dart:91); AutocompleteCacheDatabase.putAiTranslations (lib/core/autocomplete/autocomplete_cache_database.dart:118); AutocompleteCacheDatabase.clearAiTranslationCache (lib/core/autocomplete/autocomplete_cache_database.dart:146); AnlasCalculator.novelAiUpscaleOpusFreeMaxInputPixels (lib/core/services/anlas_calculator.dart:19); AnlasCalculator.novelAiUpscaleMaxInputPixels (lib/core/services/anlas_calculator.dart:21). Rename to `testNovelAiConnection`. [rule N6]
D21 · Naming Consistency· `hasNAISyntax` spells `NAI` where 18 names in the project spell it `Nai` · ×1
`hasNAISyntax` spells `NAI` where 18 names in the project spell it `Nai` lib/core/utils/sd_to_nai_converter.dart:78— 18 of 19 names in project repository.core spell the token `Nai` (18 of 19; unit: names in project repository.core containing `Nai`). Peers: StorageKeys.qualityPresetNaiTier (lib/core/constants/storage_keys.dart:157); StorageKeys.comfyuiSeedvr2EmbedNaiMetadata (lib/core/constants/storage_keys.dart:404); LocalStorageService.getQualityPresetNaiTier (lib/core/storage/local_storage_service.dart:360); LocalStorageService.setQualityPresetNaiTier (lib/core/storage/local_storage_service.dart:369); ComfyuiPromptParser.toNaiCharacters (lib/core/utils/comfyui_prompt_parser.dart:59). Rename to `hasNaiSyntax`. [rule N6]
D28 · Secrets (history)· Rotate the exposed credentials · ×1
REDACTED
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 10 of 1565 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1565 of the 2118 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: tool/metadata/check_metadata_extraction.dart, lib/presentation/screens/settings/widgets/gallery_cache_actions.dart, lib/domain/entities/gallery_image_entity.dart, lib/presentation/providers/gallery_scan_progress_provider.dart, lib/domain/entities/gallery_entity_mapper.dart, tool/metadata/check_metadata_simple.dart, lib/core/exceptions/gallery_exceptions.dart, lib/data/services/gallery/scan_config.dart (and 2 more). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
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.
Logging is not universal — Only 1/4 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `macos`, `packages/nai_png_codec`.
No SAST REDACTED:4— No static application security testing detected. For this repository's stack, add the Dart analyzer's security lints plus `semgrep --config=auto` as a CI step. What was searched, so you can tell an absence from a miss: the 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
No dependency-update automation android/app/build.gradle:73— `android/app/build.gradle` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
Nullable reference types not enabled everywhere — 0/1 C# file(s) are in a nullable-enabled context. This repository commits no project file, so nothing sets <Nullable>enable</Nullable> for it: a file is enabled only by its own `#nullable enable`, by a Unity `csc.rsp` with `-nullable:enable` for its assembly, or as a file-based app (`#:` directives) whose `#:property Nullable` does not turn it off. NRTs catch a whole class of null-deref bugs at compile time.
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.
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. semgrep could not parse 1 file(s) — `android/app/src/main/kotlin/com/aaalice/nai_launcher/AgentQuestionNotifications.kt` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
Run 01a1e61c-20d1-7b3a-a9cb-12960ff13de4 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 99 · Warnings: 2612 · Recommendations: 91 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 16-11-2026 @ 20:46 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.