Public report of xiufengsun/TokenTracker, published 17 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, 17 November 2026, 20:22 UTC · Survey ID cd_82cee9591c144f5eac0fba61cb984a73
xiufengsun/TokenTracker
Measured 17 November 2026, 20:20 UTC, at code version e2ff749
Code coverage is not measured: .NET suite (CouldNotMeasureRanButNoData).
CAI scoreAt risk
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: 200,872 lines of product code in 6 projects, tests not counted · Estimated rebuild effort: about 2.8 person-years · Weakest lens: Code Health, 26.0
Findings by how serious they are
157 critical1984 serious199 minor
17 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
17 November 2026, 20:20 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.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
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 ▸
65of 65 dimensions measured by tools.
2312of 2340 findings point to an exact file and line, so you can open each one in the code. The other 28 concern the repository as a whole, such as missing documentation.
65dimensions across 6 lenses, read from 200,872 lines of product code in 6 projects.
xiufengsun/TokenTracker is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back in part because it has errors that are caught and ignored. It scores 41.0 out of 100, which the At risk rating leaves unchanged.
Code Health, at 26.0, is the weakest lens and counts most in the score. The best first step is handling the discarded errors, worth about 14.1 points. Removing the unread values comes next, worth about 9.3 points. Raising Code Health to 70 would lift the score to about 54.3.
Sixty-eight errors are caught and ignored, so failures can go unnoticed. Thirty-three pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Handling or logging the ignored errors and pinning each tool to an exact version would close both risks. Updating the vulnerable packages would fix the 13 packages with a known security hole, and the ten passwords or keys in the code's history and the nine passwords or keys in the code need replacing, with the old ones switched off. The 12 sets of files in separate parts that keep changing together need that dependency made explicit.
The product code is 200,872 lines, about €410,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 Code Health rose from 26.0 to 70, the lowest score rated Strong, the score would rise from 41.0 to about 54.3.
Code composition: what the lines of code are
Business logic 3%Supporting code 1%Tests 96%
Rebuild cost: about €410,000 · Estimate
Cost to rebuild
€130,000 to €680,000, for 2,239 to 7,121 hours of work, about 2.8 person-years for 1 to 6 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 41. 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: 200,872 lines of product code
Comment lines
The estimate prices 199,544 lines. Comment lines count towards the size of 200,872 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 68 EmptyCatchBlock finding(s) in Explicit Debt — start with ServerManager.cs (26), DashboardWindow.cs (13), PetWindow.cs (10).
Raises the score by about 14.1 points · Medium effort · Explicit Debt
2
Resolve the 2 WriteOnlyPrivateField finding(s) in Explicit Debt — start with PetWindow.cs (2).
Raises the score by about 9.3 points · Low effort · Explicit Debt
3
Bring the 217 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with cmdSync (cyclomatic 830), createLocalApiHandler::handleLocalApi (cyclomatic 645), local-api.createLocalApiHandler.handleLocalApi (cyclomatic 634).
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 €410,000 to build again, about 2.8 person-years of work. Its weakest lens is Code Health, at 26.0 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 68 EmptyCatchBlock finding(s) in Explicit Debt. Of all the actions in this report, it raises the score most for the work it takes: about 14.1 points for medium effort, because it clears the 68 Explicit Debt 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 5.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 211,152 lines over the last 90 days, which is about 856,339 lines a year. At that pace, the extra work comes to an estimated 111.9 to 671.3 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: 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.
107 modules, with 47 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 67 more are left out to keep it readable.
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.
edge-patches uses edge-patches.tokentracker-account-daily, so a change to edge-patches.tokentracker-account-daily can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-account-daily.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches uses edge-patches.tokentracker-account-hourly, so a change to edge-patches.tokentracker-account-hourly can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-account-hourly.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches uses edge-patches.tokentracker-account-skills, so a change to edge-patches.tokentracker-account-skills can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-account-skills.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches uses edge-patches.tokentracker-account-summary, so a change to edge-patches.tokentracker-account-summary can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-account-summary.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches uses edge-patches.tokentracker-badge-svg, so a change to edge-patches.tokentracker-badge-svg can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-badge-svg.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches uses edge-patches.tokentracker-leaderboard-profile, so a change to edge-patches.tokentracker-leaderboard-profile can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-leaderboard-profile.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches uses edge-patches.tokentracker-leaderboard-refresh, so a change to edge-patches.tokentracker-leaderboard-refresh can break edge-patches, while a change to edge-patches can't break edge-patches.tokentracker-leaderboard-refresh.
Position
Below the diagonal: edge-patches uses a module listed above it, which is the healthy direction.
edge-patches.cloud.alipay uses edge-patches.cloud.contracts, so a change to edge-patches.cloud.contracts can break edge-patches.cloud.alipay, while a change to edge-patches.cloud.alipay can't break edge-patches.cloud.contracts.
Position
Below the diagonal: edge-patches.cloud.alipay uses a module listed above it, which is the healthy direction.
edge-patches.cloud.paddle uses edge-patches.cloud.contracts, so a change to edge-patches.cloud.contracts can break edge-patches.cloud.paddle, while a change to edge-patches.cloud.paddle can't break edge-patches.cloud.contracts.
Position
Below the diagonal: edge-patches.cloud.paddle uses a module listed above it, which is the healthy direction.
edge-patches.cloud.waffo uses edge-patches.cloud.contracts, so a change to edge-patches.cloud.contracts can break edge-patches.cloud.waffo, while a change to edge-patches.cloud.waffo can't break edge-patches.cloud.contracts.
Position
Below the diagonal: edge-patches.cloud.waffo uses a module listed above it, which is the healthy direction.
edge-patches.cloud.wechat uses edge-patches.cloud.contracts, so a change to edge-patches.cloud.contracts can break edge-patches.cloud.wechat, while a change to edge-patches.cloud.wechat can't break edge-patches.cloud.contracts.
Position
Below the diagonal: edge-patches.cloud.wechat uses a module listed above it, which is the healthy direction.
src.hooks uses src.hooks.use-usage-limits, so a change to src.hooks.use-usage-limits can break src.hooks, while a change to src.hooks can't break src.hooks.use-usage-limits.
Position
Below the diagonal: src.hooks uses a module listed above it, which is the healthy direction.
src.lib uses src.lib.dashboard-refresh, so a change to src.lib.dashboard-refresh can break src.lib, while a change to src.lib can't break src.lib.dashboard-refresh.
Position
Below the diagonal: src.lib uses a module listed above it, which is the healthy direction.
src.lib uses src.lib.exchange-rate, so a change to src.lib.exchange-rate can break src.lib, while a change to src.lib can't break src.lib.exchange-rate.
Position
Below the diagonal: src.lib uses a module listed above it, which is the healthy direction.
src.lib uses src.lib.model-breakdown, so a change to src.lib.model-breakdown can break src.lib, while a change to src.lib can't break src.lib.model-breakdown.
Position
Below the diagonal: src.lib uses a module listed above it, which is the healthy direction.
src.lib uses src.lib.skills-inventory, so a change to src.lib.skills-inventory can break src.lib, while a change to src.lib can't break src.lib.skills-inventory.
Position
Below the diagonal: src.lib uses a module listed above it, which is the healthy direction.
src.lib.bot.expressions uses src.lib.bot.face, so a change to src.lib.bot.face can break src.lib.bot.expressions, while a change to src.lib.bot.expressions can't break src.lib.bot.face.
Position
Below the diagonal: src.lib.bot.expressions uses a module listed above it, which is the healthy direction.
src.lib.bot.states uses src.lib.bot.face, so a change to src.lib.bot.face can break src.lib.bot.states, while a change to src.lib.bot.states can't break src.lib.bot.face.
Position
Below the diagonal: src.lib.bot.states uses a module listed above it, which is the healthy direction.
src.lib.bot.states uses src.lib.bot.shape, so a change to src.lib.bot.shape can break src.lib.bot.states, while a change to src.lib.bot.states can't break src.lib.bot.shape.
Position
Below the diagonal: src.lib.bot.states uses a module listed above it, which is the healthy direction.
src.ui.share.use-share-card-data uses src.ui.share.build-share-card-data, so a change to src.ui.share.build-share-card-data can break src.ui.share.use-share-card-data, while a change to src.ui.share.use-share-card-data can't break src.ui.share.build-share-card-data.
Position
Below the diagonal: src.ui.share.use-share-card-data uses a module listed above it, which is the healthy direction.
edge-patches.cloud uses edge-patches.cloud.contracts, so a change to edge-patches.cloud.contracts can break edge-patches.cloud, while a change to edge-patches.cloud can't break edge-patches.cloud.contracts.
Position
Below the diagonal: edge-patches.cloud uses a module listed above it, which is the healthy direction.
edge-patches.cloud uses edge-patches.cloud.alipay, so a change to edge-patches.cloud.alipay can break edge-patches.cloud, while a change to edge-patches.cloud can't break edge-patches.cloud.alipay.
Position
Below the diagonal: edge-patches.cloud uses a module listed above it, which is the healthy direction.
edge-patches.cloud uses edge-patches.cloud.paddle, so a change to edge-patches.cloud.paddle can break edge-patches.cloud, while a change to edge-patches.cloud can't break edge-patches.cloud.paddle.
Position
Below the diagonal: edge-patches.cloud uses a module listed above it, which is the healthy direction.
edge-patches.cloud uses edge-patches.cloud.waffo, so a change to edge-patches.cloud.waffo can break edge-patches.cloud, while a change to edge-patches.cloud can't break edge-patches.cloud.waffo.
Position
Below the diagonal: edge-patches.cloud uses a module listed above it, which is the healthy direction.
edge-patches.cloud uses edge-patches.cloud.wechat, so a change to edge-patches.cloud.wechat can break edge-patches.cloud, while a change to edge-patches.cloud can't break edge-patches.cloud.wechat.
Position
Below the diagonal: edge-patches.cloud uses a module listed above it, which is the healthy direction.
src.lib.bot.cycles uses src.lib.bot.states, so a change to src.lib.bot.states can break src.lib.bot.cycles, while a change to src.lib.bot.cycles can't break src.lib.bot.states.
Position
Below the diagonal: src.lib.bot.cycles uses a module listed above it, which is the healthy direction.
src.lib.bot.engine uses src.lib.bot.states, so a change to src.lib.bot.states can break src.lib.bot.engine, while a change to src.lib.bot.engine can't break src.lib.bot.states.
Position
Below the diagonal: src.lib.bot.engine uses a module listed above it, which is the healthy direction.
src.ui.share uses src.ui.share.ShareModal, so a change to src.ui.share.ShareModal can break src.ui.share, while a change to src.ui.share can't break src.ui.share.ShareModal.
Position
Below the diagonal: src.ui.share uses a module listed above it, which is the healthy direction.
src.ui.share uses src.ui.share.build-share-card-data, so a change to src.ui.share.build-share-card-data can break src.ui.share, while a change to src.ui.share can't break src.ui.share.build-share-card-data.
Position
Below the diagonal: src.ui.share uses a module listed above it, which is the healthy direction.
src.ui.share uses src.ui.share.capture-share-card, so a change to src.ui.share.capture-share-card can break src.ui.share, while a change to src.ui.share can't break src.ui.share.capture-share-card.
Position
Below the diagonal: src.ui.share uses a module listed above it, which is the healthy direction.
src.ui.share uses src.ui.share.use-share-card-data, so a change to src.ui.share.use-share-card-data can break src.ui.share, while a change to src.ui.share can't break src.ui.share.use-share-card-data.
Position
Below the diagonal: src.ui.share uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.decor, so a change to src.lib.bot.decor can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.decor.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.eyefit, so a change to src.lib.bot.eyefit can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.eyefit.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.shape, so a change to src.lib.bot.shape can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.shape.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.expressions, so a change to src.lib.bot.expressions can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.expressions.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.states, so a change to src.lib.bot.states can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.states.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.cycles, so a change to src.lib.bot.cycles can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.cycles.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
src.lib.bot uses src.lib.bot.engine, so a change to src.lib.bot.engine can break src.lib.bot, while a change to src.lib.bot can't break src.lib.bot.engine.
Position
Below the diagonal: src.lib.bot uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 26.0 · Weak · gated by D1, D2, D17, R1, R3 ·
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
78
High / Critical
A03:2025 — Software Supply Chain Failures
37
High / Critical
A07:2025 — Authentication Failures
20
High / Critical
Roadmap
Top priorities: Resolve the 68 EmptyCatchBlock finding(s) in Explicit Debt — start with ServerManager.cs (26), DashboardWindow.cs (13), PetWindow.cs (10); Resolve the 2 WriteOnlyPrivateField finding(s) in Explicit Debt — start with PetWindow.cs (2); Bring the 217 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with cmdSync (cyclomatic 830), createLocalApiHandler::handleLocalApi (cyclomatic 645), local-api.createLocalApiHandler.handleLocalApi (cyclomatic 634).
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 68 EmptyCatchBlock finding(s) in Explicit Debt — start with ServerManager.cs (26), DashboardWindow.cs (13), PetWindow.cs (10).
Bring the 217 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with cmdSync (cyclomatic 830), createLocalApiHandler::handleLocalApi (cyclomatic 645), local-api.createLocalApiHandler.handleLocalApi (cyclomatic 634).
Bring the 292 bodies over 30 down to 30 or less in Cognitive Complexity — start with cmdSync (cognitive 1298), createLocalApiHandler::handleLocalApi (cognitive 1058), local-api.createLocalApiHandler.handleLocalApi (cognitive 1041).
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 — 157
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 — 1984
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 — 199
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 17
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 65 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 — 65 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, 2312 of 2340 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.
D10 Test 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. The 88 test(s) behind this row are the ones the C# collector could read, and this repository also carries at least 673 test source file(s) (.ts, .tsx, .rs, .swift, .js, .cjs, .jsx, .mjs) that it cannot: it parses C# syntax and matches C# test attributes, so a vitest/jest/JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
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 reliability NOT MEASURED: this repository's test suite spans .NET and JavaScript/TypeScript, and the JavaScript/TypeScript half could not be re-run — .NET suite (the runs D8 measures coverage on): measured (0 flaky); JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in the repository root (4881 tests); its own test command under node's V8 coverage via `npm ci --ignore-scripts` in TokenTrackerLinux/ (4 tests); vitest via `npm ci --ignore-scripts` in dashboard/ (1694 tests)): not included — too large to re-run within its budget. No partial figure is published as if it were the whole: reliability is excluded from the score rather than counted as a near-zero.
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 package.json, but the licence verdict published here was taken over its NuGet package dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D17 Explicit Debt — 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. The 70 deducted marker(s) and the 6.8/KLoC density on this row were taken over this repository's .NET projects ALONE: .js (94,239 lines, 47% of production source), .jsx (38,920 lines, 19% of production source) went unread, because every marker collector on this path is reached through a C# workspace. D17's marker collectors need a compiler we do not have for that language, so none of its nine marker kinds were read there. The debt in that source is UNMEASURED — its absence from the score above is a gap in this analyzer's language coverage, not a finding that the code carries none.
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.
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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these 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's deterministic call-shape rules are gated per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — 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 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 — 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. Tracing effort is measured over resolved call sites, and all 1035 sampled here came from .cjs/.html/.js/.mjs files. This repository's .jsx source is a material share of its production lines and contributed none, so the score above is a verdict about the part that was read. Not a finding that the unread half navigates well — it is unmeasured.
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. `TokenTrackerBar/Shared/NativeLocalization.swift`, `TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift`, `TokenTrackerBar/TokenTrackerBar/Services/DynamicIslandController.swift`, `TokenTrackerBar/TokenTrackerBar/Views/DynamicIslandView.swift`, `TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift`, … (+4 more) 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.
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 reads a prose claim (a path, a setting, a variable, a route, a version, a project, an install, a bare project name in a command) only in text identified as English: the cues that tell a claim from an absence, the past, a plan or an example are an English lexicon, and on other text they would let a false claim through. Links, image targets, fenced commands with an explicit path or a package-manager script, and env-fence variables are checked in every language. 'und' is text the identifier could not name (too short, mixed script, no function words).
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.
PF3 Async & latency hygiene — 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. 176 further occurrence(s) are not listed individually; the score already reflects all 216.
R10 Code Duplication — 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. 603 further occurrence(s) are not listed individually; the score already reflects all 643.
R2 Cyclomatic Complexity — 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. 918 further occurrence(s) are not listed individually; the score already reflects all 958.
R3 Large Files — 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. 46 further occurrence(s) are not listed individually; the score already reflects all 86.
R7 Dead Code — 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. 26 further occurrence(s) are not listed individually; the score already reflects all 66.
X1 Async correctness — 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.
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. 186 further occurrence(s) are not listed individually; the score already reflects all 226.
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.
X18 Disposal-pattern correctness — 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.
X19 Unrestored process-global state — 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.
X2 Cancellation propagation — 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.
X21 Side-effecting pattern guard — 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.
X22 Contradicted release guard — 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 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.
X28 Index access outside its own emptiness guard — 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.
X29 Per-element action decided by a fixed element — 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.
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.
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. 37 further occurrence(s) are not listed individually; the score already reflects all 77.
X30 Support guard that admits what it rejects — 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.
X7 Silent fallback defaults — 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. 51 further occurrence(s) are not listed individually; the score already reflects all 91.
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.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
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.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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.
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".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
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.
806 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was cmdSync at 830. A further 15 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 MenuBarDisplayMetric.menuLabel at 43 — they are counted neither in the figure above nor in this dimension's score. 5 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: TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift (UsageLimitsResponse.utilizationPercent at 41), dashboard/src/lib/limits-providers.js (limits-providers.limitProviderName at 22), dashboard/src/hooks/use-cloud-billing.js (use-cloud-billing.refreshAccount at 21), TokenTrackerBar/TokenTrackerBar/Models/MenuBarIconStyle.swift (MenuBarRunnerPace.frameInterval at 17), src/cli.js (cli.run at 17). 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.
+ 582 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 217 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with cmdSync (cyclomatic 830), createLocalApiHandler::handleLocalApi (cyclomatic 645), local-api.createLocalApiHandler.handleLocalApi (cyclomatic 634). — 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 217 together lifts Cyclomatic Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; 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.
+ 671 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 292 bodies over 30 down to 30 or less in Cognitive Complexity — start with cmdSync (cognitive 1298), createLocalApiHandler::handleLocalApi (cognitive 1058), local-api.createLocalApiHandler.handleLocalApi (cognitive 1041). — 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 292 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; 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 Classes6.5 / 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 120 FunctionTooLong finding(s) in God Classes — start with sync.js (7), REDACTED (3), init.js (3). — One of this dimension's main actionable groups (120 warning-level).
Resolve the 64 FileTooLong finding(s) in God Classes — start with REDACTED, sync.js, usage-limits.js. — One of this dimension's main actionable groups (64 warning-level).
Resolve the 18 ClassTooLong finding(s) in God Classes — start with ClawdCompanionView.swift, DashboardPage.jsx, StatusBarController.swift. — One of this dimension's main actionable groups (18 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.
32 duplicated block group(s) detected. 0.9 % of the production lines (1,818 of 200,872) are in a reported copy. A further 46 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. Measured on part of this repository only: .js, .jsx (66% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
Edited copy of a member (5 corresponding lines) · ×4TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:43
+ 50 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 4 Edited copy of a member (5 corresponding lines) finding(s) in Code Duplication — start with Colors.swift, MenuBarBotFrameProvider.swift, NativeBridge.swift. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 4 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with StatusBarController.swift, Colors.swift, LimitsSettingsView.swift. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 3 Edited copy of a member (29 corresponding lines) finding(s) in Code Duplication — start with SharedWidgetViews.swift, ServerManager.swift, QueueActivityMonitor.swift. — One of this dimension's main actionable groups (3 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.
6 production modules (Cargo+npm+XcodeGen), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; an XcodeGen target's dependency on a local Swift package or on a target of another project is not visible there; 0 module(s) off the main sequence, with abstractness counted on 3 of the 6 (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.
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 88 tests. Measured on the C# suite only — at least 673 test source file(s) (.ts, .tsx, .rs, .swift, .js, .cjs, .jsx, .mjs) went unread, so its test quality is unmeasured and is not in these counts.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
6 outdated, 0 yanked direct Cargo dependencies. Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: libc · ×6
✓ On the Gold path — maintain.
Detailed fixes: d12_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.
6 secret(s) detected. 2 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.
REDACTED
What to do
Resolve the 9 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (9 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 101 packages use a banned license. ★ DEPTH: this repository's MSBuild projects declare 4 direct `PackageReference`(s), and 97 further package(s) were reached beyond them by closing the graph over nuget.org's own nuspec dependency graph — so a banned licence pulled in only by a dependency's OWN dependencies is inside this verdict. A package whose licence nuget.org could not be asked for is not graded, and version ranges are taken at their lower bound, so this is the closure as that graph states it rather than a restored consumer's exact resolution. ★ COVERAGE OF THIS VERDICT: it grades this repository's NuGet package dependencies and nothing else. The repository also declares package.json, 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: src/commands/sync.js (53×828=43884); src/lib/local-api.js (44×707=31108); REDACTED (109×241=26269) Repeated repair below the complexity floor: TokenTrackerWin/TrayApplicationContext.cs (10 of 16 changes were fixes); TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift (9 of 17 changes were fixes); TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift (9 of 16 changes were fixes)
Resolve the 92 Hotspot finding(s) in Churn × Complexity Hotspots — start with sync.js, local-api.js, REDACTED. — One of this dimension's main actionable groups (92 warning-level).
Resolve the 8 Repeated repair finding(s) in Churn × Complexity Hotspots — start with TrayApplicationContext.cs, UsageLimits.swift, Strings.swift. — One of this dimension's main actionable groups (8 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.8 / 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.
55 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is TokenTrackerLinux/src-tauri/src/pet.rs. Counted over 449 of the 612 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 · ×5
Further sole-owners (lower concentration)
What to do
Resolve the 5 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (5 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 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.
70 deducted debt markers + 1 dead symbols across 8374 LoC in the .NET projects (6.8/KLoC) → score 0.0. Measured on the .NET source only: .js, .jsx (66% of production source) was not read, and carries at least 0 uncounted task marker(s) in 0 file(s).
Dead code: DWMSBT_MAINWINDOWTokenTrackerWin/DashboardWindow.cs:1229
What to do
Resolve the 68 EmptyCatchBlock finding(s) in Explicit Debt — start with ServerManager.cs (26), DashboardWindow.cs (13), PetWindow.cs (10). — One of this dimension's main actionable groups (68 issue-level).
Resolve the 2 WriteOnlyPrivateField finding(s) in Explicit Debt — start with PetWindow.cs (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Dead code finding(s) in Explicit Debt — start with DashboardWindow.cs. — 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.
2 of 2 documentation facets pass in full. 63 document(s) read across 5 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 foundTokenTrackerWin/TokenTrackerWin.csproj:4
What to do
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with TokenTrackerWin.csproj. — 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 76 declarations measured against a convention their peers follow.
`resolveAllHermesDBPaths` spells `DB` where 62 names in the project spell it `Db`REDACTED:8374
`formatDateUTC` spells `UTC` where 12 names in the project spell it `Utc`dashboard/src/lib/date-range.ts:9
What to do
Resolve the 1 `resolveAllHermesDBPaths` spells `DB` where 62 names in the project… finding(s) in Naming Consistency — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `formatDateUTC` spells `UTC` where 12 names in the project spell it… finding(s) in Naming Consistency — start with date-range.ts. — 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 comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
6 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated. Measured over the .cjs/.html/.js/.mjs source only — this repository's .jsx was not sampled for call sites, so this score covers part of the tree, not all of it.
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.
10 finding(s): 0 critical, 10 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 10 REDACTED finding(s) in Secrets (history) — start with REDACTED (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (10 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).
78 finding(s): 0 critical, 39 high, 39 medium, 0 low. 33 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 28 file(s) — `TokenTrackerBar/Shared/NativeLocalization.swift` (line 22, line 23, line 28, …), `TokenTrackerBar/TokenTrackerBar/Services/DynamicIslandController.swift` (line 18, line 26, line 27, …), `TokenTrackerBar/TokenTrackerBar/Views/DynamicIslandView.swift` (line 309, line 310, line 311, …), `TokenTrackerBar/TokenTrackerBarTests/LimitsSettingsStoreTests.swift` (line 38, line 45), `TokenTrackerWin.Tests/ChildProcessProxyTests.cs` (line 89, line 91, line 93, …), … (+23 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. In 6 of those file(s) — `TokenTrackerWin.Tests/ChildProcessProxyTests.cs`, `TokenTrackerWin.Tests/LocalSyncPublisherTests.cs`, `TokenTrackerWin.Tests/ResumableDownloaderTests.cs`, `TokenTrackerWin.Tests/UpdateReleaseClientTests.cs`, `TokenTrackerWin/ResumableDownloader.cs`, … (+1 more) — the break is a C# primary constructor, which semgrep's grammar cannot parse and which hides the type from every rule scoped to it; those files were re-scanned from a shadow copy with the constructor's parameter list blanked (line and column preserving), which restores the type to the rules, and 0 additional row(s) came from that pass. Only the header's own parameter list is unread in 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
REDACTED
REDACTED
REDACTED
+ 9 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
No action in Static Analysis (SAST) — all 33 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (33 issue-level, 0 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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 10 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (8), REDACTED (2). — One of this dimension's main actionable groups (10 issue-level).
Resolve the 3 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 issue-level).
Resolve the 6 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (5), REDACTED. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
56 of 449 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/lib/omp-hook.js. Counted over 449 of the 612 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned file · ×56src/lib/omp-hook.js:1
Orphaned files with no living knowledge
What to do
Resolve the 56 Orphaned file finding(s) in Knowledge Freshness — start with omp-hook.js, dashboard-preload.js, openclaw-hook.js. — One of this dimension's main actionable groups (56 recommendation-level).
Resolve the 1 Orphaned files with no living knowledge finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
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 12 Boundary-crossing change coupling finding(s) in Change Coupling — start with agent-logos.js (3), provider-display.js (3), tokentracker-leaderboard-refresh.ts (2). — One of this dimension's main actionable groups (12 issue-level).
Resolve the 10 Change coupling finding(s) in Change Coupling — start with sessions-api.ts, tokentracker-account-model-breakdown.ts, tokentracker-account-daily.ts. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 10 Change-coupling hub finding(s) in Change Coupling — start with tokentracker-account-summary.ts, limits-providers.js, tokentracker-leaderboard-profile.ts. — 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.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
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 6 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 — 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 singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
`TokenUnits` keeps mutable `static` state — one slot for the whole process, shared by every thread that reaches the type however its instances are created — and mutates it outside any lock (_cached; e.g. `_cached` at line 28). Concurrent callers lose updates, and a collection that is not built for concurrent writers can corrupt. — TokenTrackerWin/TokenUnits.cs:12
What to do
A `static` field is one slot for the whole process, however its type is created: back it with a thread-safe type (ConcurrentDictionary, Interlocked), take a lock around every write, or move it into a registered singleton that does.
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 the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. 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.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Other · 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.
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.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability5.0 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `TokenTrackerLinux/src-tauri`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Add a health-check endpoint (@godaddy/terminus or a /health route) so orchestrators and load balancers can probe liveness/readiness.
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.
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `nuget`, `cargo`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list. — REDACTED:2
What to do
Dependabot is configured but does not watch `nuget`, `cargo` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
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.
Do you agree with this assessment?
P5 · DR & Backup4.0 / 10Weak✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.
Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. 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.
`fs.realpathSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — TokenTrackerBar/scripts/native-qa-server.cjs:80, TokenTrackerBar/scripts/native-qa-server.cjs:89
`fs.mkdirSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — TokenTrackerBar/scripts/native-qa-server.cjs:90, TokenTrackerBar/scripts/native-qa-server.cjs:93
`fs.writeFileSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×4) — TokenTrackerBar/scripts/native-qa-server.cjs:95, TokenTrackerBar/scripts/native-qa-server.cjs:96, TokenTrackerBar/scripts/native-qa-server.cjs:260, …
`fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×13) — src/commands/init.js:789, src/commands/init.js:842, src/commands/init.js:850, …
`fssyncLocal.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — src/commands/init.js:799, src/commands/init.js:800
`fssync.existsSync` in `runFirstSyncAndRead` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — src/commands/init.js:2370
`fssync.existsSync` in `cmdServe` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:88
`fs.writeFileSync` in `cmdSessions` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — src/commands/sessions.js:22
`fssync.existsSync` in `cmdStatus` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×10) — src/commands/status.js:383, src/commands/status.js:387, src/commands/status.js:395, …
`fssync.existsSync` in `callback to kiroCliMarkers.map` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — src/commands/status.js:434, src/commands/status.js:439
`fssync.existsSync` in `callback to kiroCliMarkers.some` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — src/commands/status.js:448
`fssync.existsSync` in `kiroIdeHasData` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — src/commands/status.js:459
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety1.3 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
155 typed · 996 plain JS — the untyped files are TokenTrackerBar/scripts/native-qa-auth.cjs, TokenTrackerBar/scripts/native-qa-server.cjs, TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js, TokenTrackerLinux/scripts/sync-tauri-icon.mjs, TokenTrackerLinux/test/sync-tauri-icon.test.mjs, dashboard/scripts/capture-dashboard-screenshot.mjs (+990 more).
Do you agree with this assessment?
R10 · Code Duplication4.6 / 10Weak✓ Tool-verified
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
46 duplicated blocks under the repository root have copies in at least two of the sibling directories TokenTrackerLinux, dashboard, scripts, src — 34 of them are reported below, and 12 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 46 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 46 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 46 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — REDACTED:50
39 duplicated blocks under dashboard/src/ have copies in at least two of the sibling directories components, contexts, hooks, lib, pages, ui — 20 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 39 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 39 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 39 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — dashboard/src/hooks/use-trend-data.ts:871
12 duplicated blocks under src/ have copies in at least two of the sibling directories commands, lib — 10 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — src/commands/uninstall.js:50
dashboard/edge-patches/tokentracker-account-daily.ts:5 · dashboard/edge-patches/tokentracker-account-summary.ts:32 — these 2 files are line-for-line copies of one another — 576 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — dashboard/edge-patches/tokentracker-account-daily.ts:5
dashboard/src/hooks/use-trend-data.ts:33 · dashboard/src/hooks/use-usage-data.ts:27 — the two spans are one implementation copied and then locally edited — 1611 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — dashboard/src/hooks/use-trend-data.ts:33
src/lib/ark-agent-plan-limits.js:24 · src/lib/ark-coding-plan-limits.js:24 — these 2 files are line-for-line copies of one another — 215 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — src/lib/ark-agent-plan-limits.js:24
REDACTED:13598 · REDACTED:15821 — the two spans are one implementation copied and then locally edited — 879 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:13598
src/lib/omp-session.js:219 · src/lib/pi-session.js:427 — the two spans are one implementation copied and then locally edited — 1014 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/lib/omp-session.js:219
src/lib/omp-session.js:17 · src/lib/pi-session.js:22 — the two spans are one implementation copied and then locally edited — 864 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/lib/omp-session.js:17
dashboard/edge-patches/tokentracker-account-hourly.ts:81 · dashboard/edge-patches/tokentracker-account-monthly.ts:68 — the two spans are one implementation copied and then locally edited — 925 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — dashboard/edge-patches/tokentracker-account-hourly.ts:81
dashboard/src/hooks/use-activity-heatmap.ts:41 · dashboard/src/hooks/use-usage-model-breakdown.ts:26 — the two spans are one implementation copied and then locally edited — 685 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — dashboard/src/hooks/use-activity-heatmap.ts:41
dashboard/edge-patches/tokentracker-account-heatmap.ts:141 · dashboard/edge-patches/tokentracker-account-model-breakdown.ts:795 — the two spans are one implementation copied and then locally edited — 636 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — dashboard/edge-patches/tokentracker-account-heatmap.ts:141
dashboard/src/pet.jsx:218 · dashboard/src/ui/foundation/ClawdAnimated.jsx:70 — the two spans are one implementation copied and then locally edited — 401 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — dashboard/src/pet.jsx:218
scripts/acceptance/gemini-hook-install.cjs:10 · scripts/acceptance/opencode-plugin-install.cjs:11 — the two spans are one implementation copied and then locally edited — 409 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/acceptance/gemini-hook-install.cjs:10
REDACTED:2734 · REDACTED:3076 — the two spans are one implementation copied and then locally edited — 321 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:2734
REDACTED:50 · scripts/copy-sync.cjs:68 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — REDACTED:50
scripts/copy-sync.cjs:68 · scripts/validate-copy-registry.cjs:10 — the two spans are one implementation copied and then locally edited — 343 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/copy-sync.cjs:68
REDACTED:12236 · REDACTED:17306 — the two spans are one implementation copied and then locally edited — 310 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:12236
dashboard/edge-patches/tokentracker-account-devices.ts:14 · dashboard/edge-patches/tokentracker-account-hourly.ts:8 · dashboard/edge-patches/tokentracker-account-monthly.ts:8 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — dashboard/edge-patches/tokentracker-account-devices.ts:14
src/lib/claude-config.js:39 · src/lib/gemini-config.js:47 — the two spans are one implementation copied and then locally edited — 439 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/lib/claude-config.js:39
dashboard/edge-patches/tokentracker-account-daily.ts:8 · dashboard/edge-patches/tokentracker-account-heatmap.ts:9 · dashboard/edge-patches/tokentracker-account-summary.ts:35 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — dashboard/edge-patches/tokentracker-account-daily.ts:8
dashboard/src/hooks/use-trend-data.ts:89 · dashboard/src/hooks/use-usage-model-breakdown.ts:38 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — dashboard/src/hooks/use-trend-data.ts:89
REDACTED:12804 · REDACTED:16798 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:12804
dashboard/src/lib/heatmap-compact.js:2 · src/lib/heatmap-compact.js:27 — these 2 files are line-for-line copies of one another — 53 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — dashboard/src/lib/heatmap-compact.js:2
dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx:140 · REDACTED:190 — the two spans are one implementation copied and then locally edited — 247 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx:140
src/lib/omp-session.js:399 · src/lib/pi-session.js:616 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/lib/omp-session.js:399
dashboard/src/hooks/use-trend-data.ts:292 · dashboard/src/hooks/use-trend-data.ts:408 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — dashboard/src/hooks/use-trend-data.ts:292
src/lib/sqlite-reader.js:81 · src/lib/sqlite-reader.js:148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/lib/sqlite-reader.js:81
src/lib/workbuddy-limits.js:550 · REDACTED:1098 — the two spans are one implementation copied and then locally edited — 369 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/lib/workbuddy-limits.js:550
src/commands/init.js:442 · src/commands/init.js:486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/commands/init.js:442
src/commands/sync.js:2052 · src/commands/sync.js:2121 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/commands/sync.js:2052
dashboard/edge-patches/tokentracker-account-daily.ts:477 · dashboard/edge-patches/tokentracker-account-model-breakdown.ts:496 · dashboard/edge-patches/tokentracker-account-summary.ts:463 · dashboard/edge-patches/tokentracker-leaderboard-profile.ts:435 · +1 more site(s) not listed — the 5 copies are spread across 5 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — dashboard/edge-patches/tokentracker-account-daily.ts:477
src/lib/codex-config.js:414 · src/lib/codex-config.js:482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/lib/codex-config.js:414
src/lib/codex-context-breakdown.js:702 · src/lib/grok-context-breakdown.js:769 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/lib/codex-context-breakdown.js:702
dashboard/edge-patches/tokentracker-leaderboard-profile.ts:683 · dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:705 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — dashboard/edge-patches/tokentracker-leaderboard-profile.ts:683
src/lib/openclaw-hook.js:10 · src/lib/openclaw-session-plugin.js:14 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/lib/openclaw-hook.js:10
src/commands/sync.js:5988 · src/commands/sync.js:6158 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/commands/sync.js:5988
dashboard/src/hooks/use-trend-data.ts:344 · dashboard/src/hooks/use-usage-model-breakdown.ts:159 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — dashboard/src/hooks/use-trend-data.ts:344
dashboard/src/ui/share/native-save.ts:50 · dashboard/src/ui/share/native-save.ts:91 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — dashboard/src/ui/share/native-save.ts:50
src/commands/uninstall.js:50 · src/lib/diagnostics.js:88 — the two spans are one implementation copied and then locally edited — 252 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — src/commands/uninstall.js:50
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
scripts/graph/auto-index.cjs:4 imports @sourcegraph/scip-typescript/dist/src/scip, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — scripts/graph/auto-index.cjs:4
scripts/graph/lib/importer.cjs:4 imports @sourcegraph/scip-typescript/dist/src/scip, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — scripts/graph/lib/importer.cjs:4
src/lib/trae-sqlite.js:8 imports @journeyapps/wa-sqlite/dist/wa-sqlite.mjs, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/lib/trae-sqlite.js:8
src/lib/trae-sqlite.js:10 imports @journeyapps/wa-sqlite/src/FacadeVFS.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — src/lib/trae-sqlite.js:10
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
cmdSync has cyclomatic complexity 710 and cognitive complexity 1096; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/commands/sync.js:553
handleLocalApi has cyclomatic complexity 645 and cognitive complexity 1058; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/local-api.js:1886
cmdStatus has cyclomatic complexity 381 and cognitive complexity 455; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/commands/status.js:198
parseAntigravityIncremental has cyclomatic complexity 248 and cognitive complexity 355; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:22484
CloudCheckoutPage has cyclomatic complexity 207 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — dashboard/src/pages/CloudCheckoutPage.jsx:49
parseDshIncremental has cyclomatic complexity 181 and cognitive complexity 234; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:25411
fetchUsageLimitsUncached has cyclomatic complexity 156 and cognitive complexity 225; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/usage-limits.js:4478
parseWorkbuddyIncremental has cyclomatic complexity 152 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:11601
parseCodexRolloutFile has cyclomatic complexity 151 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:590
parseGrokBuildIncremental has cyclomatic complexity 141 and cognitive complexity 239; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:21746
handleLocalApi has cyclomatic complexity 133 and cognitive complexity 177; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:528
getModelPricing has cyclomatic complexity 132 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×5) — dashboard/edge-patches/tokentracker-account-daily.ts:487, dashboard/edge-patches/tokentracker-account-model-breakdown.ts:506, dashboard/edge-patches/tokentracker-account-summary.ts:473, …
buildSessionAnalyticsInternal has cyclomatic complexity 126 and cognitive complexity 152; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/session-analytics.js:2387
parseRolloutIncremental has cyclomatic complexity 123 and cognitive complexity 148; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:325
enqueueTouchedBuckets has cyclomatic complexity 122 and cognitive complexity 230; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3598
parseRolloutRecords has cyclomatic complexity 112 and cognitive complexity 173; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2561
parseCopilotSessionStoreIncremental has cyclomatic complexity 111 and cognitive complexity 191; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:20241
parsePiLikeIncremental has cyclomatic complexity 109 and cognitive complexity 209; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:17582
(anonymous) has cyclomatic complexity 107 and cognitive complexity 137; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — TokenTrackerBar/scripts/native-qa-server.cjs:112
App has cyclomatic complexity 107 and cognitive complexity 69; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — dashboard/src/App.jsx:115
billing has cyclomatic complexity 103 and cognitive complexity 167; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — dashboard/edge-patches/tokentracker-billing.ts:36
parseClaudeIncremental has cyclomatic complexity 102 and cognitive complexity 155; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1056
repairCodexRescanInflation has cyclomatic complexity 99 and cognitive complexity 163; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/commands/sync.js:6291
CloudPlanView has cyclomatic complexity 99 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — dashboard/src/pages/CloudPage.jsx:58
parseCodebuddyIncremental has cyclomatic complexity 97 and cognitive complexity 218; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:10876
parseAntigravityFile has cyclomatic complexity 88 and cognitive complexity 142; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:23304
readOmpSessionFiles has cyclomatic complexity 86 and cognitive complexity 221; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/omp-session.js:233
readKimiSessions has cyclomatic complexity 85 and cognitive complexity 220; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/kimi-session.js:81
parseDroidIncremental has cyclomatic complexity 85 and cognitive complexity 160; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:16393
parseQoderNewIncremental has cyclomatic complexity 84 and cognitive complexity 145; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:7229
(anonymous) has cyclomatic complexity 83 and cognitive complexity 139; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1048
buildZcodeSessionRecords has cyclomatic complexity 82 and cognitive complexity 137; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/session-analytics.js:1542
applyIntegrationSetup has cyclomatic complexity 81 and cognitive complexity 118; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/commands/init.js:679
(anonymous) has cyclomatic complexity 80 and cognitive complexity 101; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — dashboard/edge-patches/tokentracker-leaderboard-profile.ts:898
readPiSessionFiles has cyclomatic complexity 78 and cognitive complexity 215; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — src/lib/pi-session.js:441
(anonymous) has cyclomatic complexity 78 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/cloud-sandbox/native-gateway.ts:79
Do you agree with this assessment?
R3 · Large Files3.4 / 10Weak✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
src/commands/sync.js has 7541 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/commands/sync.js:1
src/lib/usage-limits.js has 5042 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/usage-limits.js:1
src/lib/local-api.js has 3949 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/local-api.js:1
src/lib/session-analytics.js has 3236 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/session-analytics.js:1
src/commands/init.js has 2286 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/commands/init.js:1
REDACTED has 1827 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
src/lib/cursor-store.js has 1773 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/cursor-store.js:1
src/commands/status.js has 1702 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/commands/status.js:1
dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx has 1665 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1
dashboard/edge-patches/tokentracker-leaderboard-refresh.ts has 1534 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1
REDACTED has 1502 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
dashboard/src/pages/DashboardPage.jsx has 1466 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/pages/DashboardPage.jsx:1
src/lib/skills-manager.js has 1466 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/skills-manager.js:1
REDACTED has 1419 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js has 1298 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:1
REDACTED has 1247 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
src/lib/claude-categorizer.js has 1238 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/claude-categorizer.js:1
dashboard/edge-patches/tokentracker-embed-svg.ts has 1187 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/edge-patches/tokentracker-embed-svg.ts:1
dashboard/edge-patches/tokentracker-leaderboard-profile.ts has 1177 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/edge-patches/tokentracker-leaderboard-profile.ts:1
dashboard/src/pages/LeaderboardPage.jsx has 1176 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/pages/LeaderboardPage.jsx:1
dashboard/src/lib/mock-data.ts has 1150 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/lib/mock-data.ts:1
dashboard/src/lib/api.ts has 1079 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/lib/api.ts:1
dashboard/src/ui/dashboard/components/UsageOverview.jsx has 1072 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/ui/dashboard/components/UsageOverview.jsx:1
dashboard/edge-patches/tokentracker-account-model-breakdown.ts has 1071 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/edge-patches/tokentracker-account-model-breakdown.ts:1
dashboard/edge-patches/tokentracker-account-summary.ts has 1053 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/edge-patches/tokentracker-account-summary.ts:1
dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:1
src/lib/qoder-limits.js has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/qoder-limits.js:1
dashboard/edge-patches/tokentracker-account-daily.ts has 1002 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/edge-patches/tokentracker-account-daily.ts:1
dashboard/src/pet.jsx has 976 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/pet.jsx:1
dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx has 941 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx:1
dashboard/src/pages/SessionsPage.jsx has 899 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/pages/SessionsPage.jsx:1
src/lib/workbuddy-limits.js has 868 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/workbuddy-limits.js:1
dashboard/src/hooks/use-trend-data.ts has 866 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/hooks/use-trend-data.ts:1
dashboard/src/pages/CloudCheckoutPage.jsx has 859 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/pages/CloudCheckoutPage.jsx:1
dashboard/src/ui/dashboard/components/TrendMonitor.jsx has 844 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/ui/dashboard/components/TrendMonitor.jsx:1
src/lib/grok-limits.js has 833 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/grok-limits.js:1
src/lib/grok-context-breakdown.js has 816 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/grok-context-breakdown.js:1
dashboard/src/components/cloud/CloudMembershipCard.jsx has 754 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — dashboard/src/components/cloud/CloudMembershipCard.jsx:1
src/lib/codex-context-breakdown.js has 754 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/lib/codex-context-breakdown.js:1
REDACTED has 752 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage9.3 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×28) — TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:1, dashboard/edge-patches/tokentracker-account-daily.ts:1, REDACTED:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
the root package is TypeScript, but a type error in it cannot fail anything this repository runs: its `gen:bot-frames` script (`node scripts/gen-bot-frames.cjs`) compiles TypeScript with a transpile-only tool that strips types without checking them, and no script, config or CI step of the package runs `tsc --noEmit` or another type checker over it. Add a type check that can fail — a `typecheck` script running `tsc --noEmit` (or `vue-tsc`/`svelte-check`) that CI or the workspace pipeline runs, or a build step that checks before it bundles. — package.json:42
The package in `dashboard` declares the lint script `lint` (`eslint "src/**/*.{js,jsx,ts,tsx}"`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `dashboard` (or the workspace's task runner). — dashboard/package.json:10
Do you agree with this assessment?
R7 · Dead Code7.9 / 10Strong✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 149 application, 45 tooling and 693 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×7) — scripts/cloud-sandbox/hosted-archive-acceptance.cjs, dashboard/src/ui/dashboard/components/MacAppBanner.jsx, scripts/acceptance/gemini-hook-install.cjs, …
no import path from any entry point (149 application, 45 tooling, 693 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (dashboard/src/ui/dashboard/components/MacAppBanner.jsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — dashboard/src/hooks/useClawdState.js
Nothing imports this binding — it is safe to review for removal. (×21) — dashboard/src/contexts/AccountViewContext.jsx:32, dashboard/src/hooks/use-achievements.js:42, dashboard/src/hooks/use-limits-display-prefs.js:179, …
This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×10) — dashboard/edge-patches/tokentracker-account-daily.ts:45, dashboard/edge-patches/tokentracker-account-daily.ts:709, dashboard/edge-patches/tokentracker-account-hourly.ts:71, …
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable package.json — installs work only by hoisting accident. — test/cloud-access-sandbox-build.test.js:30
Declared in dashboard/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. — dashboard/package.json:38
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
Do you agree with this assessment?
R9 · Circular Imports4.7 / 10Weak✓ Tool-verified
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
dashboard/src/lib/dashboard-preload.js → dashboard/src/pages/LeaderboardPage.jsx → dashboard/src/lib/dashboard-preload.js (one verified cycle inside a mutually-dependent group of 4 files) — dashboard/src/lib/dashboard-preload.js:20
Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `ArgumentNullException` tells the caller a parameter was null when it provably was not.
Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements (or a repository exception type deriving from it) controlled by an `if` — directly or through the `using`, `lock` or `try` that wraps the throw — whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`); in the `else` branch, for a conjunct of the admitting condition that is FALSE of a non-null `p`. Range guards are read for bounds that leave nothing and for a `p > C.Count` bound whose index then reaches `C[p]`, `C.RemoveAt(p)` or a method of the same type that indexes with it. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped6.3 / 10Adequate✓ Tool-verified
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
`text` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:296
`label` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:334
`html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:389
`t.failed` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×3) — REDACTED:446, REDACTED:1006, REDACTED:1030
`trustScore` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:541
`pingCls` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:583
`t.regionWarnTitle(restrictedName)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:589
`t.histEmpty` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:962
`svgHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — dashboard/src/pet.jsx:308, dashboard/src/ui/foundation/ClawdAnimated.jsx:152
`redirectUrl` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/lib/browser-auth.js:79
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
1/2 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
~2.0 `!` null assertions per 1k TypeScript source lines — 55 assertion(s) across the 27692 source line(s) of the 108 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: dashboard/src/lib/bot/shape.ts (11), dashboard/edge-patches/tokentracker-profile-likes.ts (6), dashboard/src/lib/bot/engine.ts (6). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
~0.5 `!` suppressions per 1k syntax nodes — 20 suppression(s) across the 41190 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Enable <Nullable>enable</Nullable> across all projects 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 — 4 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.
SC1 Supply-chain hygiene — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 61 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
AC2 Forms & labels — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
AC3 Page structure — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
AC4 Keyboard semantics — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
AC5 ARIA correctness — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
AC6 Visual & motion safety — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
AX1 Captive dependencies — no DI registrations detected
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the dev server (`npm run dev` in TokenTrackerLinux/) exited before it served a page. Likely cause (the repository): the app needs environment variables or a config file (such as .env or .dev.vars) that the repository does not provide. Last output: "The file `javascriptcoregtk-4.1.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory. / The PKG_CONFIG_PATH environment variable is not set. / HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `javascriptcoregtk-4.1.pc`. / warning: build failed, waiting for other jobs to finish... / Building [==============> ] 314/492: serde_with, cc, gtk / Building [===============> ] 315/492: cc, gtk / Building [===============> ] 316/492: gtk" No runtime evidence was gathered. The cause is in the repository, not in our sandbox: the app needs environment variables or a config file (such as .env or .dev.vars) that the repository does not provide. Nothing here says the surface is inaccessible, only that it was never rendered.
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.
D11 Test Reliability — Test reliability not measured — polyglot suite, one half not re-run
D18 Solution Shape — D18 scores the shape of a .NET solution, but this repository's production source is mostly .rb, .rs, .swift, .ts, .tsx — the .NET project files present are an immaterial minority — so the dimension does not apply.
D22 Internal API Consistency — API consistency is measured on C#, TypeScript, Go only; the exposed JavaScript, Rust surface was not measured.
D23 Boundary Type-Coupling — single shared-core project — no cross-context coupling to assess
D25 ADR Conformance — no ADRs to check
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) — 9 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
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 dependency cycles — architectural integrity not assessed
D8 Code Coverage — Coverage NOT MEASURED: the .NET half could not be measured — the coverage run wrote reports, but they instrument no source line — nothing was measured; the JavaScript/TypeScript half measured 92.1% (node:test via `npm ci --ignore-scripts` in the repository root, the 3 run(s) test reliability made; its `test:icons` script (`node --test test/sync-tauri-icon.test.mjs`) under node's V8 coverage via `npm ci --ignore-scripts` in TokenTrackerLinux/). This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (5 value object(s))
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, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
IC1 Incompleteness & stubs — IC1 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 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 — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
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 — X1 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X12 Unreachable branch — X12 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 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 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 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 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 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 — X18 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X19 Unrestored process-global state — X19 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X2 Cancellation propagation — X2 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X21 Side-effecting pattern guard — X21 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X22 Contradicted release guard — X22 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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
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 — X27 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X28 Index access outside its own emptiness guard — X28 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X29 Per-element action decided by a fixed element — X29 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X3 Exception handling — X3 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 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 — X30 reached only 4% of this repository's production lines — javascript (140,026 lines), typescript (26,384 lines), swift (22,355 lines), rust (3,632 lines), ruby (47 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's C# was read, and every log call in it goes through a logger that takes one finished message — its own wrapper, log4net, Console or Debug — so an interpolated message there loses nothing the API could have kept. Calls through Microsoft.Extensions.Logging, Serilog, NLog or ZLogger, or any logger with a message-template overload, would be judged.
X6 Hand-rolled structured-format parsing — 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.
EmptyCatchBlock TokenTrackerWin/AutoUpdatePolicy.cs:47— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/CloudUsageExport.cs:89— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/Currency.cs:55— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:102— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:196— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:417— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:469— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:599— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:677— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:687— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:698— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:897— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:983— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:1081— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:1185— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/DashboardWindow.cs:1208— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/Diag.cs:42— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/Diag.cs:46— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/NativeLocalization.cs:59— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/NativeTheme.cs:53— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock REDACTED:303— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/PetWindow.cs:363— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/PetWindow.cs:497— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/PetWindow.cs:527— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
EmptyCatchBlock TokenTrackerWin/PetWindow.cs:567— empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
Boundary-crossing change coupling: agent-logos.js ↔ init.js dashboard/src/ui/marketing/agent-logos.js:1— `dashboard/src/ui/marketing/agent-logos.js` (context dashboard) and `src/commands/init.js` (context commands) sit in DIFFERENT parts of the tree yet 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
Boundary-crossing change coupling: tokentracker-leaderboard-refresh.ts ↔ matcher.js dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1— `dashboard/edge-patches/tokentracker-leaderboard-refresh.ts` (context dashboard) and `src/lib/pricing/matcher.js` (context pricing) sit in DIFFERENT parts of the tree yet change together 68% of the time (15 of the 22 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `31929b8f` feat(pricing): price Claude Fable 5.2 and its fast mode (#1090); `42102e02` fix(pricing): stop remapping Antigravity Gemini 3.x Flash to 2.5 Flash — run `git show` on any of them.
Boundary-crossing change coupling: tokentracker-leaderboard-refresh.ts ↔ index.js dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1— `dashboard/edge-patches/tokentracker-leaderboard-refresh.ts` (context dashboard) and `src/lib/pricing/index.js` (context pricing) sit in DIFFERENT parts of the tree yet change together 65% of the time (17 of the 26 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `2e774e82` fix(pricing): add GPT-6.1 Terra official Standard USD rates (#890); `0dce343a` fix(pricing): Haiku 5.5, Codex Ultrafast 6x, sync token message — run `git show` on any of them.
Boundary-crossing change coupling: tokentracker-leaderboard-profile.ts ↔ index.js dashboard/edge-patches/tokentracker-leaderboard-profile.ts:1— `dashboard/edge-patches/tokentracker-leaderboard-profile.ts` (context dashboard) and `src/lib/pricing/index.js` (context pricing) sit in DIFFERENT parts of the tree yet change together 65% of the time (17 of the 26 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 17 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `2e774e82` fix(pricing): add GPT-6.1 Terra official Standard USD rates (#890); `0dce343a` fix(pricing): Haiku 5.5, Codex Ultrafast 6x, sync token message — run `git show` on any of them.
Boundary-crossing change coupling: tokentracker-leaderboard-profile.ts ↔ matcher.js dashboard/edge-patches/tokentracker-leaderboard-profile.ts:1— `dashboard/edge-patches/tokentracker-leaderboard-profile.ts` (context dashboard) and `src/lib/pricing/matcher.js` (context pricing) sit in DIFFERENT parts of the tree yet change together 64% of the time (14 of the 22 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `31929b8f` feat(pricing): price Claude Fable 5.2 and its fast mode (#1090); `42102e02` fix(pricing): stop remapping Antigravity Gemini 3.x Flash to 2.5 Flash — run `git show` on any of them.
Boundary-crossing change coupling: tokentracker-account-summary.ts ↔ matcher.js dashboard/edge-patches/tokentracker-account-summary.ts:1— `dashboard/edge-patches/tokentracker-account-summary.ts` (context dashboard) and `src/lib/pricing/matcher.js` (context pricing) sit in DIFFERENT parts of the tree yet change together 64% of the time (14 of the 22 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `31929b8f` feat(pricing): price Claude Fable 5.2 and its fast mode (#1090); `42102e02` fix(pricing): stop remapping Antigravity Gemini 3.x Flash to 2.5 Flash — run `git show` on any of them.
Boundary-crossing change coupling: agent-logos.js ↔ sync.js dashboard/src/ui/marketing/agent-logos.js:1— `dashboard/src/ui/marketing/agent-logos.js` (context dashboard) and `src/commands/sync.js` (context commands) sit in DIFFERENT parts of the tree yet change together 62% of the time (10 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
Boundary-crossing change coupling: agent-logos.js ↔ status.js dashboard/src/ui/marketing/agent-logos.js:1— `dashboard/src/ui/marketing/agent-logos.js` (context dashboard) and `src/commands/status.js` (context commands) sit in DIFFERENT parts of the tree yet change together 62% of the time (10 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
Boundary-crossing change coupling: tokentracker-account-summary.ts ↔ index.js dashboard/edge-patches/tokentracker-account-summary.ts:1— `dashboard/edge-patches/tokentracker-account-summary.ts` (context dashboard) and `src/lib/pricing/index.js` (context pricing) sit in DIFFERENT parts of the tree yet change together 62% of the time (16 of the 26 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `2e774e82` fix(pricing): add GPT-6.1 Terra official Standard USD rates (#890); `0dce343a` fix(pricing): Haiku 5.5, Codex Ultrafast 6x, sync token message — run `git show` on any of them.
Boundary-crossing change coupling: provider-display.js ↔ status.js dashboard/src/lib/provider-display.js:1— `dashboard/src/lib/provider-display.js` (context dashboard) and `src/commands/status.js` (context commands) sit in DIFFERENT parts of the tree yet change together 57% of the time (8 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
Boundary-crossing change coupling: provider-display.js ↔ init.js dashboard/src/lib/provider-display.js:1— `dashboard/src/lib/provider-display.js` (context dashboard) and `src/commands/init.js` (context commands) sit in DIFFERENT parts of the tree yet change together 50% of the time (7 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
Boundary-crossing change coupling: provider-display.js ↔ sync.js dashboard/src/lib/provider-display.js:1— `dashboard/src/lib/provider-display.js` (context dashboard) and `src/commands/sync.js` (context commands) sit in DIFFERENT parts of the tree yet change together 50% of the time (7 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
WriteOnlyPrivateField TokenTrackerWin/PetWindow.cs:82— private double _preMiniX — assigned 1 time(s), read never — this field is written and never read anywhere its type can be reached from, so the state it keeps answers no question: every assignment to it computes a value that nothing observes, on every instance, for the lifetime of each one. It reads as a flag the code branches on, and nothing branches on it. Delete the field and its assignments — or, if the value was MEANT to be consulted, the missing read is the defect this row is pointing at, and the branch that should have depended on it is not there.
WriteOnlyPrivateField TokenTrackerWin/PetWindow.cs:83— private double _preMiniY — assigned 1 time(s), read never — this field is written and never read anywhere its type can be reached from, so the state it keeps answers no question: every assignment to it computes a value that nothing observes, on every instance, for the lifetime of each one. It reads as a flag the code branches on, and nothing branches on it. Delete the field and its assignments — or, if the value was MEANT to be consulted, the missing read is the defect this row is pointing at, and the branch that should have depended on it is not there.
Unlisted import '@insforge/sdk' test/cloud-access-sandbox-build.test.js:30— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
FunctionTooLong: sync.cmdSync src/commands/sync.js:553— FunctionTooLong — cmdSync runs 2300 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2200 over it, 23.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: local-api.createLocalApiHandler src/lib/local-api.js:1159— FunctionTooLong — createLocalApiHandler runs 2119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2019 over it, 21.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: local-api.createLocalApiHandler.handleLocalApi src/lib/local-api.js:1886— FunctionTooLong — createLocalApiHandler.handleLocalApi runs 1616 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1516 over it, 16.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: DashboardPage.DashboardPage dashboard/src/pages/DashboardPage.jsx:132— FunctionTooLong — DashboardPage runs 1123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1023 over it, 11.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: status.cmdStatus src/commands/status.js:198— FunctionTooLong — cmdStatus runs 1047 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 947 over it, 10.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: IpCheckPage.IpCheckPage REDACTED:169— FunctionTooLong — IpCheckPage runs 865 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 765 over it, 8.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SkillsPage.SkillsPage REDACTED:836— FunctionTooLong — SkillsPage runs 857 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 757 over it, 8.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: CloudCheckoutPage.CloudCheckoutPage dashboard/src/pages/CloudCheckoutPage.jsx:49— FunctionTooLong — CloudCheckoutPage runs 739 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 639 over it, 7.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: LeaderboardPage.LeaderboardPage dashboard/src/pages/LeaderboardPage.jsx:479— FunctionTooLong — LeaderboardPage runs 644 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 544 over it, 6.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: init.buildNotifyHandler src/commands/init.js:1457— FunctionTooLong — buildNotifyHandler runs 637 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 537 over it, 6.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: LoginCard.LoginCard dashboard/src/components/LoginCard.jsx:47— FunctionTooLong — LoginCard runs 534 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 434 over it, 5.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: codex-rollout-parser.parseCodexRolloutFile REDACTED:590— FunctionTooLong — parseCodexRolloutFile runs 530 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 430 over it, 5.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ActivityHeatmap3D.ActivityHeatmap3D REDACTED:81— FunctionTooLong — ActivityHeatmap3D runs 522 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 422 over it, 5.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: SubscriptionSettingsCard.SubscriptionSettingsCard dashboard/src/ui/dashboard/components/SubscriptionSettingsCard.jsx:46— FunctionTooLong — SubscriptionSettingsCard runs 416 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 316 over it, 4.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: use-trend-data.useTrendData dashboard/src/hooks/use-trend-data.ts:24— FunctionTooLong — useTrendData runs 381 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 281 over it, 3.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.
FunctionTooLong: tokentracker-leaderboard-refresh.default dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1048— FunctionTooLong — default runs 380 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 280 over it, 3.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: tokentracker-billing.billing dashboard/edge-patches/tokentracker-billing.ts:36— FunctionTooLong — billing runs 374 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 274 over it, 3.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: TrendMonitor.TrendMonitor dashboard/src/ui/dashboard/components/TrendMonitor.jsx:444— FunctionTooLong — TrendMonitor runs 370 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 270 over it, 3.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: pet.Pet dashboard/src/pet.jsx:529— FunctionTooLong — Pet runs 368 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 268 over it, 3.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: BroadsheetCard.BroadsheetCard dashboard/src/ui/share/variants/BroadsheetCard.jsx:36— FunctionTooLong — BroadsheetCard runs 355 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 255 over it, 3.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: use-usage-data.useUsageData dashboard/src/hooks/use-usage-data.ts:20— FunctionTooLong — useUsageData runs 351 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 251 over it, 3.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: DashboardView.DashboardView dashboard/src/ui/dashboard/views/DashboardView.jsx:104— FunctionTooLong — DashboardView runs 351 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 251 over it, 3.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: codex-context-breakdown.computeCodexContextBreakdown src/lib/codex-context-breakdown.js:382— FunctionTooLong — computeCodexContextBreakdown runs 341 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 241 over it, 3.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: ShareModal.ShareModal dashboard/src/ui/share/ShareModal.tsx:71— FunctionTooLong — ShareModal runs 334 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 234 over it, 3.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: TokenGalaxy.TokenGalaxy dashboard/src/ui/marketing/v3/TokenGalaxy.jsx:116— FunctionTooLong — TokenGalaxy runs 316 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 216 over it, 3.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Hotspot: src/commands/sync.js src/commands/sync.js:553— src/commands/sync.js changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 828 in sync.cmdSync at line 553. 30 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/commands/sync.js`: 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: src/lib/local-api.js src/lib/local-api.js:1886— src/lib/local-api.js changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 707 in local-api.createLocalApiHandler.handleLocalApi at line 1886. 27 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/lib/local-api.js`: 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: REDACTED REDACTED:22484— REDACTED changed 109 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 241 in rollout.parseAntigravityIncremental at line 22484. 74 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- REDACTED`: 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: src/commands/status.js src/commands/status.js:198— src/commands/status.js changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 407 in status.cmdStatus at line 198. 14 of those changes were fix/bug commits, and the other 17 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/commands/status.js`: 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: src/lib/usage-limits.js src/lib/usage-limits.js:4478— src/lib/usage-limits.js changed 52 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 172 in usage-limits.fetchUsageLimitsUncached at line 4478. 25 of those changes were fix/bug commits, and the other 27 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/lib/usage-limits.js`: 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: dashboard/edge-patches/tokentracker-account-model-breakdown.ts dashboard/edge-patches/tokentracker-account-model-breakdown.ts:506— dashboard/edge-patches/tokentracker-account-model-breakdown.ts changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in tokentracker-account-model-breakdown.getModelPricing at line 506. 27 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/edge-patches/tokentracker-account-model-breakdown.ts`: 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: dashboard/edge-patches/tokentracker-leaderboard-refresh.ts dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:486— dashboard/edge-patches/tokentracker-leaderboard-refresh.ts changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in tokentracker-leaderboard-refresh.getModelPricing at line 486. 28 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/edge-patches/tokentracker-leaderboard-refresh.ts`: 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: dashboard/edge-patches/tokentracker-leaderboard-profile.ts dashboard/edge-patches/tokentracker-leaderboard-profile.ts:445— dashboard/edge-patches/tokentracker-leaderboard-profile.ts changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in tokentracker-leaderboard-profile.getModelPricing at line 445. 28 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/edge-patches/tokentracker-leaderboard-profile.ts`: 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: src/lib/session-analytics.js src/lib/session-analytics.js:2387— src/lib/session-analytics.js changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 135 in session-analytics.buildSessionAnalyticsInternal at line 2387. 23 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/lib/session-analytics.js`: 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: dashboard/edge-patches/tokentracker-account-daily.ts dashboard/edge-patches/tokentracker-account-daily.ts:487— dashboard/edge-patches/tokentracker-account-daily.ts changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in tokentracker-account-daily.getModelPricing at line 487. 25 of those changes were fix/bug commits, so the churn is repair rather than feature work. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/edge-patches/tokentracker-account-daily.ts`: 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: dashboard/edge-patches/tokentracker-account-summary.ts dashboard/edge-patches/tokentracker-account-summary.ts:473— dashboard/edge-patches/tokentracker-account-summary.ts changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 132 in tokentracker-account-summary.getModelPricing at line 473. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/edge-patches/tokentracker-account-summary.ts`: 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: dashboard/src/pages/DashboardPage.jsx dashboard/src/pages/DashboardPage.jsx:132— dashboard/src/pages/DashboardPage.jsx changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 317 in DashboardPage.DashboardPage at line 132. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/pages/DashboardPage.jsx`: 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: REDACTED REDACTED:590— REDACTED changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 221 in codex-rollout-parser.parseCodexRolloutFile at line 590. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- REDACTED`: 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: dashboard/src/pages/SessionsPage.jsx dashboard/src/pages/SessionsPage.jsx:435— dashboard/src/pages/SessionsPage.jsx changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in SessionsPage.SessionsPage at line 435. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/pages/SessionsPage.jsx`: 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: TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:163— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in UsageLimitsView.sectionIfContent at line 163. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift`: 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: dashboard/src/ui/dashboard/components/UsageOverview.jsx dashboard/src/ui/dashboard/components/UsageOverview.jsx:236— dashboard/src/ui/dashboard/components/UsageOverview.jsx changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in UsageOverview.UsageOverview at line 236. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/ui/dashboard/components/UsageOverview.jsx`: 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: dashboard/src/pages/CloudCheckoutPage.jsx dashboard/src/pages/CloudCheckoutPage.jsx:49— dashboard/src/pages/CloudCheckoutPage.jsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 334 in CloudCheckoutPage.CloudCheckoutPage at line 49. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/pages/CloudCheckoutPage.jsx`: 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: src/commands/init.js src/commands/init.js:679— src/commands/init.js changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in init.applyIntegrationSetup at line 679. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/commands/init.js`: 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: REDACTED REDACTED:836— REDACTED changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 252 in SkillsPage.SkillsPage at line 836. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- REDACTED`: 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: dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1078— dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in UsageLimitsPanel.renderProviderGroup at line 1078. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx`: 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: REDACTED REDACTED:528— REDACTED changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in handleLocalApi at line 528. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- REDACTED`: 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: src/lib/pricing/index.js src/lib/pricing/index.js:347— src/lib/pricing/index.js changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in index.computeRowCost at line 347. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/lib/pricing/index.js`: 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: src/lib/pricing/matcher.js src/lib/pricing/matcher.js:275— src/lib/pricing/matcher.js changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in matcher.lookupPricing at line 275. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- src/lib/pricing/matcher.js`: 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: dashboard/src/App.jsx dashboard/src/App.jsx:115— dashboard/src/App.jsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 135 in App.App at line 115. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/App.jsx`: 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: TokenTrackerWin/DashboardWindow.cs TokenTrackerWin/DashboardWindow.cs:367— TokenTrackerWin/DashboardWindow.cs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 76 in DashboardWindow.InitializeWebViewCoreAsync at line 367. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerWin/DashboardWindow.cs`: 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: REDACTED REDACTED— FileTooLong — 18649 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 18149 over it, 37.30× 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: commands/sync.js src/commands/sync.js— FileTooLong — 5570 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 5070 over it, 11.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/usage-limits.js src/lib/usage-limits.js— FileTooLong — 3521 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 3021 over it, 7.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/local-api.js src/lib/local-api.js— FileTooLong — 2916 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 73% of them inside a single declaration: createLocalApiHandler (1159-4117). The bar is 500 significant lines; this is 2416 over it, 5.83× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: lib/session-analytics.js src/lib/session-analytics.js— FileTooLong — 2281 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1781 over it, 4.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: commands/init.js src/commands/init.js— FileTooLong — 1824 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1324 over it, 3.65× 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: REDACTED REDACTED— FileTooLong — 1574 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1074 over it, 3.15× 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: Views/ClawdCompanionView.swift TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift— FileTooLong — 1454 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: ClawdCompanionView (6-1952). The bar is 500 significant lines; this is 954 over it, 2.91× 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: commands/status.js src/commands/status.js— FileTooLong — 1406 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 74% of them inside a single declaration: cmdStatus (198-1530). The bar is 500 significant lines; this is 906 over it, 2.81× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: lib/cursor-store.js src/lib/cursor-store.js— FileTooLong — 1401 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 901 over it, 2.80× 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: components/UsageLimitsPanel.jsx dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx— FileTooLong — 1337 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 837 over it, 2.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: pages/DashboardPage.jsx dashboard/src/pages/DashboardPage.jsx— FileTooLong — 1234 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: DashboardPage (132-1554). The bar is 500 significant lines; this is 734 over it, 2.47× 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: REDACTED REDACTED— FileTooLong — 1115 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 615 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/skills-manager.js src/lib/skills-manager.js— FileTooLong — 1089 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 589 over it, 2.18× 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: Views/UsageLimitsView.swift TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift— FileTooLong — 1076 significant lines (blank, comment-only and punctuation-only lines excluded), about 84% of them inside a single declaration: UsageLimitsView (4-1341). The bar is 500 significant lines; this is 576 over it, 2.15× 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: tokentracker@tokentracker.cc/extension.js TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js— FileTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 551 over it, 2.10× 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: REDACTED REDACTED— FileTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 551 over it, 2.10× 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: edge-patches/tokentracker-leaderboard-refresh.ts dashboard/edge-patches/tokentracker-leaderboard-refresh.ts— FileTooLong — 1040 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 540 over it, 2.08× 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: REDACTED REDACTED— FileTooLong — 1038 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: IpCheckPage (169-1248). The bar is 500 significant lines; this is 538 over it, 2.08× 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: pages/LeaderboardPage.jsx dashboard/src/pages/LeaderboardPage.jsx— FileTooLong — 1038 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: LeaderboardPage (479-1246). The bar is 500 significant lines; this is 538 over it, 2.08× 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/StatusBarController.swift TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift— FileTooLong — 1007 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: StatusBarController (12-1527). The bar is 500 significant lines; this is 507 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: REDACTED REDACTED— FileTooLong — 978 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 478 over it, 1.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/mock-data.ts dashboard/src/lib/mock-data.ts— FileTooLong — 969 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 469 over it, 1.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: lib/claude-categorizer.js src/lib/claude-categorizer.js— FileTooLong — 922 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 422 over it, 1.84× 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: components/UsageOverview.jsx dashboard/src/ui/dashboard/components/UsageOverview.jsx— FileTooLong — 888 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 388 over it, 1.78× 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.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:80— `fs.realpathSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:89— `fs.realpathSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:90— `fs.mkdirSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:93— `fs.mkdirSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:95— `fs.writeFileSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:96— `fs.writeFileSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:260— `fs.writeFileSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking TokenTrackerBar/scripts/native-qa-server.cjs:262— `fs.writeFileSync` in `createNativeQAServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:789— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:799— `fssyncLocal.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:800— `fssyncLocal.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:842— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:850— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:858— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:867— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:877— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:885— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:892— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:937— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:954— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:973— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:985— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:997— `fssync.existsSync` in `applyIntegrationSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking src/commands/init.js:2370— `fssync.existsSync` in `runFirstSyncAndRead` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:88— `fssync.existsSync` in `cmdServe` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
+ 15 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×28
No test reaches this file TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-account-daily.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-billing.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/cloud/paddle.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-profile-likes.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/scripts/compare-visual-baselines.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-account-hourly.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/cloud/wechat.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-badge-svg.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-account-monthly.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/cloud/alipay.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-public-visibility.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/cloud/runtime.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/src/ui/dashboard/components/MacAppBanner.jsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/cloud/waffo-processing.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-user-badges-refresh.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-device-flow-authorize.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-device-flow-grant.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-paddle-webhook.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/src/ui/dashboard/components/WidgetOnboardingCard.jsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/scripts/capture-dashboard-screenshot.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/cloud/gifts.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/src/hooks/useClawdState.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file dashboard/edge-patches/tokentracker-waffo-webhook.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
ClassTooLong: ClawdCompanionView TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:6— ClassTooLong — 1314 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 914 over it, 3.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: DashboardPage dashboard/src/pages/DashboardPage.jsx:1— ClassTooLong — 1123 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 723 over it, 2.81× 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: StatusBarController TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:11— ClassTooLong — 981 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 581 over it, 2.45× 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: UsageLimitsView TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:4— ClassTooLong — 905 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods. The bar is 400 significant lines; this is 505 over it, 2.26× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: IpCheckPage REDACTED:1— ClassTooLong — 865 significant lines (blank, comment-only and punctuation-only lines excluded), 12 methods. The bar is 400 significant lines; this is 465 over it, 2.16× 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: SkillsPage REDACTED:1— ClassTooLong — 857 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 457 over it, 2.14× 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: DashboardViewModel TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:33— ClassTooLong — 743 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 343 over it, 1.86× 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: CloudCheckoutPage dashboard/src/pages/CloudCheckoutPage.jsx:1— ClassTooLong — 739 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 339 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: LeaderboardPage dashboard/src/pages/LeaderboardPage.jsx:1— ClassTooLong — 644 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 244 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: V2CursorStore src/lib/cursor-store.js:204— ClassTooLong — 597 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 197 over it, 1.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: LoginCard dashboard/src/components/LoginCard.jsx:1— ClassTooLong — 534 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 134 over it, 1.34× 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: ActivityHeatmap3D REDACTED:1— ClassTooLong — 522 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 122 over it, 1.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Strings TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:3— ClassTooLong — 515 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 115 over it, 1.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: DashboardWindowController TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:5— ClassTooLong — 511 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 111 over it, 1.28× 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: NativeBridge TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:13— ClassTooLong — 504 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 104 over it, 1.26× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TokenTrackerIndicator TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:790— ClassTooLong — 473 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 73 over it, 1.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: DynamicIslandController TokenTrackerBar/TokenTrackerBar/Services/DynamicIslandController.swift:120— ClassTooLong — 417 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 17 over it, 1.04× 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: SubscriptionSettingsCard dashboard/src/ui/dashboard/components/SubscriptionSettingsCard.jsx:1— ClassTooLong — 416 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 16 over it, 1.04× 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.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×13
Untrusted text written into markup unescaped REDACTED:296— `text` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:334— `label` is text this program did not author, and it is written into the text of an element through markup this function returns with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:389— `html` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:446— `t.failed` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:541— `trustScore` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:583— `pingCls` is text this program did not author, and it is written into a quoted attribute value through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:589— `t.regionWarnTitle(restrictedName)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:962— `t.histEmpty` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:1006— `t.failed` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped REDACTED:1030— `t.failed` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped dashboard/src/pet.jsx:308— `svgHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped dashboard/src/ui/foundation/ClawdAnimated.jsx:152— `svgHtml` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/lib/browser-auth.js:79— `redirectUrl` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup built here with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
TooManyMethods: StatusBarController TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:11— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.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: PetWindow TokenTrackerWin/PetWindow.cs— TooManyMethods — 775 significant lines (blank, comment-only and punctuation-only lines excluded), 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: TrayApplicationContext TokenTrackerWin/TrayApplicationContext.cs— TooManyMethods — 782 significant lines (blank, comment-only and punctuation-only lines excluded), 61 methods. The bar is 30 methods; this is 31 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: UsageLimitsView TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:4— 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: QuotaWidgetWindow TokenTrackerWin/QuotaWidgetWindow.cs— TooManyMethods — 382 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods. The bar is 30 methods; this is 17 over it, 1.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: DashboardWindow TokenTrackerWin/DashboardWindow.cs— TooManyMethods — 588 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 30 methods; this is 15 over it, 1.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: DashboardWindowController TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:5— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.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: ServerManager TokenTrackerWin/ServerManager.cs— TooManyMethods — 452 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 30 methods; this is 8 over it, 1.27× 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: ClawdCompanionView TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:6— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.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: DashboardViewModel TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:33— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.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.
Change coupling: sessions-api.ts ↔ session-analytics.js dashboard/src/lib/sessions-api.ts:1— `dashboard/src/lib/sessions-api.ts` and `src/lib/session-analytics.js` change together 100% of the time (13 of the 13 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 13 shared commits counted here, the most recent 3 are `a2483443` feat(sessions): add pi (@mariozechner/pi-coding-agent) to the Session…; `196eaf36` perf(sessions): reduce session browser payload and scope ranges serve…; `64bbaa5d` feat(sessions): track DeepSeek Harness sessions in the session browse… — run `git show` on any of them.
Change coupling: tokentracker-account-model-breakdown.ts ↔ tokentracker-leaderboard-refresh.ts dashboard/edge-patches/tokentracker-account-model-breakdown.ts:1— `dashboard/edge-patches/tokentracker-account-model-breakdown.ts` and `dashboard/edge-patches/tokentracker-leaderboard-refresh.ts` change together 79% of the time (46 of the 58 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 46 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `31929b8f` feat(pricing): price Claude Fable 5.2 and its fast mode (#1090); `42102e02` fix(pricing): stop remapping Antigravity Gemini 3.x Flash to 2.5 Flash — run `git show` on any of them.
Change coupling: tokentracker-account-daily.ts ↔ tokentracker-leaderboard-refresh.ts dashboard/edge-patches/tokentracker-account-daily.ts:1— `dashboard/edge-patches/tokentracker-account-daily.ts` and `dashboard/edge-patches/tokentracker-leaderboard-refresh.ts` change together 78% of the time (45 of the 58 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 45 shared commits counted here, the most recent 3 are `c58cf512` fix(pricing): cover Gemini 4 and Cursor usage variants; `31929b8f` feat(pricing): price Claude Fable 5.2 and its fast mode (#1090); `42102e02` fix(pricing): stop remapping Antigravity Gemini 3.x Flash to 2.5 Flash — run `git show` on any of them.
Change coupling: StatusBarController.swift ↔ WidgetsPage.jsx TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:1— `TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift` and `dashboard/src/pages/WidgetsPage.jsx` 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `85cc1e5b` feat(mac): complete Dynamic Island experience; `57ebc93a` fix: refine desktop pet and limit reset settings; `560e5016` feat: add RunCat-style menu bar icon styles with real-time activity s… — run `git show` on any of them.
Change coupling: REDACTED ↔ skills-manager.js REDACTED:1— `REDACTED` and `src/lib/skills-manager.js` change together 62% of the time (10 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 — 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 `1aca5e2f` chore(skills): drop a stale comment and a prop that can never render; `503b7a31` fix(skills): close the update race under the await, report every id, …; `687068ee` chore(skills): match local comment style in updateSkills — run `git show` on any of them.
Change coupling: agent-logos.js ↔ REDACTED dashboard/src/ui/marketing/agent-logos.js:1— `dashboard/src/ui/marketing/agent-logos.js` and `REDACTED` change together 62% of the time (10 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 — 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 `328f0d41` feat: OpenSquilla usage tracking (review hardening) (#883); `0472d244` feat(muse): add Muse Code passive session reader (#800); `4ed16b20` feat: track MiniMax Code usage from local session logs — run `git show` on any of them.
Change coupling: diagnostics.js ↔ REDACTED src/lib/diagnostics.js:1— `src/lib/diagnostics.js` and `REDACTED` 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 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 7 shared commits counted here, the most recent 3 are `c5bb828f` feat(wsl): Kiro 与 Claude Code 的 WSL 双安装支持; `9c1439c9` perf(codex): shard large cursor state for incremental sync (#323); `36a26a14` fix: address grok build review feedback — run `git show` on any of them.
Change coupling: NativeBridge.swift ↔ WidgetsPage.jsx TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:1— `TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift` and `dashboard/src/pages/WidgetsPage.jsx` 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `85cc1e5b` feat(mac): complete Dynamic Island experience; `57ebc93a` fix: refine desktop pet and limit reset settings; `560e5016` feat: add RunCat-style menu bar icon styles with real-time activity s… — run `git show` on any of them.
Change coupling: use-usage-limits.ts ↔ UsageLimitsPanel.jsx dashboard/src/hooks/use-usage-limits.ts:1— `dashboard/src/hooks/use-usage-limits.ts` and `dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx` change together 58% of the time (15 of the 26 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 15 shared commits counted here, the most recent 3 are `fc70e520` feat(deepseek): surface the DeepSeek prepaid balance as a limits bala…; `1a7e14a3` fix(grok): show each product's share of the weekly pool (#835); `be237821` feat(limits): add Ark Agent Plan as separate provider (dual Provider) — run `git show` on any of them.
Change coupling: ProviderIcon.jsx ↔ agent-logos.js dashboard/src/ui/dashboard/components/ProviderIcon.jsx:1— `dashboard/src/ui/dashboard/components/ProviderIcon.jsx` and `dashboard/src/ui/marketing/agent-logos.js` change together 50% of the time (8 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 — 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 `4ed16b20` feat: track MiniMax Code usage from local session logs; `b8046cf1` feat(omo): add OmO as a first-class usage source; `39a829d2` feat: add Dots agent usage tracking — run `git show` on any of them.
Change-coupling hub: tokentracker-account-summary.ts → tokentracker-account-daily.ts, tokentracker-account-heatmap.ts, tokentracker-account-model-breakdown.ts, tokentracker-leaderboard-profile.ts, tokentracker-leaderboard-refresh.ts dashboard/edge-patches/tokentracker-account-summary.ts— `dashboard/edge-patches/tokentracker-account-summary.ts` changes together with 5 other files — `dashboard/edge-patches/tokentracker-account-daily.ts`, `dashboard/edge-patches/tokentracker-account-heatmap.ts`, `dashboard/edge-patches/tokentracker-account-model-breakdown.ts`, `dashboard/edge-patches/tokentracker-leaderboard-profile.ts`, `dashboard/edge-patches/tokentracker-leaderboard-refresh.ts` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
Change-coupling hub: limits-providers.js → LimitsSettingsStore.swift, UsageLimits.swift, LimitsSettingsView.swift, UsageLimitsView.swift, use-usage-limits.ts, LimitsPage.jsx, usage-limits-provider-specs.js, usage-limits.js dashboard/src/lib/limits-providers.js— `dashboard/src/lib/limits-providers.js` changes together with 8 other files — `TokenTrackerBar/TokenTrackerBar/Models/LimitsSettingsStore.swift`, `TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift`, `TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift`, `TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift`, `dashboard/src/hooks/use-usage-limits.ts`, `dashboard/src/pages/LimitsPage.jsx`, `dashboard/src/ui/dashboard/components/usage-limits-provider-specs.js`, `src/lib/usage-limits.js` — none of which declares a dependency on it: one file is the hub of 8 separate couplings, not 8 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 8.
Change-coupling hub: tokentracker-leaderboard-profile.ts → tokentracker-account-daily.ts, tokentracker-account-model-breakdown.ts, tokentracker-leaderboard-refresh.ts dashboard/edge-patches/tokentracker-leaderboard-profile.ts— `dashboard/edge-patches/tokentracker-leaderboard-profile.ts` changes together with 3 other files — `dashboard/edge-patches/tokentracker-account-daily.ts`, `dashboard/edge-patches/tokentracker-account-model-breakdown.ts`, `dashboard/edge-patches/tokentracker-leaderboard-refresh.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: UsageLimitsView.swift → WeeklyLimitResetDetector.swift, WidgetSnapshotWriter.swift, use-limits-display-prefs.js, use-usage-limits.ts, usage-limits-provider-specs.js TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift— `TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift` changes together with 5 other files — `TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift`, `TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift`, `dashboard/src/hooks/use-limits-display-prefs.js`, `dashboard/src/hooks/use-usage-limits.ts`, `dashboard/src/ui/dashboard/components/usage-limits-provider-specs.js` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
Change-coupling hub: usage-limits-provider-specs.js → UsageLimits.swift, WeeklyLimitResetDetector.swift, use-usage-limits.ts, usage-limits.js dashboard/src/ui/dashboard/components/usage-limits-provider-specs.js— `dashboard/src/ui/dashboard/components/usage-limits-provider-specs.js` changes together with 4 other files — `TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift`, `TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift`, `dashboard/src/hooks/use-usage-limits.ts`, `src/lib/usage-limits.js` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Change-coupling hub: LimitsSettingsStore.swift → UsageLimits.swift, use-limits-display-prefs.js, LimitsPage.jsx, UsageLimitsPanel.jsx, usage-limits.js TokenTrackerBar/TokenTrackerBar/Models/LimitsSettingsStore.swift— `TokenTrackerBar/TokenTrackerBar/Models/LimitsSettingsStore.swift` changes together with 5 other files — `TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift`, `dashboard/src/hooks/use-limits-display-prefs.js`, `dashboard/src/pages/LimitsPage.jsx`, `dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx`, `src/lib/usage-limits.js` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
Change-coupling hub: provider-display.js → ProviderIcon.jsx, agent-logos.js, REDACTED dashboard/src/lib/provider-display.js— `dashboard/src/lib/provider-display.js` changes together with 3 other files — `dashboard/src/ui/dashboard/components/ProviderIcon.jsx`, `dashboard/src/ui/marketing/agent-logos.js`, `REDACTED` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: local-api.js → APIClient.swift, cloud-sync.ts, REDACTED src/lib/local-api.js— `src/lib/local-api.js` changes together with 3 other files — `TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift`, `dashboard/src/lib/cloud-sync.ts`, `REDACTED` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Change-coupling hub: LimitsSettingsView.swift → UsageLimits.swift, use-limits-display-prefs.js, LimitsPage.jsx, UsageLimitsPanel.jsx TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift— `TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift` changes together with 4 other files — `TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift`, `dashboard/src/hooks/use-limits-display-prefs.js`, `dashboard/src/pages/LimitsPage.jsx`, `dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Change-coupling hub: usage-limits.js → UsageLimits.swift, use-limits-display-prefs.js, LimitsPage.jsx src/lib/usage-limits.js— `src/lib/usage-limits.js` changes together with 3 other files — `TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift`, `dashboard/src/hooks/use-limits-display-prefs.js`, `dashboard/src/pages/LimitsPage.jsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
Repeated repair: TokenTrackerWin/TrayApplicationContext.cs TokenTrackerWin/TrayApplicationContext.cs:564— TokenTrackerWin/TrayApplicationContext.cs 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 13 (its worst body is TrayApplicationContext.InstalledCustomPets at line 564), 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): stop a Windows silent-upgrade crash from relaunching the old exe (#1115) (#1116)”; “fix(windows): show the dashboard on manual application launch (#832)”; “fix(windows): fall back to official releases when update checks are rate limited (#784)”; “fix: repair sync backlog and provider accounting”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerWin/TrayApplicationContext.cs`: 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: TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift:379— TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift 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 10 (its worst body is GenericLimitWindow.creditsDetail at line 379), 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(qoder): keep add-on credits consistent across sources and hide empty windows (#923)”; “fix(macos): show ZCode reset credits and Start Plan in menu bar (#888) (#894)”; “fix: unify WorkBuddy limits and show credit details”; “fix(grok): show each product's share of the weekly pool (#835)”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift`: 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: TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:116— TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift 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 8 (its worst body is Strings.grokProductLabel at line 116), 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(i18n): keep product name "Grok Bot" untranslated (#1048)”; “fix(macos): fall back to releases page when GitHub API rate limits update checks (#945) (#946)”; “fix(qoder): keep add-on credits consistent across sources and hide empty windows (#923)”; “fix(limits): follow remaining mode on the Grok quota pool (#885) (#904)”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift`: 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: TokenTrackerLinux/src-tauri/src/main.rs TokenTrackerLinux/src-tauri/src/main.rs:298— TokenTrackerLinux/src-tauri/src/main.rs 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 12 (its worst body is tokentracker_linux::start_health_monitor at line 298), 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(linux): serialize zoom writes and preserve rapid input”; “fix(linux): drop the server-side OAuth handoff”; “fix(linux): keep the WebKit renderer setup first in main”; “fix(linux): only hand app-started sign-ins back to the 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerLinux/src-tauri/src/main.rs`: 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: dashboard/src/ui/foundation/TokenFormatProvider.jsx dashboard/src/ui/foundation/TokenFormatProvider.jsx:28— dashboard/src/ui/foundation/TokenFormatProvider.jsx changed 6 times in last 90 days and 4 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 TokenFormatProvider.TokenFormatProvider at line 28), 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(windows): 同步托盘和桌宠的数字单位”; “fix(macos): show Wan/Yi units in the menu bar when the dashboard uses them”; “fix(dashboard): show trillion-scale token counts with a T suffix”; “fix(settings): preserve Chinese units across migration and windows”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- dashboard/src/ui/foundation/TokenFormatProvider.jsx`: 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: TokenTrackerBar/TokenTrackerBar/TokenTrackerBarApp.swift TokenTrackerBar/TokenTrackerBar/TokenTrackerBarApp.swift:266— TokenTrackerBar/TokenTrackerBar/TokenTrackerBarApp.swift changed 5 times in last 90 days and 4 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 AppDelegate.application at line 266), 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): keep silent auto-update relaunch in the tray (#1096) (#1097)”; “fix(macos): guard the #989 SMAppService call for the macOS 12 deployment target (#1006)”; “fix(macos): keep Launch-at-Login quiet under SMAppService (#989) (#1005)”; “fix: defer dashboard load until server is ready”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerBar/TokenTrackerBar/TokenTrackerBarApp.swift`: 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: REDACTED REDACTED:85— REDACTED changed 5 times in last 90 days and 3 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 UpdateChecker.CheckAsync at line 85), 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): stop a Windows silent-upgrade crash from relaunching the old exe (#1115) (#1116)”; “fix(update): keep silent auto-update relaunch in the tray (#1096) (#1097)”; “fix(windows): fall back to official releases when update checks are rate limited (#784)”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- REDACTED`: 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: TokenTrackerLinux/src-tauri/src/pet.rs TokenTrackerLinux/src-tauri/src/pet.rs:649— TokenTrackerLinux/src-tauri/src/pet.rs changed 4 times in last 90 days and 3 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 tokentracker_linux::pet::start_overlay_drag at line 649), 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(linux): open the dashboard through the app and restart a dead pet”; “fix(linux): address review feedback on the desktop pet”; “fix(linux): keep the pet on whichever monitor it is dropped on”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 23:15:00 +08:00' --until='2026-11-16 23:15:00 +08:00' --full-history --no-merges -- TokenTrackerLinux/src-tauri/src/pet.rs`: 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.
MethodTooLong: DashboardViewModel.loadAll TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:166— MethodTooLong — loadAll runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DashboardWindow.InitializeWebViewCoreAsync TokenTrackerWin/DashboardWindow.cs:367— MethodTooLong — InitializeWebViewCoreAsync runs 170 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 70 over it, 1.70× 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: TrayApplicationContext.TrayApplicationContext(…) TokenTrackerWin/TrayApplicationContext.cs:99— MethodTooLong — TrayApplicationContext(…) runs 144 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: StatusBarController.buildMenu TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:1161— MethodTooLong — buildMenu runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× 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: TrayStrings.For TokenTrackerWin/TrayStrings.cs:29— MethodTooLong — For runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× 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: V2CursorStore.commit src/lib/cursor-store.js:855— MethodTooLong — commit runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× 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: WidgetSnapshotWriter.limitProviders TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:291— MethodTooLong — limitProviders runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.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: StatusBarController.buildMenuBarDisplayValues TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:440— MethodTooLong — buildMenuBarDisplayValues runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
createLocalApiHandler::handleLocalApi (cognitive 1058) src/lib/local-api.js:1886— createLocalApiHandler::handleLocalApi has cognitive complexity 1058 (threshold 15). Drivers by points: if/else 261 (577 pts), boolean chains 259, error handling 43 (101 pts), ternaries 33 (80 pts), loops 12 (32 pts), other 7, match/switch 1 (2 pts) (nesting depth added 442). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
createLocalApiHandler::issueDeviceTokenForLocalSync (cognitive 40) src/lib/local-api.js:1508— createLocalApiHandler::issueDeviceTokenForLocalSync has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 14, ternaries 7 (9 pts), error handling 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.
createLocalApiHandler::currentCloudUploadFailure (cognitive 20) src/lib/local-api.js:1211— createLocalApiHandler::currentCloudUploadFailure has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 3 (4 pts), ternaries 2 (4 pts), error handling 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.
createLocalApiHandler::getRuntime (cognitive 20) src/lib/local-api.js:1242— createLocalApiHandler::getRuntime has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, 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.
createLocalApiHandler::handleLocalApi::aggregateEntries (cognitive 20) src/lib/local-api.js:3211— createLocalApiHandler::handleLocalApi::aggregateEntries has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (8 pts), loops 1, other 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Complex function getModelPricing (cyclomatic 132, cognitive 129) dashboard/edge-patches/tokentracker-account-daily.ts:487— getModelPricing has cyclomatic complexity 132 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getModelPricing (cyclomatic 132, cognitive 129) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:506— getModelPricing has cyclomatic complexity 132 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getModelPricing (cyclomatic 132, cognitive 129) dashboard/edge-patches/tokentracker-account-summary.ts:473— getModelPricing has cyclomatic complexity 132 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getModelPricing (cyclomatic 132, cognitive 129) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:445— getModelPricing has cyclomatic complexity 132 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getModelPricing (cyclomatic 132, cognitive 129) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:486— getModelPricing has cyclomatic complexity 132 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×4
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×4
Edited copy of a member (5 corresponding lines) TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:43— TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:43-47 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetTheme.swift:19-23 — 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) TokenTrackerBar/TokenTrackerBar/Services/MenuBarBotFrameProvider.swift:135— TokenTrackerBar/TokenTrackerBar/Services/MenuBarBotFrameProvider.swift:135-144 | TokenTrackerBar/TokenTrackerBar/Views/BotSpriteView.swift:191-195 — 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) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:115— TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:115-120 | TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:234-238 — 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) TokenTrackerWin/DashboardWindow.cs:681— TokenTrackerWin/DashboardWindow.cs:681-688 | TokenTrackerWin/PetWindow.cs:360-364 — 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.
Duplicated block (8 lines × 2) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:619— TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:619-626 | TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:643-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 `TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:619` 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 (8 lines × 2) TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:50— TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:50-57 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetTheme.swift: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 `TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:50` 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, `TokenTrackerBar/TokenTrackerWidget/Views/WidgetTheme.swift:25` calls `opacity` and `TokenTrackerBar/TokenTrackerBar/Utilities/Colors.swift:47` does not — after which the two agree again for 4 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) TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:151— TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:151-158 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1245-1252 — 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 `TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:151` 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) TokenTrackerLinux/src-tauri/src/server.rs:115— TokenTrackerLinux/src-tauri/src/server.rs:115-122 | TokenTrackerLinux/src-tauri/src/server.rs:591-598 — both copies are in the same file, so extract the 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 `TokenTrackerLinux/src-tauri/src/server.rs:115` 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.
Boundary violation [package:third-party-deep-import] scripts/graph/auto-index.cjs:4— scripts/graph/auto-index.cjs:4 imports @sourcegraph/scip-typescript/dist/src/scip, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] scripts/graph/lib/importer.cjs:4— scripts/graph/lib/importer.cjs:4 imports @sourcegraph/scip-typescript/dist/src/scip, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/lib/trae-sqlite.js:8— src/lib/trae-sqlite.js:8 imports @journeyapps/wa-sqlite/dist/wa-sqlite.mjs, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] src/lib/trae-sqlite.js:10— src/lib/trae-sqlite.js:10 imports @journeyapps/wa-sqlite/src/FacadeVFS.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
createLocalApiHandler::handleLocalApi (cyclomatic 645) src/lib/local-api.js:1886— createLocalApiHandler::handleLocalApi has cyclomatic complexity 645 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createLocalApiHandler::issueDeviceTokenForLocalSync (cyclomatic 40) src/lib/local-api.js:1508— createLocalApiHandler::issueDeviceTokenForLocalSync has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
createLocalApiHandler::handleLocalApi::aggregateEntries (cyclomatic 19) src/lib/local-api.js:3211— createLocalApiHandler::handleLocalApi::aggregateEntries 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.
local-api.createLocalApiHandler::tryServeAccountView (cyclomatic 27) src/lib/local-api.js:1678— local-api.createLocalApiHandler::tryServeAccountView 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. This shape REPEATS in the file: 2 other methods here (local-api.createLocalApiHandler::currentCloudUploadFailure, local-api.createLocalApiHandler::getRuntime) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
local-api.createLocalApiHandler::currentCloudUploadFailure (cyclomatic 19) src/lib/local-api.js:1211— local-api.createLocalApiHandler::currentCloudUploadFailure 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. This shape REPEATS in the file: 2 other methods here (local-api.createLocalApiHandler::getRuntime, local-api.createLocalApiHandler::tryServeAccountView) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
local-api.createLocalApiHandler::getRuntime (cyclomatic 16) src/lib/local-api.js:1242— local-api.createLocalApiHandler::getRuntime 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 shape REPEATS in the file: 2 other methods here (local-api.createLocalApiHandler::currentCloudUploadFailure, local-api.createLocalApiHandler::tryServeAccountView) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
rollout.isCompleteDshJsonLine::parseValue (cognitive 39) REDACTED:25249— rollout.isCompleteDshJsonLine::parseValue has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (34 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. This shape REPEATS in the file: 2 other methods here (rollout.isCompleteDshJsonLine::parseString, rollout.isCompleteDshJsonLine::parseNumber) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
rollout.isCompleteDshJsonLine::parseNumber (cognitive 24) REDACTED:25224— rollout.isCompleteDshJsonLine::parseNumber has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (rollout.isCompleteDshJsonLine::parseString, rollout.isCompleteDshJsonLine::parseValue) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
rollout.isCompleteDshJsonLine::parseString (cognitive 17) REDACTED:25205— rollout.isCompleteDshJsonLine::parseString has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 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. This shape REPEATS in the file: 2 other methods here (rollout.isCompleteDshJsonLine::parseNumber, rollout.isCompleteDshJsonLine::parseValue) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
local-api.createLocalApiHandler::tryServeAccountView (cognitive 31) src/lib/local-api.js:1678— local-api.createLocalApiHandler::tryServeAccountView has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 5, 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. This shape REPEATS in the file: 3 other methods here (local-api.createLocalApiHandler, local-api.createLocalApiHandler::captureSetCookies, local-api.createLocalApiHandler::buildRelayCookieHeader) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
local-api.createLocalApiHandler::captureSetCookies (cognitive 25) src/lib/local-api.js:1353— local-api.createLocalApiHandler::captureSetCookies has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (local-api.createLocalApiHandler, local-api.createLocalApiHandler::tryServeAccountView, local-api.createLocalApiHandler::buildRelayCookieHeader) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
local-api.createLocalApiHandler::buildRelayCookieHeader (cognitive 16) src/lib/local-api.js:1818— local-api.createLocalApiHandler::buildRelayCookieHeader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 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. This shape REPEATS in the file: 3 other methods here (local-api.createLocalApiHandler, local-api.createLocalApiHandler::captureSetCookies, local-api.createLocalApiHandler::tryServeAccountView) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
codex-rollout-parser.parseCodexRolloutFile::attributeTurn (cognitive 19) REDACTED:902— codex-rollout-parser.parseCodexRolloutFile::attributeTurn has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 5, ternaries 3, boolean chains 2 (nesting depth added 4). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 3 other methods here (codex-rollout-parser.parseCodexRolloutFile, codex-rollout-parser.parseCodexRolloutFile::recordModelUsage, codex-rollout-parser.parseCodexRolloutFile::getExecKeys) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
codex-rollout-parser.parseCodexRolloutFile::recordModelUsage (cognitive 18) REDACTED:724— codex-rollout-parser.parseCodexRolloutFile::recordModelUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 3, 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. This shape REPEATS in the file: 3 other methods here (codex-rollout-parser.parseCodexRolloutFile, codex-rollout-parser.parseCodexRolloutFile::getExecKeys, codex-rollout-parser.parseCodexRolloutFile::attributeTurn) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
codex-rollout-parser.parseCodexRolloutFile::getExecKeys (cognitive 17) REDACTED:853— codex-rollout-parser.parseCodexRolloutFile::getExecKeys has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, ternaries 7, 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. This shape REPEATS in the file: 3 other methods here (codex-rollout-parser.parseCodexRolloutFile, codex-rollout-parser.parseCodexRolloutFile::recordModelUsage, codex-rollout-parser.parseCodexRolloutFile::attributeTurn) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
tokentracker_linux::start_health_monitor (cognitive 19) TokenTrackerLinux/src-tauri/src/main.rs:298— tokentracker_linux::start_health_monitor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 3 (5 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.
tokentracker_linux::server::reap_orphaned_servers (cognitive 18) TokenTrackerLinux/src-tauri/src/server.rs:343— tokentracker_linux::server::reap_orphaned_servers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 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.
tokentracker_linux::pet::start_overlay_drag (cognitive 17) TokenTrackerLinux/src-tauri/src/pet.rs:649— tokentracker_linux::pet::start_overlay_drag has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×3
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×3
Edited copy of a member (29 corresponding lines) TokenTrackerBar/TokenTrackerWidget/Views/SharedWidgetViews.swift:252— TokenTrackerBar/TokenTrackerWidget/Views/SharedWidgetViews.swift:252-280 | TokenTrackerBar/TokenTrackerWidget/Widgets/UsageLimitsWidget.swift:80-118 — 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) TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:192— TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:192-221 | TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:224-252 — 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) TokenTrackerBar/TokenTrackerBar/Services/QueueActivityMonitor.swift:56— TokenTrackerBar/TokenTrackerBar/Services/QueueActivityMonitor.swift:56-95 | TokenTrackerBar/TokenTrackerBar/Services/QueueActivityMonitor.swift:101-129 — 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 (4 corresponding lines) · ×3
Edited copy of a member (4 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:441— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:441-444 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:446-449 — 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) TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:498— TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:498-501 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1219-1222 — 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) TokenTrackerWin/DashboardWindow.cs:750— TokenTrackerWin/DashboardWindow.cs:750-754 | TokenTrackerWin/PetWindow.cs:367-370 — 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 (9 lines × 2) TokenTrackerWin/TrayMenuRenderer.cs:37— TokenTrackerWin/TrayMenuRenderer.cs:37-45 | TokenTrackerWin/TrayMenuRenderer.cs:48-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:9— TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:9-17 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:5-13 — 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) TokenTrackerBar/generate_menubar_icon.swift:19— TokenTrackerBar/generate_menubar_icon.swift:19-27 | TokenTrackerBar/generate_menubar_icon.swift:28-36 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:233— TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:233-245 | TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:644-656 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:233` 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) TokenTrackerBar/TokenTrackerBar/Views/BoltShape.swift:21— TokenTrackerBar/TokenTrackerBar/Views/BoltShape.swift:21-33 | TokenTrackerBar/TokenTrackerBar/Views/BoltShape.swift:35-47 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) TokenTrackerBar/generate_icon_composer_assets.swift:60— TokenTrackerBar/generate_icon_composer_assets.swift:60-72 | TokenTrackerBar/generate_icon_composer_assets.swift:73-85 — both copies are in the same file, so extract the 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 `TokenTrackerBar/generate_icon_composer_assets.swift: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.
R10 · Code Duplication· Duplicated block with local edits (66 matched lines × 2 locations) · ×3
Duplicated block with local edits (66 matched lines × 2 locations) dashboard/edge-patches/tokentracker-account-heatmap.ts:141— dashboard/edge-patches/tokentracker-account-heatmap.ts:141 · dashboard/edge-patches/tokentracker-account-model-breakdown.ts:795 — the two spans are one implementation copied and then locally edited — 636 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (66 matched lines × 2 locations) dashboard/src/pet.jsx:218— dashboard/src/pet.jsx:218 · dashboard/src/ui/foundation/ClawdAnimated.jsx:70 — the two spans are one implementation copied and then locally edited — 401 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (66 matched lines × 2 locations) scripts/acceptance/gemini-hook-install.cjs:10— scripts/acceptance/gemini-hook-install.cjs:10 · scripts/acceptance/opencode-plugin-install.cjs:11 — the two spans are one implementation copied and then locally edited — 409 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
heatmap-compact.expandHeatmapCompact (cyclomatic 27) src/lib/heatmap-compact.js:45— heatmap-compact.expandHeatmapCompact has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
heatmap-compact.expandHeatmapCompact (cyclomatic 27) dashboard/src/lib/heatmap-compact.js:20— heatmap-compact.expandHeatmapCompact has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.isCompleteDshJsonLine::parseValue (cyclomatic 19) REDACTED:25249— rollout.isCompleteDshJsonLine::parseValue has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rollout.isCompleteDshJsonLine::parseNumber) 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.
rollout.isCompleteDshJsonLine::parseNumber (cyclomatic 18) REDACTED:25224— rollout.isCompleteDshJsonLine::parseNumber has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rollout.isCompleteDshJsonLine::parseValue) 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.
codex-rollout-parser.parseCodexRolloutFile::getExecKeys (cyclomatic 19) REDACTED:853— codex-rollout-parser.parseCodexRolloutFile::getExecKeys 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. This shape REPEATS in the file: 2 other methods here (codex-rollout-parser.parseCodexRolloutFile, codex-rollout-parser.parseCodexRolloutFile::recordModelUsage) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
codex-rollout-parser.parseCodexRolloutFile::recordModelUsage (cyclomatic 17) REDACTED:724— codex-rollout-parser.parseCodexRolloutFile::recordModelUsage has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (codex-rollout-parser.parseCodexRolloutFile, codex-rollout-parser.parseCodexRolloutFile::getExecKeys) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
heatmap-compact.expandHeatmapCompact (cognitive 36) src/lib/heatmap-compact.js:45— heatmap-compact.expandHeatmapCompact has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 6, loops 4 (6 pts), ternaries 2 (4 pts) (nesting depth added 10). Of this number, 31 points are the body's own statements and 5 belong to one function item 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.
heatmap-compact.expandHeatmapCompact (cognitive 36) dashboard/src/lib/heatmap-compact.js:20— heatmap-compact.expandHeatmapCompact has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 6, loops 4 (6 pts), ternaries 2 (4 pts) (nesting depth added 10). Of this number, 31 points are the body's own statements and 5 belong to one function item 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.
rollout.readOpencodeDbMessagesIncremental::appendRows (cognitive 21) REDACTED:5731— rollout.readOpencodeDbMessagesIncremental::appendRows has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (8 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (rollout.readOpencodeDbMessagesIncremental::readCursorGeneration) 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.
rollout.readOpencodeDbMessagesIncremental::readCursorGeneration (cognitive 19) REDACTED:5798— rollout.readOpencodeDbMessagesIncremental::readCursorGeneration has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 3 (6 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (rollout.readOpencodeDbMessagesIncremental::appendRows) 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.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×2
Edited copy of a member (11 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1166— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1166-1177 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1235-1255 — 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) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:614— TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:614-626 | TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:640-650 — 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 copies of one member (4 members, 8+ corresponding lines) · ×2
Edited copies of one member (4 members, 8+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/HeatmapData.swift:17— TokenTrackerBar/TokenTrackerBar/Models/HeatmapData.swift:17-25 | TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift:14-21 | TokenTrackerBar/TokenTrackerBar/Models/UsageSummary.swift:14-21 | TokenTrackerBar/TokenTrackerBar/Models/UsageSummary.swift:59-66 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 8+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:34— TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:34-41 | TokenTrackerBar/TokenTrackerBar/Models/HourlyUsage.swift:32-39 | TokenTrackerBar/TokenTrackerBar/Models/MonthlyUsage.swift:34-41 | TokenTrackerBar/TokenTrackerBar/Models/TokenTotals.swift:14-30 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×2
Edited copy of a member (16 corresponding lines) TokenTrackerBar/TokenTrackerWidget/Views/SharedWidgetViews.swift:37— TokenTrackerBar/TokenTrackerWidget/Views/SharedWidgetViews.swift:37-55 | TokenTrackerBar/TokenTrackerWidget/Widgets/SummaryWidget.swift:168-183 — 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) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:616— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:616-633 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:642-657 — 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 copies of one member (3 members, 6+ corresponding lines) · ×2
Edited copies of one member (3 members, 6+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:609— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:609-614 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:635-640 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:675-680 — 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.
Edited copies of one member (3 members, 6+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift:66— TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift:66-71 | TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift:79-84 | TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift:94-99 — 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 copy of a member (12 corresponding lines) · ×2
Edited copy of a member (12 corresponding lines) TokenTrackerLinux/src-tauri/src/pet.rs:570— TokenTrackerLinux/src-tauri/src/pet.rs:570-581 | TokenTrackerLinux/src-tauri/src/pet.rs:588-602 — 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) TokenTrackerWin/NativeTheme.cs:86— TokenTrackerWin/NativeTheme.cs:86-97 | TokenTrackerWin/TrayApplicationContext.cs:1169-1181 — 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.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×2
Edited copy of a member (7 corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/LimitPace.swift:70— TokenTrackerBar/TokenTrackerBar/Models/LimitPace.swift:70-76 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1224-1231 — 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) TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift:163— TokenTrackerBar/TokenTrackerBar/Models/UsageLimits.swift:163-169 | TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:173-180 — 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 (7 lines × 2) TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:423— TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:423-429 | TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:457-463 — both copies are in the same file, so extract the block into 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) TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:260— TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:260-266 | TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:267-273 — both copies are in the same file, so extract the 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 `TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:260` 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) TokenTrackerBar/Shared/NativeQAProfile.swift:149— TokenTrackerBar/Shared/NativeQAProfile.swift:149-154 | TokenTrackerBar/Shared/NativeQAProfile.swift:229-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.
Duplicated block (6 lines × 2) TokenTrackerBar/Shared/NativeQAProfile.swift:155— TokenTrackerBar/Shared/NativeQAProfile.swift:155-160 | TokenTrackerBar/Shared/NativeQAProfile.swift:236-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `TokenTrackerBar/Shared/NativeQAProfile.swift:155` 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (5 lines × 2) TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:376— TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:376-380 | TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:382-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) TokenTrackerBar/TokenTrackerBar/Services/ScreenConfettiOverlayController.swift:314— TokenTrackerBar/TokenTrackerBar/Services/ScreenConfettiOverlayController.swift:314-318 | TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:193-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. 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 (45 lines × 2 locations) dashboard/src/hooks/use-trend-data.ts:292— dashboard/src/hooks/use-trend-data.ts:292 · dashboard/src/hooks/use-trend-data.ts:408 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (45 lines × 2 locations) src/lib/sqlite-reader.js:81— src/lib/sqlite-reader.js:81 · src/lib/sqlite-reader.js:148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (38 lines × 2 locations) src/lib/codex-config.js:414— src/lib/codex-config.js:414 · src/lib/codex-config.js:482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (38 lines × 2 locations) src/lib/codex-context-breakdown.js:702— src/lib/codex-context-breakdown.js:702 · src/lib/grok-context-breakdown.js:769 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (36 lines × 2 locations) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:683— dashboard/edge-patches/tokentracker-leaderboard-profile.ts:683 · dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:705 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (36 lines × 2 locations) src/lib/openclaw-hook.js:10— src/lib/openclaw-hook.js:10 · src/lib/openclaw-session-plugin.js:14 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (34 lines × 2 locations) dashboard/src/hooks/use-trend-data.ts:344— dashboard/src/hooks/use-trend-data.ts:344 · dashboard/src/hooks/use-usage-model-breakdown.ts:159 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (34 lines × 2 locations) dashboard/src/ui/share/native-save.ts:50— dashboard/src/ui/share/native-save.ts:50 · dashboard/src/ui/share/native-save.ts:91 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
SC1 · Supply-chain hygiene· NuGet dependencies are not locked · ×2
NuGet dependencies are not locked TokenTrackerWin.Tests/TokenTrackerWin.Tests.csproj:12— TokenTrackerWin.Tests/TokenTrackerWin.Tests.csproj declares NuGet packages that no committed packages.lock.json resolves and no central package management pins — restores aren't reproducible or pinned (SSDF PW.4.4). Enable <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> (commit the lockfile) or adopt Directory.Packages.props. Advisory — never scored.
NuGet dependencies are not locked TokenTrackerWin/TokenTrackerWin.csproj:37— TokenTrackerWin/TokenTrackerWin.csproj declares NuGet packages that no committed packages.lock.json resolves and no central package management pins — restores aren't reproducible or pinned (SSDF PW.4.4). Enable <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> (commit the lockfile) or adopt Directory.Packages.props. Advisory — never scored.
AX2 · Stateful singletons· Process-global static state · ×1
Process-global static state: TokenUnits TokenTrackerWin/TokenUnits.cs:12— `TokenUnits` keeps mutable `static` state — one slot for the whole process, shared by every thread that reaches the type however its instances are created — and mutates it outside any lock (_cached; e.g. `_cached` at line 28). Concurrent callers lose updates, and a collection that is not built for concurrent writers can corrupt.
cmdSync (cyclomatic 830) src/commands/sync.js:553— cmdSync has cyclomatic complexity 830 (threshold 15). Of this number, 710 points are the body's own statements and 120 belong to 88 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
local-api.createLocalApiHandler.handleLocalApi (cyclomatic 634) src/lib/local-api.js:1886— local-api.createLocalApiHandler.handleLocalApi has cyclomatic complexity 634 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (local-api.createLocalApiHandler.handleLocalApi::aggregateEntries) 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.
cmdStatus (cyclomatic 408) src/commands/status.js:198— cmdStatus has cyclomatic complexity 408 (threshold 15). Of this number, 381 points are the body's own statements and 27 belong to 40 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CloudCheckoutPage.CloudCheckoutPage (cyclomatic 334) dashboard/src/pages/CloudCheckoutPage.jsx:49— CloudCheckoutPage.CloudCheckoutPage has cyclomatic complexity 334 (threshold 15). Of this number, 207 points are the body's own statements and 127 belong to 17 function items inside it that branch. 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.
DashboardPage.DashboardPage (cyclomatic 317) dashboard/src/pages/DashboardPage.jsx:132— DashboardPage.DashboardPage has cyclomatic complexity 317 (threshold 15). Of this number, 65 points are the body's own statements and 252 belong to 79 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
IpCheckPage.IpCheckPage (cyclomatic 278) REDACTED:169— IpCheckPage.IpCheckPage has cyclomatic complexity 278 (threshold 15). Most of this is not in the body itself: 2 of the 278 points are its own statements and the rest belongs to 38 function literals inside it that branch (lines 821, 465, 643, …). 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.
SkillsPage.SkillsPage (cyclomatic 252) REDACTED:836— SkillsPage.SkillsPage has cyclomatic complexity 252 (threshold 15). Of this number, 73 points are the body's own statements and 179 belong to 66 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.parseAntigravityIncremental (cyclomatic 241) REDACTED:22484— rollout.parseAntigravityIncremental has cyclomatic complexity 241 (threshold 15). Of this number, 240 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseWorkbuddyIncremental (cyclomatic 215) REDACTED:11601— rollout.parseWorkbuddyIncremental has cyclomatic complexity 215 (threshold 15). Of this number, 152 points are the body's own statements and 63 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseDshIncremental (cyclomatic 200) REDACTED:25411— rollout.parseDshIncremental has cyclomatic complexity 200 (threshold 15). Of this number, 182 points are the body's own statements and 18 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fetchUsageLimitsUncached (cyclomatic 191) src/lib/usage-limits.js:4478— fetchUsageLimitsUncached has cyclomatic complexity 191 (threshold 15). Of this number, 156 points are the body's own statements and 35 belong to 54 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseRolloutIncremental (cyclomatic 169) REDACTED:325— rollout.parseRolloutIncremental has cyclomatic complexity 169 (threshold 15). Of this number, 123 points are the body's own statements and 46 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
codex-rollout-parser.parseCodexRolloutFile (cyclomatic 151) REDACTED:590— codex-rollout-parser.parseCodexRolloutFile has cyclomatic complexity 151 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (codex-rollout-parser.parseCodexRolloutFile::recordModelUsage, codex-rollout-parser.parseCodexRolloutFile::getExecKeys) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
rollout.parseGrokBuildIncremental (cyclomatic 141) REDACTED:21746— rollout.parseGrokBuildIncremental has cyclomatic complexity 141 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-analytics.buildSessionAnalyticsInternal (cyclomatic 135) src/lib/session-analytics.js:2387— session-analytics.buildSessionAnalyticsInternal has cyclomatic complexity 135 (threshold 15). Of this number, 126 points are the body's own statements and 9 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App (cyclomatic 135) dashboard/src/App.jsx:115— App.App has cyclomatic complexity 135 (threshold 15). Of this number, 107 points are the body's own statements and 28 belong to 7 function literals inside it that branch. 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.
handleLocalApi (cyclomatic 133) REDACTED:528— handleLocalApi has cyclomatic complexity 133 (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.
tokentracker-account-daily.getModelPricing (cyclomatic 132) dashboard/edge-patches/tokentracker-account-daily.ts:487— tokentracker-account-daily.getModelPricing has cyclomatic complexity 132 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-account-model-breakdown.getModelPricing (cyclomatic 132) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:506— tokentracker-account-model-breakdown.getModelPricing has cyclomatic complexity 132 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-account-summary.getModelPricing (cyclomatic 132) dashboard/edge-patches/tokentracker-account-summary.ts:473— tokentracker-account-summary.getModelPricing has cyclomatic complexity 132 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-leaderboard-profile.getModelPricing (cyclomatic 132) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:445— tokentracker-leaderboard-profile.getModelPricing has cyclomatic complexity 132 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-leaderboard-refresh.getModelPricing (cyclomatic 132) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:486— tokentracker-leaderboard-refresh.getModelPricing has cyclomatic complexity 132 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.enqueueTouchedBuckets (cyclomatic 122) REDACTED:3598— rollout.enqueueTouchedBuckets has cyclomatic complexity 122 (threshold 15). Of this number, 118 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseRolloutRecords (cyclomatic 121) REDACTED:2561— rollout.parseRolloutRecords has cyclomatic complexity 121 (threshold 15). Of this number, 112 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
native-qa-server.createNativeQAServer.server (cyclomatic 120) TokenTrackerBar/scripts/native-qa-server.cjs:112— native-qa-server.createNativeQAServer.server has cyclomatic complexity 120 (threshold 15). Of this number, 109 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LeaderboardPage.LeaderboardPage (cyclomatic 120) dashboard/src/pages/LeaderboardPage.jsx:479— LeaderboardPage.LeaderboardPage has cyclomatic complexity 120 (threshold 15). Of this number, 50 points are the body's own statements and 70 belong to 26 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CloudPage.CloudPlanView (cyclomatic 114) dashboard/src/pages/CloudPage.jsx:58— CloudPage.CloudPlanView has cyclomatic complexity 114 (threshold 15). Of this number, 99 points are the body's own statements and 15 belong to 8 function items inside it that branch. 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.
rollout.parsePiLikeIncremental (cyclomatic 112) REDACTED:17582— rollout.parsePiLikeIncremental has cyclomatic complexity 112 (threshold 15). Of this number, 109 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseCopilotSessionStoreIncremental (cyclomatic 112) REDACTED:20241— rollout.parseCopilotSessionStoreIncremental has cyclomatic complexity 112 (threshold 15). Of this number, 111 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionsPage.SessionsPage (cyclomatic 111) dashboard/src/pages/SessionsPage.jsx:435— SessionsPage.SessionsPage has cyclomatic complexity 111 (threshold 15). Of this number, 35 points are the body's own statements and 76 belong to 19 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tokentracker-billing.billing (cyclomatic 110) dashboard/edge-patches/tokentracker-billing.ts:36— tokentracker-billing.billing has cyclomatic complexity 110 (threshold 15). Of this number, 102 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseClaudeIncremental (cyclomatic 105) REDACTED:1056— rollout.parseClaudeIncremental has cyclomatic complexity 105 (threshold 15). Of this number, 101 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseCodebuddyIncremental (cyclomatic 104) REDACTED:10876— rollout.parseCodebuddyIncremental has cyclomatic complexity 104 (threshold 15). Of this number, 97 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActivityHeatmap.ActivityHeatmap (cyclomatic 101) dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx:81— ActivityHeatmap.ActivityHeatmap has cyclomatic complexity 101 (threshold 15). Of this number, 45 points are the body's own statements and 56 belong to 23 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LoginCard.LoginCard (cyclomatic 99) dashboard/src/components/LoginCard.jsx:47— LoginCard.LoginCard has cyclomatic complexity 99 (threshold 15). Of this number, 47 points are the body's own statements and 52 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
repairCodexRescanInflation (cyclomatic 99) src/commands/sync.js:6291— repairCodexRescanInflation has cyclomatic complexity 99 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActivityHeatmap3D.ActivityHeatmap3D (cyclomatic 96) REDACTED:81— ActivityHeatmap3D.ActivityHeatmap3D has cyclomatic complexity 96 (threshold 15). Of this number, 26 points are the body's own statements and 70 belong to 30 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
readKimiSessions (cyclomatic 92) src/lib/kimi-session.js:81— readKimiSessions has cyclomatic complexity 92 (threshold 15). Of this number, 85 points are the body's own statements and 7 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-analytics.buildZcodeSessionRecords (cyclomatic 91) src/lib/session-analytics.js:1542— session-analytics.buildZcodeSessionRecords has cyclomatic complexity 91 (threshold 15). Of this number, 82 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseOmpLikeIncremental (cyclomatic 90) REDACTED:17016— rollout.parseOmpLikeIncremental has cyclomatic complexity 90 (threshold 15). Of this number, 55 points are the body's own statements and 35 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
computeCodexContextBreakdown (cyclomatic 90) src/lib/codex-context-breakdown.js:382— computeCodexContextBreakdown has cyclomatic complexity 90 (threshold 15). Of this number, 76 points are the body's own statements and 14 belong to 27 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
readOmpSessionFiles (cyclomatic 89) src/lib/omp-session.js:233— readOmpSessionFiles has cyclomatic complexity 89 (threshold 15). Of this number, 86 points are the body's own statements and 3 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseAntigravityFile (cyclomatic 87) REDACTED:23304— rollout.parseAntigravityFile has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseDroidIncremental (cyclomatic 85) REDACTED:16393— rollout.parseDroidIncremental has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageOverview.UsageOverview (cyclomatic 85) dashboard/src/ui/dashboard/components/UsageOverview.jsx:236— UsageOverview.UsageOverview has cyclomatic complexity 85 (threshold 15). Of this number, 52 points are the body's own statements and 33 belong to 16 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.parseQoderNewIncremental (cyclomatic 84) REDACTED:7229— rollout.parseQoderNewIncremental has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ContextBreakdownPanel.ContextBreakdownPanel (cyclomatic 83) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:686— ContextBreakdownPanel.ContextBreakdownPanel has cyclomatic complexity 83 (threshold 15). Of this number, 43 points are the body's own statements and 40 belong to 9 function literals inside it that branch. 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.
readPiSessionFiles (cyclomatic 83) src/lib/pi-session.js:441— readPiSessionFiles has cyclomatic complexity 83 (threshold 15). Of this number, 78 points are the body's own statements and 5 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
init.applyIntegrationSetup (cyclomatic 81) src/commands/init.js:679— init.applyIntegrationSetup has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tokentracker-leaderboard-refresh.default (cyclomatic 80) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1048— tokentracker-leaderboard-refresh.default has cyclomatic complexity 80 (threshold 15). Of this number, 75 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CloudMembershipCard.CloudMembershipAccount (cyclomatic 79) dashboard/src/components/cloud/CloudMembershipCard.jsx:472— CloudMembershipCard.CloudMembershipAccount has cyclomatic complexity 79 (threshold 15). Of this number, 64 points are the body's own statements and 15 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tokentracker-leaderboard-profile.default (cyclomatic 78) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:898— tokentracker-leaderboard-profile.default has cyclomatic complexity 78 (threshold 15). Of this number, 77 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DashboardWindow.InitializeWebViewCoreAsync (cyclomatic 76) TokenTrackerWin/DashboardWindow.cs:367— DashboardWindow.InitializeWebViewCoreAsync has cyclomatic complexity 76 (threshold 15). Most of this is not in the body itself: 2 of the 76 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 474, 403, 443, …). 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.
tokentracker-account-model-breakdown.handleAccountRequest (cyclomatic 76) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:896— tokentracker-account-model-breakdown.handleAccountRequest has cyclomatic complexity 76 (threshold 15). Of this number, 69 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
rollout.parseKiroCliIncremental (cyclomatic 75) REDACTED:9596— rollout.parseKiroCliIncremental has cyclomatic complexity 75 (threshold 15). Of this number, 69 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InsforgeAuthContext.InsforgeAuthProvider (cyclomatic 75) dashboard/src/contexts/InsforgeAuthContext.jsx:80— InsforgeAuthContext.InsforgeAuthProvider has cyclomatic complexity 75 (threshold 15). Most of this is not in the body itself: 3 of the 75 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 163, 142, 294, …). 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.
rollout.parseClineIncremental (cyclomatic 74) REDACTED:13183— rollout.parseClineIncremental 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.
TrendMonitor.TrendMonitor (cyclomatic 73) dashboard/src/ui/dashboard/components/TrendMonitor.jsx:444— TrendMonitor.TrendMonitor has cyclomatic complexity 73 (threshold 15). Of this number, 41 points are the body's own statements and 32 belong to 15 function literals inside it that branch. 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.
session-analytics.scanGrokSession (cyclomatic 72) src/lib/session-analytics.js:1042— session-analytics.scanGrokSession has cyclomatic complexity 72 (threshold 15). Of this number, 68 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseOpenclawIncremental (cyclomatic 71) REDACTED:1761— rollout.parseOpenclawIncremental has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseDevinIncremental (cyclomatic 71) REDACTED:15463— rollout.parseDevinIncremental has cyclomatic complexity 71 (threshold 15). Of this number, 69 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
waffo-processing.reconcileWaffoOrder (cyclomatic 71) dashboard/edge-patches/cloud/waffo-processing.ts:7— waffo-processing.reconcileWaffoOrder has cyclomatic complexity 71 (threshold 15). Of this number, 66 points are the body's own statements and 5 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseOpencodeDbIncremental (cyclomatic 69) REDACTED:6282— rollout.parseOpencodeDbIncremental has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-trend-data.useTrendData.refresh (cyclomatic 67) dashboard/src/hooks/use-trend-data.ts:174— use-trend-data.useTrendData.refresh has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-analytics.scanClaudeSession (cyclomatic 65) src/lib/session-analytics.js:563— session-analytics.scanClaudeSession has cyclomatic complexity 65 (threshold 15). Of this number, 61 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionDetailModal.SessionDetailModal (cyclomatic 65) dashboard/src/ui/dashboard/components/SessionDetailModal.jsx:67— SessionDetailModal.SessionDetailModal has cyclomatic complexity 65 (threshold 15). Of this number, 35 points are the body's own statements and 30 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-ingest.default (cyclomatic 64) dashboard/edge-patches/tokentracker-ingest.ts:37— tokentracker-ingest.default has cyclomatic complexity 64 (threshold 15). Of this number, 54 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UsageLimitsView.sectionIfContent (cyclomatic 64) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:163— UsageLimitsView.sectionIfContent has cyclomatic complexity 64 (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.
matcher.lookupPricing (cyclomatic 63) src/lib/pricing/matcher.js:275— matcher.lookupPricing has cyclomatic complexity 63 (threshold 15). Of this number, 62 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-analytics.scanOpencodeSessions (cyclomatic 63) src/lib/session-analytics.js:1276— session-analytics.scanOpencodeSessions has cyclomatic complexity 63 (threshold 15). Of this number, 57 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CloudUsageExport.CloudUsageExport (cyclomatic 63) dashboard/src/components/cloud/CloudUsageExport.jsx:21— CloudUsageExport.CloudUsageExport has cyclomatic complexity 63 (threshold 15). Of this number, 37 points are the body's own statements and 26 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pet.Pet (cyclomatic 63) dashboard/src/pet.jsx:529— pet.Pet has cyclomatic complexity 63 (threshold 15). Of this number, 38 points are the body's own statements and 25 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.parseLmstudioIncremental (cyclomatic 62) REDACTED:14250— rollout.parseLmstudioIncremental has cyclomatic complexity 62 (threshold 15). Of this number, 60 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.readKiroCliV2SessionTurns (cyclomatic 61) REDACTED:9192— rollout.readKiroCliV2SessionTurns has cyclomatic complexity 61 (threshold 15). Of this number, 48 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RedeemProCode.RedeemProCode (cyclomatic 60) dashboard/src/components/cloud/RedeemProCode.jsx:14— RedeemProCode.RedeemProCode has cyclomatic complexity 60 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (RedeemProCode.RedeemProCode::perform) 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.
rollout.parseCommandCodeIncremental (cyclomatic 59) REDACTED:26305— rollout.parseCommandCodeIncremental has cyclomatic complexity 59 (threshold 15). Of this number, 53 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
repairWorkbuddyContextUsage (cyclomatic 59) src/commands/sync.js:6101— repairWorkbuddyContextUsage has cyclomatic complexity 59 (threshold 15). Of this number, 58 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseCopilotIncremental (cyclomatic 58) REDACTED:19540— rollout.parseCopilotIncremental has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SubscriptionSettingsCard.SubscriptionSettingsCard (cyclomatic 58) dashboard/src/ui/dashboard/components/SubscriptionSettingsCard.jsx:46— SubscriptionSettingsCard.SubscriptionSettingsCard has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 9 of the 58 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 398, renderForm, a function literal at line 167, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
cmdUninstall (cyclomatic 58) src/commands/uninstall.js:33— cmdUninstall has cyclomatic complexity 58 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
grok-context-breakdown.parseGrokUpdatesFile (cyclomatic 57) src/lib/grok-context-breakdown.js:326— grok-context-breakdown.parseGrokUpdatesFile has cyclomatic complexity 57 (threshold 15). Of this number, 40 points are the body's own statements and 17 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cloud-prompt-policy.cloudContextualPromptDecision (cyclomatic 57) dashboard/src/lib/cloud-prompt-policy.js:185— cloud-prompt-policy.cloudContextualPromptDecision has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StatusBarController.buildMenuBarDisplayValues (cyclomatic 57) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:440— StatusBarController.buildMenuBarDisplayValues has cyclomatic complexity 57 (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.
rollout.parseMuseIncremental (cyclomatic 56) REDACTED:18508— rollout.parseMuseIncremental 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. This shape REPEATS in the file: one other method here (rollout.parseMuseIncremental::handleRecord) 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.
use-trend-data.useTrendData (cyclomatic 56) dashboard/src/hooks/use-trend-data.ts:24— use-trend-data.useTrendData has cyclomatic complexity 56 (threshold 15). Most of this is not in the body itself: 11 of the 56 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 376, 74, 163). 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.
renderLightTable (cyclomatic 55) src/commands/status.js:1651— renderLightTable has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseGeminiIncremental (cyclomatic 54) REDACTED:1349— rollout.parseGeminiIncremental has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseKimiCodeIncremental (cyclomatic 54) REDACTED:10433— rollout.parseKimiCodeIncremental has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-performance.createCodexPerformanceCollector.consume (cyclomatic 54) src/lib/session-performance.js:135— session-performance.createCodexPerformanceCollector.consume has cyclomatic complexity 54 (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.
use-activity-heatmap.useActivityHeatmap.refresh (cyclomatic 54) dashboard/src/hooks/use-activity-heatmap.ts:134— use-activity-heatmap.useActivityHeatmap.refresh has cyclomatic complexity 54 (threshold 15). Of this number, 52 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-usage-data.useUsageData.refresh (cyclomatic 54) dashboard/src/hooks/use-usage-data.ts:144— use-usage-data.useUsageData.refresh has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createCodexPerformanceCollector.consume (cyclomatic 54) src/lib/session-performance.js:135— createCodexPerformanceCollector.consume has cyclomatic complexity 54 (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.
repairDroidDuplicateSessionInflation (cyclomatic 53) src/commands/sync.js:7279— repairDroidDuplicateSessionInflation has cyclomatic complexity 53 (threshold 15). Of this number, 42 points are the body's own statements and 11 belong to 5 function items inside it that branch. 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.
kimi-model-repair.repairKimiModelAttribution (cyclomatic 52) src/lib/kimi-model-repair.js:72— kimi-model-repair.repairKimiModelAttribution 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.
rollout.filterColdCodexRolloutFiles (cyclomatic 51) REDACTED:810— rollout.filterColdCodexRolloutFiles has cyclomatic complexity 51 (threshold 15). Of this number, 41 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.scanRolloutProjectFileContexts (cyclomatic 51) REDACTED:2947— rollout.scanRolloutProjectFileContexts has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseCraftIncremental (cyclomatic 50) REDACTED:18742— rollout.parseCraftIncremental has cyclomatic complexity 50 (threshold 15). Of this number, 48 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
diagnostics.collectTrackerDiagnostics (cyclomatic 50) src/lib/diagnostics.js:70— diagnostics.collectTrackerDiagnostics has cyclomatic complexity 50 (threshold 15). Of this number, 49 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProjectDetailModal.ProjectDetailModalContent (cyclomatic 50) dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx:121— ProjectDetailModal.ProjectDetailModalContent has cyclomatic complexity 50 (threshold 15). Of this number, 41 points are the body's own statements and 9 belong to 5 function items inside it that branch. 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.
quota.QuotaWidget (cyclomatic 50) dashboard/src/quota.jsx:11— quota.QuotaWidget has cyclomatic complexity 50 (threshold 15). Of this number, 28 points are the body's own statements and 22 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fetchQoderLimits (cyclomatic 50) src/lib/qoder-limits.js:843— fetchQoderLimits 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.
rollout.parseGeminiFile (cyclomatic 49) REDACTED:3247— rollout.parseGeminiFile 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.
dsh-session.parseDshTranscript (cyclomatic 49) src/lib/dsh-session.js:299— dsh-session.parseDshTranscript 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.
ShareModal.ShareModal (cyclomatic 49) dashboard/src/ui/share/ShareModal.tsx:71— ShareModal.ShareModal has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 9 of the 49 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 180, 80, 152, …). 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.
CloudMembershipCard.CloudMachineList (cyclomatic 49) dashboard/src/components/cloud/CloudMembershipCard.jsx:77— CloudMembershipCard.CloudMachineList has cyclomatic complexity 49 (threshold 15). Of this number, 16 points are the body's own statements and 33 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
repairCodebuddyLogJsonlOverlap (cyclomatic 49) src/commands/sync.js:5908— repairCodebuddyLogJsonlOverlap has cyclomatic complexity 49 (threshold 15). Of this number, 47 points are the body's own statements and 2 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseZedIncremental (cyclomatic 48) REDACTED:13633— rollout.parseZedIncremental 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.
rollout.parseTraeIncremental (cyclomatic 48) REDACTED:23717— rollout.parseTraeIncremental has cyclomatic complexity 48 (threshold 15). Of this number, 46 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sync.repairClaudeQueueFromGroundTruth (cyclomatic 48) src/commands/sync.js:7511— sync.repairClaudeQueueFromGroundTruth 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.
rollout.parseKiroCliFromSessionFiles (cyclomatic 47) REDACTED:10039— rollout.parseKiroCliFromSessionFiles 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.
NetworkSection.NetworkSection (cyclomatic 47) dashboard/src/components/settings/NetworkSection.jsx:35— NetworkSection.NetworkSection has cyclomatic complexity 47 (threshold 15). Of this number, 23 points are the body's own statements and 24 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NativeBridge.applySetting (cyclomatic 47) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:376— NativeBridge.applySetting 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.
WidgetSnapshotWriter.limitProviders (cyclomatic 47) TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:291— WidgetSnapshotWriter.limitProviders 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.
rollout.parseOpenclawSessionFile (cyclomatic 46) REDACTED:2094— rollout.parseOpenclawSessionFile 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.
rollout.parseQoderDbIncremental (cyclomatic 46) REDACTED:6739— rollout.parseQoderDbIncremental 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.
claude-categorizer.computeOutputTokenBreakdown (cyclomatic 46) src/lib/claude-categorizer.js:209— claude-categorizer.computeOutputTokenBreakdown has cyclomatic complexity 46 (threshold 15). Of this number, 44 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
zcode-limits.fetchZcodeLimits (cyclomatic 46) REDACTED:1372— zcode-limits.fetchZcodeLimits has cyclomatic complexity 46 (threshold 15). Of this number, 36 points are the body's own statements and 10 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
waffo.normalizeWaffoOrder (cyclomatic 46) REDACTED:443— waffo.normalizeWaffoOrder 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.
trae-usage.normalizeTraeUsage (cyclomatic 45) src/lib/trae-usage.js:6— trae-usage.normalizeTraeUsage has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
summarizeSessions (cyclomatic 45) src/lib/session-analytics.js:2760— summarizeSessions has cyclomatic complexity 45 (threshold 15). Of this number, 37 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-analytics.mergeSessionFragments (cyclomatic 44) src/lib/session-analytics.js:3059— session-analytics.mergeSessionFragments has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageLimitsPanel.renderProviderGroup (cyclomatic 44) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1078— UsageLimitsPanel.renderProviderGroup has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
buildRow (cyclomatic 44) src/lib/dsh-session.js:465— buildRow has cyclomatic complexity 44 (threshold 15). Of this number, 40 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseOpencodeIncremental (cyclomatic 43) REDACTED:1519— rollout.parseOpencodeIncremental has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.extractDshSessionUsage (cyclomatic 43) REDACTED:25312— rollout.extractDshSessionUsage has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
workbuddy-ipc.openWorkbuddyIpc (cyclomatic 43) src/lib/workbuddy-ipc.js:62— workbuddy-ipc.openWorkbuddyIpc has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 1 of the 43 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 123, 63, 167, …). 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.
session-analytics.annotateThreadUsage (cyclomatic 43) src/lib/session-analytics.js:3159— session-analytics.annotateThreadUsage has cyclomatic complexity 43 (threshold 15). Of this number, 31 points are the body's own statements and 12 belong to 3 function items inside it that branch. 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.
tokentracker-account-daily.default (cyclomatic 43) dashboard/edge-patches/tokentracker-account-daily.ts:901— tokentracker-account-daily.default has cyclomatic complexity 43 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TokenGalaxy.TokenGalaxy (cyclomatic 43) dashboard/src/ui/marketing/v3/TokenGalaxy.jsx:116— TokenGalaxy.TokenGalaxy has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 4 of the 43 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 159, 335, 122, …). 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.
SkillDetailPanel.SkillDetailPanelInner (cyclomatic 43) dashboard/src/pages/SkillDetailPanel.jsx:90— SkillDetailPanel.SkillDetailPanelInner has cyclomatic complexity 43 (threshold 15). Of this number, 36 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PetPage.PetPage (cyclomatic 43) dashboard/src/pages/PetPage.jsx:347— PetPage.PetPage has cyclomatic complexity 43 (threshold 15). Of this number, 20 points are the body's own statements and 23 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createLimitsCache.normalizeEntry (cyclomatic 43) src/lib/limits-cache.js:244— createLimitsCache.normalizeEntry has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cleanRow (cyclomatic 43) src/lib/local-usage-transfer.js:35— cleanRow has cyclomatic complexity 43 (threshold 15). Of this number, 31 points are the body's own statements and 12 belong to 3 function literals inside it that branch. 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.
aggregateWrapped (cyclomatic 43) src/lib/wrapped-aggregator.js:70— aggregateWrapped has cyclomatic complexity 43 (threshold 15). Of this number, 41 points are the body's own statements and 2 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseClaudeFile (cyclomatic 42) REDACTED:3131— rollout.parseClaudeFile 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.
rollout.parseOpenSquillaIncremental (cyclomatic 42) REDACTED:14574— rollout.parseOpenSquillaIncremental has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseGooseIncremental (cyclomatic 42) REDACTED:15860— rollout.parseGooseIncremental 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.
tokentracker-account-heatmap.default (cyclomatic 42) dashboard/edge-patches/tokentracker-account-heatmap.ts:213— tokentracker-account-heatmap.default has cyclomatic complexity 42 (threshold 15). Of this number, 35 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-account-monthly.default (cyclomatic 42) dashboard/edge-patches/tokentracker-account-monthly.ts:140— tokentracker-account-monthly.default has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tokentracker-public-visibility.default (cyclomatic 42) dashboard/edge-patches/tokentracker-public-visibility.ts:76— tokentracker-public-visibility.default 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.
SessionsPage.SessionRow (cyclomatic 42) dashboard/src/pages/SessionsPage.jsx:207— SessionsPage.SessionRow has cyclomatic complexity 42 (threshold 15). Of this number, 36 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.readKiroCliSessionTurns (cyclomatic 41) REDACTED:9026— rollout.readKiroCliSessionTurns has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseKimiIncremental (cyclomatic 41) REDACTED:10238— rollout.parseKimiIncremental has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
claude-categorizer.computeClaudeGroundTruthBuckets (cyclomatic 41) src/lib/claude-categorizer.js:1193— claude-categorizer.computeClaudeGroundTruthBuckets has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
limits-cache.createLimitsCache.normalize (cyclomatic 41) src/lib/limits-cache.js:244— limits-cache.createLimitsCache.normalize has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LimitsPage.LimitsPage (cyclomatic 41) dashboard/src/pages/LimitsPage.jsx:114— LimitsPage.LimitsPage has cyclomatic complexity 41 (threshold 15). Of this number, 20 points are the body's own statements and 21 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CloudMembershipCard.RestoreCloudOrder (cyclomatic 41) dashboard/src/components/cloud/CloudMembershipCard.jsx:297— CloudMembershipCard.RestoreCloudOrder has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 15 of the 41 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 333, 351, 386, …). 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.
createBackendResolver (cyclomatic 41) src/lib/claude-backend.js:152— createBackendResolver has cyclomatic complexity 41 (threshold 15). Of this number, 17 points are the body's own statements and 24 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
native-qa-auth.createRAMAuthBroker.execute (cyclomatic 40) TokenTrackerBar/scripts/native-qa-auth.cjs:64— native-qa-auth.createRAMAuthBroker.execute has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.parseCopilotAppDbIncremental (cyclomatic 40) REDACTED:21043— rollout.parseCopilotAppDbIncremental has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
claude-categorizer.buildToolCallsBreakdown (cyclomatic 40) src/lib/claude-categorizer.js:736— claude-categorizer.buildToolCallsBreakdown has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 8 of the 40 points are its own statements and the rest belongs to 7 function items inside it that branch (groupIntoCategories, a function literal at line 785, a function literal at line 798, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.computeRowCost (cyclomatic 40) src/lib/pricing/index.js:347— index.computeRowCost has cyclomatic complexity 40 (threshold 15). Of this number, 38 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
tokentracker-leaderboard.default (cyclomatic 40) dashboard/edge-patches/tokentracker-leaderboard.ts:94— tokentracker-leaderboard.default has cyclomatic complexity 40 (threshold 15). Of this number, 33 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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.
tokentracker-profile-likes.default (cyclomatic 40) dashboard/edge-patches/tokentracker-profile-likes.ts:218— tokentracker-profile-likes.default has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TrendMonitorZoomModal.TrendMonitorZoomModal (cyclomatic 40) REDACTED:101— TrendMonitorZoomModal.TrendMonitorZoomModal has cyclomatic complexity 40 (threshold 15). Of this number, 21 points are the body's own statements and 19 belong to 13 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DeviceUsageCard.DeviceUsageCard (cyclomatic 40) REDACTED:27— DeviceUsageCard.DeviceUsageCard has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 7 of the 40 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 126, a function literal at line 284, commitEdit, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
fetchArkCodingPlanLimits (cyclomatic 40) src/lib/ark-coding-plan-limits.js:309— fetchArkCodingPlanLimits has cyclomatic complexity 40 (threshold 15). Of this number, 27 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fetchArkAgentPlanLimits (cyclomatic 40) src/lib/ark-agent-plan-limits.js:253— fetchArkAgentPlanLimits has cyclomatic complexity 40 (threshold 15). Of this number, 27 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.migrateCopilotChatLogRecordDedup (cyclomatic 39) REDACTED:19321— rollout.migrateCopilotChatLogRecordDedup has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
command-runner.runCommand (cyclomatic 39) src/lib/command-runner.js:19— command-runner.runCommand has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 2 of the 39 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 42, 86, 126, …). 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.
device-login.cmdDeviceLogin (cyclomatic 39) src/commands/device-login.js:64— device-login.cmdDeviceLogin has cyclomatic complexity 39 (threshold 15). Of this number, 27 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
native-bridge.saveUsageExport (cyclomatic 39) dashboard/src/lib/native-bridge.js:178— native-bridge.saveUsageExport has cyclomatic complexity 39 (threshold 15). Of this number, 24 points are the body's own statements and 15 belong to 3 function literals inside it that branch. 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.
CommandPalette.CommandPalette (cyclomatic 39) dashboard/src/ui/dashboard/components/CommandPalette.jsx:18— CommandPalette.CommandPalette has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 9 of the 39 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 67, a function literal at line 31, onInputKeyDown, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-usage-data.useUsageData (cyclomatic 39) dashboard/src/hooks/use-usage-data.ts:20— use-usage-data.useUsageData has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 8 of the 39 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 338, 52, 419, …). 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.
ClawdCompanionView.activePetLimits (cyclomatic 39) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1494— ClawdCompanionView.activePetLimits has cyclomatic complexity 39 (threshold 15). Of this number, 32 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
normalizeZcodeBalanceResponse (cyclomatic 39) REDACTED:624— normalizeZcodeBalanceResponse has cyclomatic complexity 39 (threshold 15). Of this number, 17 points are the body's own statements and 22 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
trae-snapshot.openTraeSnapshot (cyclomatic 38) REDACTED:131— trae-snapshot.openTraeSnapshot has cyclomatic complexity 38 (threshold 15). Of this number, 27 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.parseRoocodeIncremental (cyclomatic 38) REDACTED:12807— rollout.parseRoocodeIncremental has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rollout.parseKilocodeIncremental) 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.
rollout.parseKilocodeIncremental (cyclomatic 38) REDACTED:16801— rollout.parseKilocodeIncremental has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (rollout.parseRoocodeIncremental) 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.
cloud-account.fetchAccountUsage (cyclomatic 38) src/lib/cloud-account.js:435— cloud-account.fetchAccountUsage has cyclomatic complexity 38 (threshold 15). Of this number, 29 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
readQueueBatch (cyclomatic 38) src/commands/sync.js:4557— readQueueBatch has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InsforgeUserHeaderControls.InsforgeUserHeaderControls (cyclomatic 37) dashboard/src/components/InsforgeUserHeaderControls.jsx:55— InsforgeUserHeaderControls.InsforgeUserHeaderControls 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.
cmdServe (cyclomatic 37) REDACTED:69— cmdServe has cyclomatic complexity 37 (threshold 15). Of this number, 21 points are the body's own statements and 16 belong to 11 function items inside it that branch. 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.
rollout.parseHermesIncremental::ingestProfile (cyclomatic 36) REDACTED:8627— rollout.parseHermesIncremental::ingestProfile 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.
usage-limits.normalizeCursorUsageSummary (cyclomatic 36) src/lib/usage-limits.js:808— usage-limits.normalizeCursorUsageSummary 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.
LeaderboardProfileModal.ProfileContent (cyclomatic 36) dashboard/src/components/leaderboard/LeaderboardProfileModal.jsx:445— LeaderboardProfileModal.ProfileContent has cyclomatic complexity 36 (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.
DashboardView.DashboardView (cyclomatic 36) dashboard/src/ui/dashboard/views/DashboardView.jsx:104— DashboardView.DashboardView has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 15 of the 36 points are its own statements and the rest belongs to 5 function items inside it that branch (renderLeftCard, renderRightCard, a function literal at line 403, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
startLinuxPetHost (cyclomatic 36) dashboard/src/lib/pet-linux-host.js:154— startLinuxPetHost has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 13 function items inside it that branch (refreshUsage, fetchHeatmap, fetchTopModels, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rollout.parseMuseIncremental::handleRecord (cyclomatic 35) REDACTED:18523— rollout.parseMuseIncremental::handleRecord has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (rollout.parseMuseIncremental) 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.
dumate.parseDumateIncremental (cyclomatic 35) src/lib/dumate.js:32— dumate.parseDumateIncremental has cyclomatic complexity 35 (threshold 15). Of this number, 33 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
codex-rollout-parser.readCodexObjectsIncremental (cyclomatic 35) REDACTED:1299— codex-rollout-parser.readCodexObjectsIncremental has cyclomatic complexity 35 (threshold 15). Of this number, 32 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zcode-limits.loadZcodeAuthCandidates (cyclomatic 35) REDACTED:437— zcode-limits.loadZcodeAuthCandidates has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
usage-limits.fetchAntigravityLimits (cyclomatic 35) src/lib/usage-limits.js:4154— usage-limits.fetchAntigravityLimits has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
doctor.buildDiagnosticsChecks (cyclomatic 35) src/lib/doctor.js:294— doctor.buildDiagnosticsChecks has cyclomatic complexity 35 (threshold 15). Of this number, 33 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DashboardViewModel.loadAll (cyclomatic 35) TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:166— DashboardViewModel.loadAll has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fetchOpencodeGoApiLimits (cyclomatic 35) REDACTED:559— fetchOpencodeGoApiLimits has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 2 function items inside it that branch (resolveApiWindow, a function literal at line 610). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rollout.parseUnslothIncremental (cyclomatic 34) REDACTED:14947— rollout.parseUnslothIncremental has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.normalizeCommandCodeState (cyclomatic 34) REDACTED:26190— rollout.normalizeCommandCodeState has cyclomatic complexity 34 (threshold 15). Of this number, 29 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
codex-rollout-parser.discoverCodexSessionFiles (cyclomatic 34) REDACTED:330— codex-rollout-parser.discoverCodexSessionFiles 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.
skills-manager.updateSkills (cyclomatic 34) src/lib/skills-manager.js:1399— skills-manager.updateSkills has cyclomatic complexity 34 (threshold 15). Of this number, 29 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sync.repairMimoClaudeMislabel (cyclomatic 34) src/commands/sync.js:4930— sync.repairMimoClaudeMislabel has cyclomatic complexity 34 (threshold 15). Of this number, 32 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tokentracker-account-summary.default (cyclomatic 34) dashboard/edge-patches/tokentracker-account-summary.ts:927— tokentracker-account-summary.default has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
use-community-stats.useCommunityStats (cyclomatic 34) dashboard/src/hooks/use-community-stats.js:133— use-community-stats.useCommunityStats has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 151, 144, 229, …). 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.
installSkill (cyclomatic 34) src/lib/skills-manager.js:919— installSkill has cyclomatic complexity 34 (threshold 15). Of this number, 28 points are the body's own statements and 6 belong to 7 function literals inside it that branch. 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.
rollout.parseOpencodeMessageFile (cyclomatic 33) REDACTED:3375— rollout.parseOpencodeMessageFile 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.
rollout.parseCursorApiIncremental (cyclomatic 33) REDACTED:7877— rollout.parseCursorApiIncremental 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.
rollout.resolveCodebuddyProjectFiles (cyclomatic 33) REDACTED:10740— rollout.resolveCodebuddyProjectFiles has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 14 of the 33 points are its own statements and the rest belongs to 2 function items inside it that branch (walkLogs, walkJsonl). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rollout.parseAnythingllmIncremental (cyclomatic 33) REDACTED:15194— rollout.parseAnythingllmIncremental has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
claude-categorizer.classifyOneMessage (cyclomatic 33) src/lib/claude-categorizer.js:381— claude-categorizer.classifyOneMessage 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.
tokentracker-device-usage-reset.default (cyclomatic 33) dashboard/edge-patches/tokentracker-device-usage-reset.ts:22— tokentracker-device-usage-reset.default has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CostAnalysisModal.CostAnalysisModal (cyclomatic 33) dashboard/src/ui/dashboard/components/CostAnalysisModal.jsx:30— CostAnalysisModal.CostAnalysisModal has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 164, 78, 40, …). 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.
discoverSessionFiles (cyclomatic 33) src/lib/session-analytics.js:2073— discoverSessionFiles has cyclomatic complexity 33 (threshold 15). Of this number, 25 points are the body's own statements and 8 belong to 16 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.parseTraeCnApiIncremental (cyclomatic 32) REDACTED:24282— rollout.parseTraeCnApiIncremental 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.
rollout.inspectDshZstdFrames (cyclomatic 32) REDACTED:24629— rollout.inspectDshZstdFrames has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
grok-context-breakdown.computeGrokContextBreakdownUncached (cyclomatic 32) src/lib/grok-context-breakdown.js:676— grok-context-breakdown.computeGrokContextBreakdownUncached has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 belong to 7 function items inside it that branch. 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.
session-analytics.scanCodexSession (cyclomatic 32) src/lib/session-analytics.js:825— session-analytics.scanCodexSession has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
UsageLimitsView.toolSection (cyclomatic 32) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:290— UsageLimitsView.toolSection 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.
drainQueueToCloud (cyclomatic 32) src/commands/sync.js:4457— drainQueueToCloud has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
collectResourceGroups (cyclomatic 32) src/lib/workbuddy-limits.js:332— collectResourceGroups has cyclomatic complexity 32 (threshold 15). Of this number, 23 points are the body's own statements and 9 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.readKiroCliMessageChars (cyclomatic 31) REDACTED:8950— rollout.readKiroCliMessageChars has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
project-usage-purge.purgeProjectUsage (cyclomatic 31) src/lib/project-usage-purge.js:6— project-usage-purge.purgeProjectUsage has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
usage-limits.parseKiroUsageOutput (cyclomatic 31) src/lib/usage-limits.js:1687— usage-limits.parseKiroUsageOutput has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CursorConnectionControl.CursorConnectionControl (cyclomatic 31) dashboard/src/ui/dashboard/components/CursorConnectionControl.jsx:10— CursorConnectionControl.CursorConnectionControl has cyclomatic complexity 31 (threshold 15). Of this number, 16 points are the body's own statements and 15 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LikeButton.LikeButton (cyclomatic 31) REDACTED:45— LikeButton.LikeButton has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 9 of the 31 points are its own statements and the rest belongs to 8 function items inside it that branch (sendAction, a function literal at line 87, handleLikeClick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UsageLimitsResponse.limitWindowReadings (cyclomatic 31) TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:200— UsageLimitsResponse.limitWindowReadings has cyclomatic complexity 31 (threshold 15). Of this number, 27 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.parseKiroIncremental (cyclomatic 30) REDACTED:8182— rollout.parseKiroIncremental 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.
claude-config.normalizeEntriesForCommand (cyclomatic 30) src/lib/claude-config.js:181— claude-config.normalizeEntriesForCommand has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 189, a function literal at line 214, a function literal at line 200, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runtime-config.resolveRuntimeConfig (cyclomatic 30) REDACTED:20— runtime-config.resolveRuntimeConfig 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.
init.previewIntegrations (cyclomatic 30) src/commands/init.js:1163— init.previewIntegrations 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.
upload-queue.compactPendingQueue (cyclomatic 30) src/lib/upload-queue.js:64— upload-queue.compactPendingQueue 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.
outcomes-engine.computeQualityPerDollar (cyclomatic 30) src/lib/outcomes-engine.js:198— outcomes-engine.computeQualityPerDollar 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.
git-outcomes.buildGitOutcomesInternal (cyclomatic 30) src/lib/git-outcomes.js:125— git-outcomes.buildGitOutcomesInternal has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
local-api.computeLocalAchievements (cyclomatic 30) src/lib/local-api.js:576— local-api.computeLocalAchievements has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sync.applyOpenclawTotalsFallback (cyclomatic 30) src/commands/sync.js:4154— sync.applyOpenclawTotalsFallback 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.
cloud-sync.syncCloudUsageWithRecovery (cyclomatic 30) dashboard/src/lib/cloud-sync.ts:127— cloud-sync.syncCloudUsageWithRecovery has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CloudBillingParts.cloudBillingErrorText (cyclomatic 30) dashboard/src/components/cloud/CloudBillingParts.jsx:7— CloudBillingParts.cloudBillingErrorText 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.
cloud-usage-export.fetchCloudUsageExport (cyclomatic 30) dashboard/src/lib/cloud-usage-export.ts:41— cloud-usage-export.fetchCloudUsageExport has cyclomatic complexity 30 (threshold 15). Of this number, 19 points are the body's own statements and 11 belong to one function literal inside it that branches. 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.
NativeBridge.handle (cyclomatic 30) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:122— NativeBridge.handle 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.
rollout.recordProjectMeta (cyclomatic 29) REDACTED:4995— rollout.recordProjectMeta 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.
rollout.extractAntigravityGenInfo (cyclomatic 29) REDACTED:23144— rollout.extractAntigravityGenInfo 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.
omp-hook.removeOmpHook (cyclomatic 29) src/lib/omp-hook.js:443— omp-hook.removeOmpHook 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.
grok-limits.refreshGrokTokens (cyclomatic 29) src/lib/grok-limits.js:294— grok-limits.refreshGrokTokens 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.
sync.repairZcodeUsageMigration (cyclomatic 29) src/commands/sync.js:5271— sync.repairZcodeUsageMigration 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.
mock-data.getMockLeaderboard (cyclomatic 29) dashboard/src/lib/mock-data.ts:683— mock-data.getMockLeaderboard has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-usage-limits.useUsageLimits (cyclomatic 29) dashboard/src/hooks/use-usage-limits.ts:177— use-usage-limits.useUsageLimits has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 368, 249, 326, …). 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.
model-breakdown.buildAllModels (cyclomatic 29) dashboard/src/lib/model-breakdown.ts:447— model-breakdown.buildAllModels has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageLimitsResponse.isProviderAvailable (cyclomatic 29) TokenTrackerBar/TokenTrackerBar/Models/MenuBarDisplayPreferences.swift:203— UsageLimitsResponse.isProviderAvailable has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: MenuBarDisplayMetric.menuLabel (cyclomatic 43) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ClawdCompanionView.clawdState (cyclomatic 29) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1321— ClawdCompanionView.clawdState 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.
WidgetStrings.limitLabel (cyclomatic 29) TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:59— WidgetStrings.limitLabel has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
commit (cyclomatic 29) src/lib/cursor-store.js:855— commit has cyclomatic complexity 29 (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.
removeOpenclawSessionPluginConfig (cyclomatic 29) src/lib/openclaw-session-plugin.js:228— removeOpenclawSessionPluginConfig has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
useCloudSyncControl (cyclomatic 29) dashboard/src/components/settings/useAccountProfileSettings.js:21— useCloudSyncControl has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 4 of the 29 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 53, a function literal at line 76, a function literal at line 86, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
removeOpenclawHookConfig (cyclomatic 29) src/lib/openclaw-hook.js:140— removeOpenclawHookConfig has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.recordOpencodeMessage (cyclomatic 28) REDACTED:4381— rollout.recordOpencodeMessage 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.
rollout.dedupeDroidSettingsFilesBySession (cyclomatic 28) REDACTED:16325— rollout.dedupeDroidSettingsFilesBySession has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
cursor-store.isGenerationMetadata (cyclomatic 28) src/lib/cursor-store.js:1207— cursor-store.isGenerationMetadata has cyclomatic complexity 28 (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.
zcode-limits.normalizeZcodeCodingPlanQuotaResponse (cyclomatic 28) REDACTED:895— zcode-limits.normalizeZcodeCodingPlanQuotaResponse has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
sync.migrateRolloutCumulativeDeltaBuckets (cyclomatic 28) src/commands/sync.js:5809— sync.migrateRolloutCumulativeDeltaBuckets 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.
tokentracker-account-hourly.default (cyclomatic 28) dashboard/edge-patches/tokentracker-account-hourly.ts:222— tokentracker-account-hourly.default has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
tokentracker-account-model-breakdown.getUsageModelPricing (cyclomatic 28) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:864— tokentracker-account-model-breakdown.getUsageModelPricing 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.
tokentracker-badge-svg.default (cyclomatic 28) dashboard/edge-patches/tokentracker-badge-svg.ts:189— tokentracker-badge-svg.default 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.
tokentracker-leaderboard-profile.computeRowCost (cyclomatic 28) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:686— tokentracker-leaderboard-profile.computeRowCost has cyclomatic complexity 28 (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.
tokentracker-leaderboard-refresh.computeRowCost (cyclomatic 28) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:708— tokentracker-leaderboard-refresh.computeRowCost has cyclomatic complexity 28 (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.
CommunityStatsModal.CommunityStatsModalContent (cyclomatic 28) dashboard/src/components/leaderboard/CommunityStatsModal.jsx:467— CommunityStatsModal.CommunityStatsModalContent has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 11 of the 28 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 474, onTablistKeyDown, a function literal at line 542, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
LoginPage.LoginPage (cyclomatic 28) dashboard/src/pages/LoginPage.jsx:15— LoginPage.LoginPage has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 36, 51, 69, …). 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.
PetWindow.HoverTick (cyclomatic 27) TokenTrackerWin/PetWindow.cs:403— PetWindow.HoverTick 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.
rollout.resolveWorkbuddyProjectFiles (cyclomatic 27) REDACTED:11412— rollout.resolveWorkbuddyProjectFiles has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (walkJsonl, walkTraces, a function literal at line 11460). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
categorizer-utils.categorizeTool (cyclomatic 27) src/lib/categorizer-utils.js:12— categorizer-utils.categorizeTool 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.
categorizer-utils.inferExecCommandKind (cyclomatic 27) src/lib/categorizer-utils.js:76— categorizer-utils.inferExecCommandKind 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.
status.formatCopilotLines (cyclomatic 27) src/commands/status.js:1536— status.formatCopilotLines 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.
static-server.serveStaticFile (cyclomatic 27) src/lib/static-server.js:64— static-server.serveStaticFile has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tokentracker-account-daily.computeRowCost (cyclomatic 27) dashboard/edge-patches/tokentracker-account-daily.ts:857— tokentracker-account-daily.computeRowCost 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.
tokentracker-account-summary.computeRowCost (cyclomatic 27) dashboard/edge-patches/tokentracker-account-summary.ts:857— tokentracker-account-summary.computeRowCost 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.
CloudContextualPrompt.CloudContextualPrompt (cyclomatic 27) dashboard/src/components/cloud/CloudContextualPrompt.jsx:78— CloudContextualPrompt.CloudContextualPrompt has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 91). 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.
AchievementsSection.AchievementsSection (cyclomatic 27) dashboard/src/ui/achievements/AchievementsSection.jsx:25— AchievementsSection.AchievementsSection has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NativeQAProfile.validate (cyclomatic 27) TokenTrackerBar/Shared/NativeQAProfile.swift:106— NativeQAProfile.validate 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.
ClawdCompanionView.drawDisconnected (cyclomatic 27) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1047— ClawdCompanionView.drawDisconnected 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.
migrateLegacyDeepseekHarnessSource (cyclomatic 27) src/commands/sync.js:4007— migrateLegacyDeepseekHarnessSource 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.
normalizeCodexCreditWindow (cyclomatic 27) src/lib/usage-limits.js:510— normalizeCodexCreditWindow 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.
cloud-account.performMint (cyclomatic 26) src/lib/cloud-account.js:246— cloud-account.performMint 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.
grok-limits.normalizeGrokBillingResponse (cyclomatic 26) src/lib/grok-limits.js:616— grok-limits.normalizeGrokBillingResponse 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.
sync.repairGrokQueueFromSessionSnapshots (cyclomatic 26) src/commands/sync.js:5603— sync.repairGrokQueueFromSessionSnapshots has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sync.scanCodexUsageLineages (cyclomatic 26) src/commands/sync.js:6844— sync.scanCodexUsageLineages 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.
paddle.normalizePaddleEvent (cyclomatic 26) dashboard/edge-patches/cloud/paddle.ts:355— paddle.normalizePaddleEvent 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.
waffo.confirmExpiredUnusedWaffoCheckout (cyclomatic 26) REDACTED:662— waffo.confirmExpiredUnusedWaffoCheckout 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.
tokentracker-account-devices.default (cyclomatic 26) dashboard/edge-patches/tokentracker-account-devices.ts:174— tokentracker-account-devices.default 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.
SegmentedControl.SegmentedControl (cyclomatic 26) dashboard/src/ui/components/SegmentedControl.jsx:19— SegmentedControl.SegmentedControl has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 7 function items inside it that branch (moveSelection, a function literal at line 66, a function literal at line 54, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-trend-data.parseHourLabel (cyclomatic 26) dashboard/src/hooks/use-trend-data.ts:864— use-trend-data.parseHourLabel 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.
model-breakdown.buildFleetData (cyclomatic 26) dashboard/src/lib/model-breakdown.ts:325— model-breakdown.buildFleetData has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 370, 363, 331, …). 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.
normalizeZcodeQuotaLimit (cyclomatic 26) REDACTED:862— normalizeZcodeQuotaLimit has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
fetchTraeCnUsagePage (cyclomatic 26) src/lib/trae-cn-config.js:342— fetchTraeCnUsagePage 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.
jsonl-lines.physicalJsonlRecords (cyclomatic 25) src/lib/jsonl-lines.js:29— jsonl-lines.physicalJsonlRecords 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.
rollout.preserveCodexModelBuckets (cyclomatic 25) REDACTED:3535— rollout.preserveCodexModelBuckets 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.
V2CursorStore.loadOpencodeMessagesForBatchUnchecked (cyclomatic 25) src/lib/cursor-store.js:432— V2CursorStore.loadOpencodeMessagesForBatchUnchecked has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
grok-context-breakdown.mapGrokToolName (cyclomatic 25) src/lib/grok-context-breakdown.js:189— grok-context-breakdown.mapGrokToolName 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.
opencode-go-limits.fetchOpencodeGoLimits (cyclomatic 25) REDACTED:739— opencode-go-limits.fetchOpencodeGoLimits 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.
skill-usage.scanFile (cyclomatic 25) src/lib/skill-usage.js:135— skill-usage.scanFile 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.
sync.relabelClaudeMemQueueRows (cyclomatic 25) src/commands/sync.js:7814— sync.relabelClaudeMemQueueRows 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.
tokentracker-account-skills.default (cyclomatic 25) dashboard/edge-patches/tokentracker-account-skills.ts:163— tokentracker-account-skills.default has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tokentracker-device-token-issue.default (cyclomatic 25) dashboard/edge-patches/tokentracker-device-token-issue.ts:96— tokentracker-device-token-issue.default 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.
cloud-action-intent.readCloudAction (cyclomatic 25) dashboard/src/lib/cloud-action-intent.js:64— cloud-action-intent.readCloudAction 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.
SearchableSelect.SearchableSelect (cyclomatic 25) dashboard/src/ui/components/SearchableSelect.jsx:26— SearchableSelect.SearchableSelect has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 6 function items inside it that branch (handleKeyDown, a function literal at line 80, a function literal at line 145, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
BadgeDetailModal.BadgeDetailBody (cyclomatic 25) dashboard/src/ui/achievements/BadgeDetailModal.jsx:62— BadgeDetailModal.BadgeDetailBody 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.
DataDetails.DataDetails (cyclomatic 25) dashboard/src/ui/dashboard/components/DataDetails.jsx:86— DataDetails.DataDetails has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 4 function literals inside it that branch. 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.
ContextBreakdownPanel.normalizeToolRows (cyclomatic 25) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:223— ContextBreakdownPanel.normalizeToolRows has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 225, 247). 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.
pet-quips.buildQuipPool (cyclomatic 25) dashboard/src/lib/pet-quips.js:611— pet-quips.buildQuipPool 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.
toSessionBrowserRow (cyclomatic 25) src/lib/session-analytics.js:2982— toSessionBrowserRow 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.
collectPetLimitRows (cyclomatic 25) dashboard/src/lib/pet-quips.js:391— collectPetLimitRows has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 20 function items inside it that branch. 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.
useLimitsDisplayPrefs (cyclomatic 25) dashboard/src/hooks/use-limits-display-prefs.js:335— useLimitsDisplayPrefs has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 28 function items inside it that branch (a function literal at line 400, a function literal at line 339, a function literal at line 356, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
openLock (cyclomatic 25) src/lib/fs.js:284— openLock 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.
preloadLeaderboardDefaultState (cyclomatic 25) dashboard/src/lib/dashboard-preload.js:383— preloadLeaderboardDefaultState has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
CloudUsageExport.Save (cyclomatic 24) TokenTrackerWin/CloudUsageExport.cs:48— CloudUsageExport.Save has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
rollout.normalizeHourlyState (cyclomatic 24) REDACTED:4122— rollout.normalizeHourlyState 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.
rollout.resolveProjectMetaForPath (cyclomatic 24) REDACTED:4824— rollout.resolveProjectMetaForPath 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.
pet-packages.readCodexBuiltinPets (cyclomatic 24) src/lib/pet-packages.js:548— pet-packages.readCodexBuiltinPets has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dsh-session.firstStreamTokenTime (cyclomatic 24) src/lib/dsh-session.js:105— dsh-session.firstStreamTokenTime 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.
sync.repairCodexForkReplayInflation (cyclomatic 24) src/commands/sync.js:6658— sync.repairCodexForkReplayInflation 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.
tokentracker-device-rename.default (cyclomatic 24) dashboard/edge-patches/tokentracker-device-rename.ts:84— tokentracker-device-rename.default 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.
ThemeProvider.ThemeProvider (cyclomatic 24) dashboard/src/ui/foundation/ThemeProvider.jsx:64— ThemeProvider.ThemeProvider has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 66, 87, 125, …). 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.
cloud-sync.rebuildCloudDeviceUsage (cyclomatic 24) dashboard/src/lib/cloud-sync.ts:209— cloud-sync.rebuildCloudDeviceUsage 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.
cloud-billing.cloudBillingRequest (cyclomatic 24) dashboard/src/lib/cloud-billing.ts:109— cloud-billing.cloudBillingRequest has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-trend-data.fillHourlyGaps (cyclomatic 24) dashboard/src/hooks/use-trend-data.ts:655— use-trend-data.fillHourlyGaps 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.
LeaderboardPage.MobileLeaderboardRow (cyclomatic 24) dashboard/src/pages/LeaderboardPage.jsx:284— LeaderboardPage.MobileLeaderboardRow has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SkillsPage.BrowseCard (cyclomatic 24) REDACTED:616— SkillsPage.BrowseCard has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StatusBarController.buildMenu (cyclomatic 24) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:1161— StatusBarController.buildMenu 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.
ClawdCompanionView.drawIdleLiving (cyclomatic 24) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:654— ClawdCompanionView.drawIdleLiving 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.
parseAntigravityCredentialPayload (cyclomatic 24) src/lib/usage-limits.js:3643— parseAntigravityCredentialPayload has cyclomatic complexity 24 (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.
limitRows (cyclomatic 24) TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:170— limitRows 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.
localDataApiPlugin.configureServer (cyclomatic 24) REDACTED:1229— localDataApiPlugin.configureServer has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 1231, 1279, 1285). 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.
readQoderLocalQuotaWithAge (cyclomatic 24) src/lib/qoder-limits.js:766— readQoderLocalQuotaWithAge has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.readZcodeNativeUsageMessages (cyclomatic 23) REDACTED:6184— rollout.readZcodeNativeUsageMessages 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.
rollout.parseClaudeScienceIncremental (cyclomatic 23) REDACTED:7756— rollout.parseClaudeScienceIncremental 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.
cli-ui.promptMenu (cyclomatic 23) src/lib/cli-ui.js:53— cli-ui.promptMenu has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 92, rerender, a function literal at line 66, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
deepseek-status.parseDeepSeekStatusPage (cyclomatic 23) src/lib/deepseek-status.js:94— deepseek-status.parseDeepSeekStatusPage 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.
zcode-limits.scanZcodeBalanceLogs (cyclomatic 23) REDACTED:1010— zcode-limits.scanZcodeBalanceLogs has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
usage-limits.normalizeAntigravityResponse (cyclomatic 23) src/lib/usage-limits.js:3475— usage-limits.normalizeAntigravityResponse has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
session-analytics.providerRoots (cyclomatic 23) src/lib/session-analytics.js:1820— session-analytics.providerRoots 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.
session-analytics.groupClaudeFilesAcrossRoots (cyclomatic 23) src/lib/session-analytics.js:1888— session-analytics.groupClaudeFilesAcrossRoots has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
activity-heatmap.buildActivityHeatmap (cyclomatic 23) dashboard/src/lib/activity-heatmap.ts:80— activity-heatmap.buildActivityHeatmap has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-community-stats.normalizeCachedData (cyclomatic 23) dashboard/src/hooks/use-community-stats.js:44— use-community-stats.normalizeCachedData 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.
skills-inventory.mergeSkillInventories (cyclomatic 23) dashboard/src/lib/skills-inventory.ts:104— skills-inventory.mergeSkillInventories has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
use-usage-model-breakdown.useUsageModelBreakdown.refresh (cyclomatic 23) dashboard/src/hooks/use-usage-model-breakdown.ts:110— use-usage-model-breakdown.useUsageModelBreakdown.refresh 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.
ContextBreakdownPanel.ToolCallsExpanded (cyclomatic 23) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:610— ContextBreakdownPanel.ToolCallsExpanded has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 632, 646, 655). 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.
SkillsPage.SkillRow (cyclomatic 23) REDACTED:220— SkillsPage.SkillRow has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NativeQAProfile.permitsNativeMessage (cyclomatic 23) TokenTrackerBar/Shared/NativeQAProfile.swift:186— NativeQAProfile.permitsNativeMessage 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.
ClawdCompanionView.quipPool (cyclomatic 23) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1700— ClawdCompanionView.quipPool 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.
fetchGeminiLimits (cyclomatic 23) src/lib/usage-limits.js:1454— fetchGeminiLimits 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.
useCommunityStats::(anonymous)::run (cyclomatic 23) dashboard/src/hooks/use-community-stats.js:151— useCommunityStats::(anonymous)::run 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.
probeWslDistros (cyclomatic 23) src/lib/wsl-probe.js:57— probeWslDistros has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
native-qa-auth.createRAMAuthBroker.acceptSession (cyclomatic 22) TokenTrackerBar/scripts/native-qa-auth.cjs:41— native-qa-auth.createRAMAuthBroker.acceptSession 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.
trae-snapshot.indexWal (cyclomatic 22) REDACTED:86— trae-snapshot.indexWal 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.
rollout.parseRolloutFile (cyclomatic 22) REDACTED:2371— rollout.parseRolloutFile has cyclomatic complexity 22 (threshold 15). Of this number, 17 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.diffGeminiTotals (cyclomatic 22) REDACTED:5317— rollout.diffGeminiTotals 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.
rollout.readOpencodeDbMessagesIncremental::appendRows (cyclomatic 22) REDACTED:5731— rollout.readOpencodeDbMessagesIncremental::appendRows 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.
rollout.writeKiroCliCreditsSidecar (cyclomatic 22) REDACTED:9411— rollout.writeKiroCliCreditsSidecar 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.
rollout.resolveGooseDbPath (cyclomatic 22) REDACTED:15745— rollout.resolveGooseDbPath 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.
init.parseArgs (cyclomatic 22) src/commands/init.js:1410— init.parseArgs 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.
codex-context-breakdown.openValidatedResumeFile (cyclomatic 22) src/lib/codex-context-breakdown.js:295— codex-context-breakdown.openValidatedResumeFile 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.
pet-packages.normalizeManifest (cyclomatic 22) src/lib/pet-packages.js:130— pet-packages.normalizeManifest 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.
pet-packages.readZipEntries (cyclomatic 22) src/lib/pet-packages.js:187— pet-packages.readZipEntries has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 203, 243, 196, …). 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.
codex-token-refresh.refreshCodexTokens (cyclomatic 22) src/lib/codex-token-refresh.js:38— codex-token-refresh.refreshCodexTokens 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.
zcode-limits.readZcodeLimitsCache (cyclomatic 22) REDACTED:1131— zcode-limits.readZcodeLimitsCache 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.
opencode-go-limits.collectOpencodeGoLocal (cyclomatic 22) REDACTED:486— opencode-go-limits.collectOpencodeGoLocal 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.
waffo.closeSingleUnpaidWaffoOrder (cyclomatic 22) REDACTED:572— waffo.closeSingleUnpaidWaffoOrder 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.
insforge-config.getOrCreateInsforgeClient (cyclomatic 22) REDACTED:100— insforge-config.getOrCreateInsforgeClient has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UsageLimitsPanel.UsageLimitsPanel (cyclomatic 22) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1677— UsageLimitsPanel.UsageLimitsPanel has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NativeAuthCallbackPage.NativeAuthCallbackPage (cyclomatic 22) dashboard/src/pages/NativeAuthCallbackPage.jsx:41— NativeAuthCallbackPage.NativeAuthCallbackPage has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 88, 56, 77, …). 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.
WrappedPage.WrappedPage (cyclomatic 22) dashboard/src/pages/WrappedPage.jsx:33— WrappedPage.WrappedPage has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
upsertOmpHook (cyclomatic 22) src/lib/omp-hook.js:283— upsertOmpHook 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.
validateSnapshot (cyclomatic 22) src/lib/local-usage-transfer.js:74— validateSnapshot 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.
detectPassiveProviders (cyclomatic 22) src/lib/passive-mode.js:93— detectPassiveProviders has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 8 function items inside it that branch (logsPredicate, logsPredicate, logsPredicate, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ResumableDownloader.DownloadAsync (cyclomatic 21) TokenTrackerWin/ResumableDownloader.cs:38— ResumableDownloader.DownloadAsync 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.
UsagePoller.FetchTopModelsAsync (cyclomatic 21) TokenTrackerWin/UsagePoller.cs:340— UsagePoller.FetchTopModelsAsync has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
codex-token-usage.consumeUsageDelta (cyclomatic 21) src/lib/codex-token-usage.js:98— codex-token-usage.consumeUsageDelta 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.
rollout.listRolloutDayFiles (cyclomatic 21) REDACTED:149— rollout.listRolloutDayFiles 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.
rollout.sameOpenclawFileGeneration (cyclomatic 21) REDACTED:2040— rollout.sameOpenclawFileGeneration 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.
rollout.antigravityProjectAssignmentChanged (cyclomatic 21) REDACTED:5034— rollout.antigravityProjectAssignmentChanged has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
rollout.collectPiStyleSubagentFiles (cyclomatic 21) REDACTED:12429— rollout.collectPiStyleSubagentFiles has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to one function item inside it that branches. 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.
rollout.resolveOpenSquillaDbPaths (cyclomatic 21) REDACTED:14460— rollout.resolveOpenSquillaDbPaths has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.readCommandCodeSessionSnapshot (cyclomatic 21) REDACTED:26242— rollout.readCommandCodeSessionSnapshot 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.
openclaw-session-plugin.ensureOpenclawSessionPluginPolicy (cyclomatic 21) src/lib/openclaw-session-plugin.js:180— openclaw-session-plugin.ensureOpenclawSessionPluginPolicy 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.
antigravity-discovery.discoverT3AntigravityBrainDirs (cyclomatic 21) src/lib/antigravity-discovery.js:67— antigravity-discovery.discoverT3AntigravityBrainDirs has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
claude-categorizer.getConfiguredResources (cyclomatic 21) src/lib/claude-categorizer.js:1052— claude-categorizer.getConfiguredResources 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.
cursor-store.buildCodexFileShardMetadata (cyclomatic 21) src/lib/cursor-store.js:1385— cursor-store.buildCodexFileShardMetadata has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zcode-limits.readZcodeLogSnapshotCache (cyclomatic 21) REDACTED:1267— zcode-limits.readZcodeLogSnapshotCache 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.
workbuddy-ipc.readWorkbuddyIpcDiscovery (cyclomatic 21) src/lib/workbuddy-ipc.js:18— workbuddy-ipc.readWorkbuddyIpcDiscovery 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.
kimi-profile.resolveKimiProfile (cyclomatic 21) src/lib/kimi-profile.js:25— kimi-profile.resolveKimiProfile 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.
outcomes-engine.sanitizeOutcome (cyclomatic 21) src/lib/outcomes-engine.js:37— outcomes-engine.sanitizeOutcome 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.
session-analytics.createCodexDeliverySignalCollector.consume (cyclomatic 21) src/lib/session-analytics.js:775— session-analytics.createCodexDeliverySignalCollector.consume 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.
skills-manager.listInstalledSkills (cyclomatic 21) src/lib/skills-manager.js:855— skills-manager.listInstalledSkills has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sync.repairZcodePruneWindowRestore (cyclomatic 21) src/commands/sync.js:5464— sync.repairZcodePruneWindowRestore 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.
doctor.buildRuntimeChecks (cyclomatic 21) src/lib/doctor.js:45— doctor.buildRuntimeChecks 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.
waffo.validateWaffoProduct (cyclomatic 21) REDACTED:167— waffo.validateWaffoProduct 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.
waffo.validateProviderOrder (cyclomatic 21) REDACTED:292— waffo.validateProviderOrder 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.
tokentracker-community-models.default (cyclomatic 21) dashboard/edge-patches/tokentracker-community-models.ts:56— tokentracker-community-models.default 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.
insforge-deployment-config.validateInsforgeDeployment (cyclomatic 21) dashboard/src/lib/insforge-deployment-config.mjs:16— insforge-deployment-config.validateInsforgeDeployment 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.
AccountViewContext.AccountViewProvider (cyclomatic 21) dashboard/src/contexts/AccountViewContext.jsx:37— AccountViewContext.AccountViewProvider has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 105, 61, 69, …). 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.
detail-sort.parseHourKey (cyclomatic 21) dashboard/src/lib/detail-sort.ts:75— detail-sort.parseHourKey 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.
model-breakdown.buildTopModels (cyclomatic 21) dashboard/src/lib/model-breakdown.ts:551— model-breakdown.buildTopModels has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DevicePage.DevicePage (cyclomatic 21) dashboard/src/pages/DevicePage.jsx:34— DevicePage.DevicePage has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (onSubmit, a function literal at line 39). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
DashboardWindowController.handleScriptMessage (cyclomatic 21) TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:565— DashboardWindowController.handleScriptMessage 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.
BotSpriteView.draw (cyclomatic 21) TokenTrackerBar/TokenTrackerBar/Views/BotSpriteView.swift:104— BotSpriteView.draw 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.
createCodexDeliverySignalCollector.consume (cyclomatic 21) src/lib/session-analytics.js:775— createCodexDeliverySignalCollector.consume 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.
commitOpencodeShards (cyclomatic 21) src/lib/cursor-store.js:759— commitOpencodeShards has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
QuotaWidgetWindow.ReceiveMessage (cyclomatic 20) TokenTrackerWin/QuotaWidgetWindow.cs:235— QuotaWidgetWindow.ReceiveMessage has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
rollout.collectCodexDominantModels (cyclomatic 20) REDACTED:4061— rollout.collectCodexDominantModels 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.
codex-config.readTomlArrayLiteral (cyclomatic 20) src/lib/codex-config.js:412— codex-config.readTomlArrayLiteral has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (scanChunk). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This shape REPEATS in the file: one other method here (codex-config.findTomlArrayBlockEnd) 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.
codex-config.findTomlArrayBlockEnd (cyclomatic 20) src/lib/codex-config.js:480— codex-config.findTomlArrayBlockEnd has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (scanChunk). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This shape REPEATS in the file: one other method here (codex-config.readTomlArrayLiteral) 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.
async-queue-reader.createAsyncQueueReader::load (cyclomatic 20) src/lib/async-queue-reader.js:34— async-queue-reader.createAsyncQueueReader::load 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.
grok-limits.fetchGrokLimits (cyclomatic 20) src/lib/grok-limits.js:790— grok-limits.fetchGrokLimits 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.
devin-limits.readDevinCredentials (cyclomatic 20) src/lib/devin-limits.js:55— devin-limits.readDevinCredentials 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.
qoder-limits.normalizeQoderRpcUsage (cyclomatic 20) src/lib/qoder-limits.js:279— qoder-limits.normalizeQoderRpcUsage 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.
usage-limits.codexSparkFallbackCandidates (cyclomatic 20) src/lib/usage-limits.js:571— usage-limits.codexSparkFallbackCandidates 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.
pi-session.listNestedJsonlSync::walk (cyclomatic 20) src/lib/pi-session.js:162— pi-session.listNestedJsonlSync::walk 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.
skills-manager.searchSkillsSh (cyclomatic 20) src/lib/skills-manager.js:1235— skills-manager.searchSkillsSh has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 1245). 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.
sync.reincludeClaudeMemObserverFiles (cyclomatic 20) src/commands/sync.js:7764— sync.reincludeClaudeMemObserverFiles has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
waffo.providerOrders (cyclomatic 20) REDACTED:246— waffo.providerOrders 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.
tokentracker-account-daily.getRowPricing (cyclomatic 20) dashboard/edge-patches/tokentracker-account-daily.ts:677— tokentracker-account-daily.getRowPricing 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.
tokentracker-account-model-breakdown.getRowPricing (cyclomatic 20) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:696— tokentracker-account-model-breakdown.getRowPricing 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.
tokentracker-account-summary.getRowPricing (cyclomatic 20) dashboard/edge-patches/tokentracker-account-summary.ts:663— tokentracker-account-summary.getRowPricing 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.
tokentracker-leaderboard-profile.getRowPricing (cyclomatic 20) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:635— tokentracker-leaderboard-profile.getRowPricing 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.
tokentracker-leaderboard-refresh.getRowPricing (cyclomatic 20) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:676— tokentracker-leaderboard-refresh.getRowPricing 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.
api.cachedAccountJsonGet (cyclomatic 20) dashboard/src/lib/api.ts:75— api.cachedAccountJsonGet has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 96). 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.
api.fetchLocalJson (cyclomatic 20) dashboard/src/lib/api.ts:183— api.fetchLocalJson has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AchievementBadge.AchievementBadge (cyclomatic 20) dashboard/src/ui/achievements/AchievementBadge.jsx:19— AchievementBadge.AchievementBadge 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.
LocalDataSection.LocalDataSection (cyclomatic 20) dashboard/src/components/settings/LocalDataSection.jsx:25— LocalDataSection.LocalDataSection has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to 8 function items inside it that branch. 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.
BotAnimated.BotAnimated (cyclomatic 20) dashboard/src/ui/foundation/BotAnimated.jsx:87— BotAnimated.BotAnimated has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CloudUsageExport.init (cyclomatic 20) TokenTrackerBar/Shared/CloudUsageExport.swift:13— CloudUsageExport.init 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.
PetCatalog.refresh (cyclomatic 20) TokenTrackerBar/TokenTrackerBar/Services/DesktopPetWindowController.swift:673— PetCatalog.refresh 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.
ResumableDownloader.urlSession (cyclomatic 20) TokenTrackerBar/TokenTrackerBar/Services/ResumableDownloader.swift:183— ResumableDownloader.urlSession 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.
LimitsSettingsView.providerIcon (cyclomatic 20) TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:147— LimitsSettingsView.providerIcon has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
aggregateHourlyByDay (cyclomatic 20) src/lib/local-api.js:742— aggregateHourlyByDay 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.
runSyncCommand (cyclomatic 20) src/lib/local-api.js:884— runSyncCommand has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 885, a function literal at line 927, (anonymous)::finish, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
openWorkbuddyIpc::(anonymous)::onPacket (cyclomatic 20) src/lib/workbuddy-ipc.js:123— openWorkbuddyIpc::(anonymous)::onPacket 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.
scopeSessionsToRange (cyclomatic 20) dashboard/src/lib/sessions-insights.js:5— scopeSessionsToRange has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 7, sum, a function literal at line 9, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ResumableDownloader.DownloadNextChunkAsync (cyclomatic 19) TokenTrackerWin/ResumableDownloader.cs:135— ResumableDownloader.DownloadNextChunkAsync 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.
native-qa-server.installFileAndProcessGuards (cyclomatic 19) TokenTrackerBar/scripts/native-qa-server.cjs:37— native-qa-server.installFileAndProcessGuards has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (allowed, a function literal at line 40, a function literal at line 57, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runtime-copy.copyRuntimeTree (cyclomatic 19) src/lib/runtime-copy.js:25— runtime-copy.copyRuntimeTree 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.
codex-model-attribution.applyCodexModelEvent (cyclomatic 19) src/lib/codex-model-attribution.js:80— codex-model-attribution.applyCodexModelEvent 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.
cursor-config.decodeCursorSandUsageStatus (cyclomatic 19) src/lib/cursor-config.js:327— cursor-config.decodeCursorSandUsageStatus 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.
rollout.resolveZcodeInstallPaths (cyclomatic 19) REDACTED:6124— rollout.resolveZcodeInstallPaths 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.
rollout.normalizeQoderNewTokens (cyclomatic 19) REDACTED:7165— rollout.normalizeQoderNewTokens 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.
rollout.readGrokUpdateTokenEvents (cyclomatic 19) REDACTED:21519— rollout.readGrokUpdateTokenEvents 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.
rollout.normalizeTraeCnSession (cyclomatic 19) REDACTED:24123— rollout.normalizeTraeCnSession 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.
openclaw-cli.resolveOpenclawCommand (cyclomatic 19) src/lib/openclaw-cli.js:18— openclaw-cli.resolveOpenclawCommand 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.
cloud-usage-reset.resetCloudDeviceUsage (cyclomatic 19) src/lib/cloud-usage-reset.js:55— cloud-usage-reset.resetCloudDeviceUsage has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cloud-device-token.resolveDeviceTokenPresence (cyclomatic 19) src/lib/cloud-device-token.js:96— cloud-device-token.resolveDeviceTokenPresence 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.
codex-rollout-parser.isConservativeRangeCandidate (cyclomatic 19) REDACTED:247— codex-rollout-parser.isConservativeRangeCandidate has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
opencode-status.parseOpenCodeStatusPayload (cyclomatic 19) src/lib/opencode-status.js:42— opencode-status.parseOpenCodeStatusPayload 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.
qoder-limits.normalizeQoderActivityResponse (cyclomatic 19) src/lib/qoder-limits.js:323— qoder-limits.normalizeQoderActivityResponse has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
dsh-session.discoverDshSessionFiles (cyclomatic 19) src/lib/dsh-session.js:183— dsh-session.discoverDshSessionFiles 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.
session-analytics.repriceSessionRecord (cyclomatic 19) src/lib/session-analytics.js:303— session-analytics.repriceSessionRecord 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.
local-api.buildCodexCategoryFallbackFromQueue (cyclomatic 19) src/lib/local-api.js:456— local-api.buildCodexCategoryFallbackFromQueue has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
Sidebar.MobileDrawer (cyclomatic 19) dashboard/src/ui/components/Sidebar.jsx:450— Sidebar.MobileDrawer has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 464, 490, 456, …). 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.
LeaderboardSummaryCard.LeaderboardMeChip (cyclomatic 19) dashboard/src/components/LeaderboardSummaryCard.jsx:34— LeaderboardSummaryCard.LeaderboardMeChip 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.
Badge3DCoin.Badge3DCoin (cyclomatic 19) dashboard/src/ui/achievements/Badge3DCoin.jsx:20— Badge3DCoin.Badge3DCoin has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 7 function items inside it that branch (onPointerMove, onPointerEnd, onKeyDown, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
LeaderboardProfilePage.LeaderboardProfilePage (cyclomatic 19) dashboard/src/pages/LeaderboardProfilePage.jsx:28— LeaderboardProfilePage.LeaderboardProfilePage has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
DashboardViewModel.loadMenuBarSummaries (cyclomatic 19) TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:597— DashboardViewModel.loadMenuBarSummaries 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.
DynamicIslandView.wingContent (cyclomatic 19) TokenTrackerBar/TokenTrackerBar/Views/DynamicIslandView.swift:344— DynamicIslandView.wingContent has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
scanForForkedCodexRollout (cyclomatic 19) src/commands/sync.js:6997— scanForForkedCodexRollout 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.
buildDailyAggregates (cyclomatic 19) src/lib/local-api.js:413— buildDailyAggregates 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.
ServerManager.StartServerOnceAsync (cyclomatic 18) TokenTrackerWin/ServerManager.cs:140— ServerManager.StartServerOnceAsync 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.
UsagePoller.FetchAsync (cyclomatic 18) TokenTrackerWin/UsagePoller.cs:226— UsagePoller.FetchAsync 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.
claude-user-identity.collectClaudeForkAliases (cyclomatic 18) src/lib/claude-user-identity.js:27— claude-user-identity.collectClaudeForkAliases 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.
rollout.readKiroCliRequests (cyclomatic 18) REDACTED:9537— rollout.readKiroCliRequests 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.
rollout.resolvePiSessionFiles (cyclomatic 18) REDACTED:17434— rollout.resolvePiSessionFiles has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.extractGrokTurnUsageEvents (cyclomatic 18) REDACTED:21470— rollout.extractGrokTurnUsageEvents 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.
rollout.resetAntigravityBucketsForRebuild (cyclomatic 18) REDACTED:22449— rollout.resetAntigravityBucketsForRebuild 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.
codex-config.parseTomlStringArray::parseString (cyclomatic 18) src/lib/codex-config.js:354— codex-config.parseTomlStringArray::parseString 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.
init.runSetup (cyclomatic 18) src/commands/init.js:357— init.runSetup 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.
codex-rollout-parser.iterateCodexObjects (cyclomatic 18) REDACTED:1450— codex-rollout-parser.iterateCodexObjects has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pet-packages.readWebpDimensions (cyclomatic 18) src/lib/pet-packages.js:86— pet-packages.readWebpDimensions 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.
usage-limits.normalizeCodexSparkRateWindows (cyclomatic 18) src/lib/usage-limits.js:601— usage-limits.normalizeCodexSparkRateWindows 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.
usage-limits.parseLinuxProcListeningPorts (cyclomatic 18) src/lib/usage-limits.js:3196— usage-limits.parseLinuxProcListeningPorts 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.
usage-limits.normalizeAntigravityQuotaSummary (cyclomatic 18) src/lib/usage-limits.js:3535— usage-limits.normalizeAntigravityQuotaSummary has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
usage-limits.persistAntigravityCredentials (cyclomatic 18) src/lib/usage-limits.js:3844— usage-limits.persistAntigravityCredentials 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.
proxy-env.applyUndiciProxyIfNeeded (cyclomatic 18) REDACTED:409— proxy-env.applyUndiciProxyIfNeeded 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.
skills-manager.scanPluginInventoryRoot::walk (cyclomatic 18) src/lib/skills-manager.js:390— skills-manager.scanPluginInventoryRoot::walk 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.
skills-manager.fetchPopularSkillsSh (cyclomatic 18) src/lib/skills-manager.js:1531— skills-manager.fetchPopularSkillsSh has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
auth.billingUserId (cyclomatic 18) dashboard/edge-patches/cloud/auth.ts:4— auth.billingUserId 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.
waffo.currentPeriod (cyclomatic 18) REDACTED:376— waffo.currentPeriod has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 381). 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.
format.formatUsdCurrency (cyclomatic 18) dashboard/src/lib/format.ts:174— format.formatUsdCurrency 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.
cloud-prompt-policy.publishCloudPromptBilling (cyclomatic 18) dashboard/src/lib/cloud-prompt-policy.js:56— cloud-prompt-policy.publishCloudPromptBilling 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.
UsageLimitsPanel.LimitBar (cyclomatic 18) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:190— UsageLimitsPanel.LimitBar has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UsageLimitsPanel.ZcodeResetBankSection (cyclomatic 18) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:720— UsageLimitsPanel.ZcodeResetBankSection has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
use-trend-data.getNowParts (cyclomatic 18) dashboard/src/hooks/use-trend-data.ts:782— use-trend-data.getNowParts has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TrendMonitor.TrendBar (cyclomatic 18) dashboard/src/ui/dashboard/components/TrendMonitor.jsx:212— TrendMonitor.TrendBar has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TrendMonitor.computeInterpolatedSeries (cyclomatic 18) dashboard/src/ui/dashboard/components/TrendMonitor.jsx:343— TrendMonitor.computeInterpolatedSeries 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.
SessionInsightsCard.SessionInsightsCard (cyclomatic 18) dashboard/src/ui/dashboard/components/SessionInsightsCard.jsx:51— SessionInsightsCard.SessionInsightsCard has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 5 function literals inside it that branch. 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.
build-share-card-data.buildShareCardData (cyclomatic 18) dashboard/src/ui/share/build-share-card-data.ts:87— build-share-card-data.buildShareCardData has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, 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.
AnnualReportCard.rebucket (cyclomatic 18) dashboard/src/ui/share/variants/AnnualReportCard.jsx:60— AnnualReportCard.rebucket has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SettingsPage.SettingsPage (cyclomatic 18) dashboard/src/pages/SettingsPage.jsx:58— SettingsPage.SettingsPage has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
IslandOnboardingCard.IslandOnboardingCard (cyclomatic 18) dashboard/src/ui/dashboard/components/IslandOnboardingCard.jsx:124— IslandOnboardingCard.IslandOnboardingCard has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
collectExpiringResourceCredits (cyclomatic 18) src/lib/workbuddy-limits.js:421— collectExpiringResourceCredits 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.
fetchAccountFunction (cyclomatic 18) src/lib/cloud-account.js:382— fetchAccountFunction 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.
normalizeCommandcodeWindow (cyclomatic 18) src/lib/commandcode-limits.js:134— normalizeCommandcodeWindow has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
ServerManager.StartHealthLoop (cyclomatic 17) TokenTrackerWin/ServerManager.cs:776— ServerManager.StartHealthLoop has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 790). 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.
cursor-config.parseCursorCsv (cyclomatic 17) src/lib/cursor-config.js:445— cursor-config.parseCursorCsv 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.
rollout.codebuddyJsonlHasUsage (cyclomatic 17) REDACTED:10656— rollout.codebuddyJsonlHasUsage 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.
rollout.scanOmpLikeTranscript (cyclomatic 17) REDACTED:16973— rollout.scanOmpLikeTranscript 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.
rollout.normalizeGrokSessionSnapshots (cyclomatic 17) REDACTED:21270— rollout.normalizeGrokSessionSnapshots 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.
rollout.resolveDshSessionFiles (cyclomatic 17) REDACTED:24568— rollout.resolveDshSessionFiles has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.findDshJsonProperty::valueEnd (cyclomatic 17) REDACTED:25105— rollout.findDshJsonProperty::valueEnd 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.
rollout.resolveCommandCodeSessionFiles (cyclomatic 17) REDACTED:25979— rollout.resolveCommandCodeSessionFiles 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.
openclaw-session-plugin.installOpenclawSessionPlugin (cyclomatic 17) src/lib/openclaw-session-plugin.js:37— openclaw-session-plugin.installOpenclawSessionPlugin 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.
machine-id.getOrCreateMachineId (cyclomatic 17) src/lib/machine-id.js:177— machine-id.getOrCreateMachineId 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.
cloud-account.accessTokenFromRefreshPayload (cyclomatic 17) src/lib/cloud-account.js:44— cloud-account.accessTokenFromRefreshPayload 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. This shape REPEATS in the file: one other method here (cloud-account.refreshTokenFromRefreshPayload) 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.
cloud-account.refreshTokenFromRefreshPayload (cyclomatic 17) src/lib/cloud-account.js:56— cloud-account.refreshTokenFromRefreshPayload 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. This shape REPEATS in the file: one other method here (cloud-account.accessTokenFromRefreshPayload) 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.
opencode-go-limits.scrapeOpencodeGoWeb (cyclomatic 17) REDACTED:655— opencode-go-limits.scrapeOpencodeGoWeb 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.
ark-coding-plan-limits.normalizeArkCodingPlanResponse (cyclomatic 17) src/lib/ark-coding-plan-limits.js:176— ark-coding-plan-limits.normalizeArkCodingPlanResponse 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.
ark-agent-plan-limits.normalizeArkAgentPlanResponse (cyclomatic 17) src/lib/ark-agent-plan-limits.js:151— ark-agent-plan-limits.normalizeArkAgentPlanResponse 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.
workbuddy-limits.fetchVariant (cyclomatic 17) src/lib/workbuddy-limits.js:845— workbuddy-limits.fetchVariant has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
usage-limits.describeCopilotOtelStatus (cyclomatic 17) src/lib/usage-limits.js:2258— usage-limits.describeCopilotOtelStatus 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.
session-analytics.normalizeModelUsageRows (cyclomatic 17) src/lib/session-analytics.js:224— session-analytics.normalizeModelUsageRows has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-analytics.analyticsEntryStatKey (cyclomatic 17) src/lib/session-analytics.js:2286— session-analytics.analyticsEntryStatKey has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
session-analytics.scopeSessionUsage (cyclomatic 17) src/lib/session-analytics.js:2715— session-analytics.scopeSessionUsage has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
local-api.createLocalApiHandler.handleLocalApi::aggregateEntries (cyclomatic 17) src/lib/local-api.js:3211— local-api.createLocalApiHandler.handleLocalApi::aggregateEntries 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. This shape REPEATS in the file: one other method here (local-api.createLocalApiHandler.handleLocalApi) 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.
sync.mergeCopilotAppDbStates (cyclomatic 17) src/commands/sync.js:434— sync.mergeCopilotAppDbStates 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.
status.formatSubscriptionLine (cyclomatic 17) src/commands/status.js:1587— status.formatSubscriptionLine 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.
tokentracker-device-flow-poll.default (cyclomatic 17) dashboard/edge-patches/tokentracker-device-flow-poll.ts:60— tokentracker-device-flow-poll.default 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.
tokentracker-leaderboard-refresh.verifiedClaimsFromJwt (cyclomatic 17) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:48— tokentracker-leaderboard-refresh.verifiedClaimsFromJwt 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.
tokentracker-telemetry.default (cyclomatic 17) dashboard/edge-patches/tokentracker-telemetry.ts:37— tokentracker-telemetry.default 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.
api.fetchAccountFunction (cyclomatic 17) dashboard/src/lib/api.ts:917— api.fetchAccountFunction has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InsforgeAuthContext.pickDisplayNameFromUser (cyclomatic 17) dashboard/src/contexts/InsforgeAuthContext.jsx:25— InsforgeAuthContext.pickDisplayNameFromUser 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.
InsforgeAuthContext.accessTokenFromRefreshPayload (cyclomatic 17) dashboard/src/contexts/InsforgeAuthContext.jsx:38— InsforgeAuthContext.accessTokenFromRefreshPayload 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.
use-cloud-usage-sync.useCloudUsageSync (cyclomatic 17) dashboard/src/hooks/use-cloud-usage-sync.ts:22— use-cloud-usage-sync.useCloudUsageSync has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 42, 34, 61). 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.
UsageLimitsPanel.renderConfiguredProvider (cyclomatic 17) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1008— UsageLimitsPanel.renderConfiguredProvider 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.
use-activity-heatmap.useActivityHeatmap (cyclomatic 17) dashboard/src/hooks/use-activity-heatmap.ts:18— use-activity-heatmap.useActivityHeatmap has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 354, 124). 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.
ContextBreakdownPanel.normalizeExecRows (cyclomatic 17) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:323— ContextBreakdownPanel.normalizeExecRows has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 325, 349). 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.
AccountSectionUtils.pickDisplayName (cyclomatic 17) dashboard/src/components/settings/AccountSectionUtils.js:1— AccountSectionUtils.pickDisplayName 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.
sentry.isBenignBrowserNetworkNoise (cyclomatic 17) dashboard/src/lib/sentry.js:119— sentry.isBenignBrowserNetworkNoise 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.
NativeQAProfile.load (cyclomatic 17) TokenTrackerBar/Shared/NativeQAProfile.swift:76— NativeQAProfile.load 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.
UsageLimitsView.brandIcon (cyclomatic 17) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1241— UsageLimitsView.brandIcon 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.
handleLocalApi::aggregateByDay (cyclomatic 17) REDACTED:622— handleLocalApi::aggregateByDay 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.
normalizeQuotaSummary (cyclomatic 17) src/lib/qoder-limits.js:91— normalizeQuotaSummary 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.
withLimitsCacheFallback (cyclomatic 17) src/lib/limits-cache.js:406— withLimitsCacheFallback 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.
resolveInstallPaths (cyclomatic 17) src/lib/install-resolver.js:19— resolveInstallPaths has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function items inside it that branch. 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.
ServerManager.StartTrackerProcess (cyclomatic 16) TokenTrackerWin/ServerManager.cs:677— ServerManager.StartTrackerProcess has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TokenTrackerIndicator._refreshOnce (cyclomatic 16) TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:1089— TokenTrackerIndicator._refreshOnce 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.
claude-backend.captureClaudeBackend (cyclomatic 16) src/lib/claude-backend.js:35— claude-backend.captureClaudeBackend 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.
sqlite-reader.readSqliteJsonRows (cyclomatic 16) src/lib/sqlite-reader.js:81— sqlite-reader.readSqliteJsonRows has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (sqlite-reader.readSqliteJsonRowsAsync) 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.
sqlite-reader.readSqliteJsonRowsAsync (cyclomatic 16) src/lib/sqlite-reader.js:148— sqlite-reader.readSqliteJsonRowsAsync has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (sqlite-reader.readSqliteJsonRows) 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.
cursor-login.createCursorLogin.finishPoll (cyclomatic 16) src/lib/cursor-login.js:82— cursor-login.createCursorLogin.finishPoll has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rollout.enqueueTouchedProjectBuckets (cyclomatic 16) REDACTED:3983— rollout.enqueueTouchedProjectBuckets 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.
rollout.resolveKiroCliSessionFiles (cyclomatic 16) REDACTED:8875— rollout.resolveKiroCliSessionFiles 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.
rollout.museResumeLooksAppendOnly (cyclomatic 16) REDACTED:18465— rollout.museResumeLooksAppendOnly 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.
rollout.resolveCopilotOtelPaths (cyclomatic 16) REDACTED:18971— rollout.resolveCopilotOtelPaths has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
rollout.copilotOtelCursorHasLegacyCliUsage (cyclomatic 16) REDACTED:19501— rollout.copilotOtelCursorHasLegacyCliUsage 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.
rollout.retractStaleSourceQueueRows (cyclomatic 16) REDACTED:21652— rollout.retractStaleSourceQueueRows 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.
rollout.readAntigravityConversationDb (cyclomatic 16) REDACTED:23249— rollout.readAntigravityConversationDb 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.
rollout.readDshSessionSnapshot (cyclomatic 16) REDACTED:24985— rollout.readDshSessionSnapshot 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.
init.cmdInit (cyclomatic 16) src/commands/init.js:172— init.cmdInit 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.
cloud-usage-reset.finishCloudDeviceUsageReset (cyclomatic 16) src/lib/cloud-usage-reset.js:97— cloud-usage-reset.finishCloudDeviceUsageReset has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
claude-categorizer.categorizeSessionFile (cyclomatic 16) src/lib/claude-categorizer.js:498— claude-categorizer.categorizeSessionFile 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.
cursor-store.openCursorStore (cyclomatic 16) src/lib/cursor-store.js:25— cursor-store.openCursorStore 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.
codex-context-breakdown.selectAppendHashPaths (cyclomatic 16) src/lib/codex-context-breakdown.js:240— codex-context-breakdown.selectAppendHashPaths 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.
pet-packages.importFromCodex (cyclomatic 16) src/lib/pet-packages.js:656— pet-packages.importFromCodex has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
grok-limits.loadGrokAuthEntry (cyclomatic 16) src/lib/grok-limits.js:187— grok-limits.loadGrokAuthEntry 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.
qoder-limits.readQoderActivityCache (cyclomatic 16) src/lib/qoder-limits.js:363— qoder-limits.readQoderActivityCache 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.
qoder-limits.parseQoderAccountUsageLog (cyclomatic 16) src/lib/qoder-limits.js:675— qoder-limits.parseQoderAccountUsageLog 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.
workbuddy-limits.readWorkbuddyLimitsCache (cyclomatic 16) src/lib/workbuddy-limits.js:600— workbuddy-limits.readWorkbuddyLimitsCache 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.
usage-limits.extractClaudeScopedWeekly (cyclomatic 16) src/lib/usage-limits.js:387— usage-limits.extractClaudeScopedWeekly 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.
usage-limits.fetchCopilotLimits (cyclomatic 16) src/lib/usage-limits.js:2292— usage-limits.fetchCopilotLimits 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.
pi-session.discoverPiSessionFiles (cyclomatic 16) src/lib/pi-session.js:385— pi-session.discoverPiSessionFiles 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.
sync.isCodexHistoryCovered (cyclomatic 16) src/commands/sync.js:6966— sync.isCodexHistoryCovered 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.
wechat.normalizeWechatEvent (cyclomatic 16) dashboard/edge-patches/cloud/wechat.ts:243— wechat.normalizeWechatEvent 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.
waffo.createWaffoCheckout (cyclomatic 16) REDACTED:191— waffo.createWaffoCheckout 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.
runtime.rpc (cyclomatic 16) dashboard/edge-patches/cloud/runtime.ts:120— runtime.rpc 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: runtime.configuredProviders (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.
tokentracker-account-daily.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-daily.ts:82— tokentracker-account-daily.verifiedUserIdFromJwt 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.
tokentracker-account-devices.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-devices.ts:36— tokentracker-account-devices.verifiedUserIdFromJwt 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.
tokentracker-account-heatmap.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-heatmap.ts:79— tokentracker-account-heatmap.verifiedUserIdFromJwt 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.
tokentracker-account-hourly.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-hourly.ts:37— tokentracker-account-hourly.verifiedUserIdFromJwt 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.
tokentracker-account-model-breakdown.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:124— tokentracker-account-model-breakdown.verifiedUserIdFromJwt 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.
tokentracker-account-monthly.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-monthly.ts:37— tokentracker-account-monthly.verifiedUserIdFromJwt 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.
tokentracker-account-summary.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-account-summary.ts:90— tokentracker-account-summary.verifiedUserIdFromJwt 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.
tokentracker-device-rename.verifiedUserIdFromJwt (cyclomatic 16) dashboard/edge-patches/tokentracker-device-rename.ts:50— tokentracker-device-rename.verifiedUserIdFromJwt 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.
tokentracker-embed-svg.default (cyclomatic 16) dashboard/edge-patches/tokentracker-embed-svg.ts:1187— tokentracker-embed-svg.default 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.
tokentracker-user-badges-refresh.default (cyclomatic 16) dashboard/edge-patches/tokentracker-user-badges-refresh.ts:72— tokentracker-user-badges-refresh.default 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.
cloud-prompt-policy.readDismissal (cyclomatic 16) dashboard/src/lib/cloud-prompt-policy.js:111— cloud-prompt-policy.readDismissal 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.
ContextBreakdownPanel.Row (cyclomatic 16) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:399— ContextBreakdownPanel.Row 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.
ContextBreakdownPanel.ExecDrillDown (cyclomatic 16) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:516— ContextBreakdownPanel.ExecDrillDown has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 574, 529). 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.
UsageOverview.ProviderExpandedSection (cyclomatic 16) dashboard/src/ui/dashboard/components/UsageOverview.jsx:1048— UsageOverview.ProviderExpandedSection 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.
CountUp.CountUp (cyclomatic 16) dashboard/src/ui/components/CountUp.jsx:19— CountUp.CountUp has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 54, 70, 37). 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.
RedeemProCode.RedeemProCode::perform (cyclomatic 16) dashboard/src/components/cloud/RedeemProCode.jsx:65— RedeemProCode.RedeemProCode::perform 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 shape REPEATS in the file: one other method here (RedeemProCode.RedeemProCode) 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.
CloudSection.CloudRebuildControl (cyclomatic 16) dashboard/src/components/settings/CloudSection.jsx:75— CloudSection.CloudRebuildControl has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (rebuild). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-proxy-settings.useProxySettings.save (cyclomatic 16) dashboard/src/hooks/use-proxy-settings.js:91— use-proxy-settings.useProxySettings.save 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.
eyefit.resous (cyclomatic 16) dashboard/src/lib/bot/eyefit.ts:242— eyefit.resous has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pet-linux-host.buildTopModels (cyclomatic 16) dashboard/src/lib/pet-linux-host.js:52— pet-linux-host.buildTopModels has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UpdateChecker.startDownloadAndInstall (cyclomatic 16) TokenTrackerBar/TokenTrackerBar/Services/UpdateChecker.swift:256— UpdateChecker.startDownloadAndInstall 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.
extractGeminiOauthClientCredentials (cyclomatic 16) src/lib/usage-limits.js:1241— extractGeminiOauthClientCredentials 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.
startLocalCallbackServer (cyclomatic 16) src/lib/browser-auth.js:29— startLocalCallbackServer has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 39, 119, 34, …). 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.
aggregateSessionStates (cyclomatic 16) src/lib/account-usage-dedup.js:147— aggregateSessionStates has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dead code: DWMSBT_MAINWINDOW TokenTrackerWin/DashboardWindow.cs:1229— Field DWMSBT_MAINWINDOW — Roslyn's SymbolFinder walked every project the solution loads, including TokenTrackerWin, and found no reference to it. That walk cannot see three kinds of caller, so check them before removing it: code outside the solution file (a solution is a curated list, not the repository — a sibling test tree with its own .sln is invisible), a call resolved by reflection or dependency injection from the symbol's name, and any project the workspace could not load. This is 'no caller found by this walk', not a verdict that the symbol is unused.
cmdSync (cognitive 1298) src/commands/sync.js:553— cmdSync has cognitive complexity 1298 (threshold 15). Drivers by points: if/else 308 (598 pts), boolean chains 252, ternaries 129 (231 pts), error handling 71 (173 pts), loops 22 (44 pts) (nesting depth added 516). Of this number, 1096 points are the body's own statements and 202 belong to 88 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.createLocalApiHandler.handleLocalApi (cognitive 1041) src/lib/local-api.js:1886— local-api.createLocalApiHandler.handleLocalApi has cognitive complexity 1041 (threshold 15). Drivers by points: if/else 283 (641 pts), boolean chains 300, error handling 42 (99 pts), ternaries 31 (76 pts), loops 15 (40 pts), match/switch 1 (2 pts) (nesting depth added 486). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the 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 (local-api.createLocalApiHandler.handleLocalApi::aggregateEntries) 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.
status.cmdStatus (cognitive 536) src/commands/status.js:198— status.cmdStatus has cognitive complexity 536 (threshold 15). Drivers by points: ternaries 219 (339 pts), boolean chains 128, if/else 30 (46 pts), error handling 10 (15 pts), loops 7 (8 pts) (nesting depth added 142). Of this number, 509 points are the body's own statements and 27 belong to 17 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashboardPage.DashboardPage (cognitive 333) dashboard/src/pages/DashboardPage.jsx:132— DashboardPage.DashboardPage has cognitive complexity 333 (threshold 15). Drivers by points: if/else 118 (139 pts), boolean chains 95, ternaries 67 (81 pts), loops 8 (13 pts), error handling 5 (nesting depth added 40). Of this number, 53 points are the body's own statements and 280 belong to 79 function items inside it that branch. 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.
rollout.parseWorkbuddyIncremental (cognitive 320) REDACTED:11601— rollout.parseWorkbuddyIncremental has cognitive complexity 320 (threshold 15). Drivers by points: ternaries 59 (125 pts), if/else 43 (101 pts), boolean chains 79, error handling 4 (9 pts), loops 4 (6 pts) (nesting depth added 131). Of this number, 209 points are the body's own statements and 111 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
IpCheckPage.IpCheckPage (cognitive 312) REDACTED:169— IpCheckPage.IpCheckPage has cognitive complexity 312 (threshold 15). Drivers by points: if/else 122 (153 pts), boolean chains 73, ternaries 31 (59 pts), error handling 18 (21 pts), loops 5 (6 pts) (nesting depth added 63). Most of this is not in the body itself: 1 of the 312 points is its own statement and the rest belongs to 38 function literals inside it that branch (lines 821, 465, 643, …). 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.
rollout.parseAntigravityIncremental (cognitive 297) REDACTED:22484— rollout.parseAntigravityIncremental has cognitive complexity 297 (threshold 15). Drivers by points: if/else 46 (118 pts), boolean chains 90, ternaries 31 (56 pts), loops 12 (33 pts) (nesting depth added 118). Of this number, 296 points are the body's own statements and 1 belongs 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.
SkillsPage.SkillsPage (cognitive 275) REDACTED:836— SkillsPage.SkillsPage has cognitive complexity 275 (threshold 15). Drivers by points: boolean chains 113, if/else 83 (94 pts), ternaries 32 (56 pts), error handling 7 (8 pts), loops 4 (nesting depth added 36). Of this number, 83 points are the body's own statements and 192 belong to 66 function items inside it that branch. 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.
fetchUsageLimitsUncached (cognitive 260) src/lib/usage-limits.js:4478— fetchUsageLimitsUncached has cognitive complexity 260 (threshold 15). Drivers by points: ternaries 52 (90 pts), boolean chains 73, if/else 45 (63 pts), error handling 16 (29 pts), other 4, loops 1 (nesting depth added 69). Of this number, 225 points are the body's own statements and 35 belong to 54 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseGrokBuildIncremental (cognitive 238) REDACTED:21746— rollout.parseGrokBuildIncremental has cognitive complexity 238 (threshold 15). Drivers by points: if/else 35 (112 pts), boolean chains 62, ternaries 19 (35 pts), loops 9 (29 pts) (nesting depth added 113). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.parseDshIncremental (cognitive 238) REDACTED:25411— rollout.parseDshIncremental has cognitive complexity 238 (threshold 15). Drivers by points: if/else 52 (115 pts), boolean chains 75, ternaries 17 (34 pts), loops 10 (12 pts), error handling 1 (2 pts) (nesting depth added 83). Of this number, 218 points are the body's own statements and 20 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseCodebuddyIncremental (cognitive 232) REDACTED:10876— rollout.parseCodebuddyIncremental has cognitive complexity 232 (threshold 15). Drivers by points: if/else 31 (124 pts), ternaries 22 (56 pts), boolean chains 35, error handling 5 (14 pts), loops 2 (3 pts) (nesting depth added 137). Of this number, 225 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.enqueueTouchedBuckets (cognitive 230) REDACTED:3598— rollout.enqueueTouchedBuckets has cognitive complexity 230 (threshold 15). Drivers by points: if/else 50 (132 pts), boolean chains 42, ternaries 12 (34 pts), loops 11 (22 pts) (nesting depth added 115). Of this number, 223 points are the body's own statements and 7 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.
readKimiSessions (cognitive 228) src/lib/kimi-session.js:81— readKimiSessions has cognitive complexity 228 (threshold 15). Drivers by points: if/else 24 (96 pts), ternaries 19 (73 pts), boolean chains 32, loops 7 (21 pts), error handling 1 (4 pts), other 2 (nesting depth added 143). Of this number, 220 points are the body's own statements and 8 belong to 10 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readOmpSessionFiles (cognitive 225) src/lib/omp-session.js:233— readOmpSessionFiles has cognitive complexity 225 (threshold 15). Drivers by points: if/else 32 (139 pts), boolean chains 33, ternaries 8 (26 pts), loops 6 (16 pts), error handling 3 (10 pts), other 1 (nesting depth added 142). Of this number, 221 points are the body's own statements and 4 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readPiSessionFiles (cognitive 224) src/lib/pi-session.js:441— readPiSessionFiles has cognitive complexity 224 (threshold 15). Drivers by points: if/else 36 (144 pts), ternaries 9 (28 pts), boolean chains 26, loops 6 (15 pts), error handling 3 (10 pts), other 1 (nesting depth added 143). Of this number, 215 points are the body's own statements and 9 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudCheckoutPage.CloudCheckoutPage (cognitive 217) dashboard/src/pages/CloudCheckoutPage.jsx:49— CloudCheckoutPage.CloudCheckoutPage has cognitive complexity 217 (threshold 15). Drivers by points: boolean chains 94, if/else 62 (77 pts), ternaries 32 (43 pts), error handling 3 (nesting depth added 26). Of this number, 109 points are the body's own statements and 108 belong to 17 function items inside it that branch. 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.
rollout.parsePiLikeIncremental (cognitive 215) REDACTED:17582— rollout.parsePiLikeIncremental has cognitive complexity 215 (threshold 15). Drivers by points: if/else 31 (96 pts), ternaries 20 (43 pts), boolean chains 38, error handling 8 (24 pts), loops 7 (14 pts) (nesting depth added 111). Of this number, 208 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
codex-rollout-parser.parseCodexRolloutFile (cognitive 213) REDACTED:590— codex-rollout-parser.parseCodexRolloutFile has cognitive complexity 213 (threshold 15). Drivers by points: if/else 68 (138 pts), boolean chains 91, ternaries 41 (49 pts), loops 6 (10 pts), error handling 1 (3 pts) (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (codex-rollout-parser.parseCodexRolloutFile::recordModelUsage, codex-rollout-parser.parseCodexRolloutFile::getExecKeys, codex-rollout-parser.parseCodexRolloutFile::attributeTurn) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
rollout.parseRolloutIncremental (cognitive 200) REDACTED:325— rollout.parseRolloutIncremental has cognitive complexity 200 (threshold 15). Drivers by points: if/else 46 (71 pts), ternaries 38 (65 pts), boolean chains 55, loops 6 (9 pts) (nesting depth added 55). Of this number, 145 points are the body's own statements and 55 belong to 10 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseCopilotSessionStoreIncremental (cognitive 181) REDACTED:20241— rollout.parseCopilotSessionStoreIncremental has cognitive complexity 181 (threshold 15). Drivers by points: if/else 32 (96 pts), boolean chains 44, ternaries 17 (30 pts), loops 5 (9 pts), error handling 1 (2 pts) (nesting depth added 82). Of this number, 180 points are the body's own statements and 1 belongs 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.
rollout.parseRolloutRecords (cognitive 178) REDACTED:2561— rollout.parseRolloutRecords has cognitive complexity 178 (threshold 15). Drivers by points: if/else 48 (110 pts), boolean chains 45, ternaries 9 (12 pts), error handling 3 (10 pts), loops 1 (nesting depth added 72). Of this number, 170 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handleLocalApi (cognitive 177) REDACTED:528— handleLocalApi has cognitive complexity 177 (threshold 15). Drivers by points: boolean chains 102, if/else 49 (93 pts), loops 13 (27 pts), error handling 8 (14 pts), ternaries 5 (7 pts), other 3 (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
repairCodexRescanInflation (cognitive 163) src/commands/sync.js:6291— repairCodexRescanInflation has cognitive complexity 163 (threshold 15). Drivers by points: if/else 38 (79 pts), boolean chains 25, loops 15 (22 pts), error handling 11 (21 pts), ternaries 9 (16 pts) (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-billing.billing (cognitive 160) dashboard/edge-patches/tokentracker-billing.ts:36— tokentracker-billing.billing has cognitive complexity 160 (threshold 15). Drivers by points: if/else 55 (97 pts), boolean chains 33, ternaries 11 (21 pts), loops 2 (6 pts), error handling 2 (3 pts) (nesting depth added 57). Of this number, 154 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildSessionAnalyticsInternal (cognitive 160) src/lib/session-analytics.js:2387— buildSessionAnalyticsInternal has cognitive complexity 160 (threshold 15). Drivers by points: if/else 37 (91 pts), boolean chains 30, ternaries 16 (30 pts), error handling 3 (6 pts), loops 2 (3 pts) (nesting depth added 72). Of this number, 152 points are the body's own statements and 8 belong to 15 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionsPage.SessionsPage (cognitive 155) dashboard/src/pages/SessionsPage.jsx:435— SessionsPage.SessionsPage has cognitive complexity 155 (threshold 15). Drivers by points: ternaries 27 (63 pts), if/else 38 (48 pts), boolean chains 38, loops 4 (5 pts), error handling 1 (nesting depth added 47). Of this number, 49 points are the body's own statements and 106 belong to 19 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseDroidIncremental (cognitive 153) REDACTED:16393— rollout.parseDroidIncremental has cognitive complexity 153 (threshold 15). Drivers by points: if/else 26 (58 pts), ternaries 24 (58 pts), boolean chains 26, error handling 3 (6 pts), loops 3 (5 pts) (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
native-qa-server.createNativeQAServer.server (cognitive 150) TokenTrackerBar/scripts/native-qa-server.cjs:112— native-qa-server.createNativeQAServer.server has cognitive complexity 150 (threshold 15). Drivers by points: if/else 38 (91 pts), boolean chains 46, ternaries 2 (6 pts), error handling 2 (4 pts), loops 1 (3 pts) (nesting depth added 61). Of this number, 132 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.parseQoderNewIncremental (cognitive 147) REDACTED:7229— rollout.parseQoderNewIncremental has cognitive complexity 147 (threshold 15). Drivers by points: if/else 32 (85 pts), boolean chains 24, ternaries 11 (22 pts), loops 6 (11 pts), error handling 2 (5 pts) (nesting depth added 72). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
buildZcodeSessionRecords (cognitive 146) src/lib/session-analytics.js:1542— buildZcodeSessionRecords has cognitive complexity 146 (threshold 15). Drivers by points: if/else 29 (69 pts), boolean chains 39, ternaries 14 (28 pts), loops 8 (10 pts) (nesting depth added 56). Of this number, 137 points are the body's own statements and 9 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex-context-breakdown.computeCodexContextBreakdown (cognitive 144) src/lib/codex-context-breakdown.js:382— codex-context-breakdown.computeCodexContextBreakdown has cognitive complexity 144 (threshold 15). Drivers by points: if/else 19 (53 pts), boolean chains 49, ternaries 12 (25 pts), error handling 3 (12 pts), loops 5 (nesting depth added 56). Of this number, 130 points are the body's own statements and 14 belong to 12 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.parseClaudeIncremental (cognitive 142) REDACTED:1056— rollout.parseClaudeIncremental has cognitive complexity 142 (threshold 15). Drivers by points: if/else 27 (59 pts), boolean chains 40, ternaries 24 (38 pts), loops 5 (nesting depth added 46). Of this number, 139 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-leaderboard-refresh.default (cognitive 136) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1048— tokentracker-leaderboard-refresh.default has cognitive complexity 136 (threshold 15). Drivers by points: if/else 33 (62 pts), ternaries 16 (31 pts), loops 8 (19 pts), boolean chains 18, error handling 3 (6 pts) (nesting depth added 58). Of this number, 129 points are the body's own statements and 7 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.
rollout.parseAntigravityFile (cognitive 131) REDACTED:23304— rollout.parseAntigravityFile has cognitive complexity 131 (threshold 15). Drivers by points: if/else 30 (66 pts), ternaries 21 (35 pts), boolean chains 27, error handling 1 (2 pts), loops 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-account-daily.getModelPricing (cognitive 129) dashboard/edge-patches/tokentracker-account-daily.ts:487— tokentracker-account-daily.getModelPricing has cognitive complexity 129 (threshold 15). Drivers by points: if/else 113 (115 pts), boolean chains 14 (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.
tokentracker-account-model-breakdown.getModelPricing (cognitive 129) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:506— tokentracker-account-model-breakdown.getModelPricing has cognitive complexity 129 (threshold 15). Drivers by points: if/else 113 (115 pts), boolean chains 14 (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.
tokentracker-account-summary.getModelPricing (cognitive 129) dashboard/edge-patches/tokentracker-account-summary.ts:473— tokentracker-account-summary.getModelPricing has cognitive complexity 129 (threshold 15). Drivers by points: if/else 113 (115 pts), boolean chains 14 (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.
tokentracker-leaderboard-profile.getModelPricing (cognitive 129) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:445— tokentracker-leaderboard-profile.getModelPricing has cognitive complexity 129 (threshold 15). Drivers by points: if/else 113 (115 pts), boolean chains 14 (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.
tokentracker-leaderboard-refresh.getModelPricing (cognitive 129) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:486— tokentracker-leaderboard-refresh.getModelPricing has cognitive complexity 129 (threshold 15). Drivers by points: if/else 113 (115 pts), boolean chains 14 (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.
session-analytics.scanClaudeSession (cognitive 128) src/lib/session-analytics.js:563— session-analytics.scanClaudeSession has cognitive complexity 128 (threshold 15). Drivers by points: if/else 22 (70 pts), boolean chains 29, ternaries 5 (16 pts), loops 4 (8 pts), error handling 2 (5 pts) (nesting depth added 66). Of this number, 124 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseClineIncremental (cognitive 121) REDACTED:13183— rollout.parseClineIncremental has cognitive complexity 121 (threshold 15). Drivers by points: if/else 25 (63 pts), boolean chains 23, ternaries 12 (22 pts), loops 6 (7 pts), error handling 3 (6 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseOpenclawIncremental (cognitive 120) REDACTED:1761— rollout.parseOpenclawIncremental has cognitive complexity 120 (threshold 15). Drivers by points: if/else 14 (40 pts), ternaries 18 (37 pts), boolean chains 24, loops 7 (19 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init.applyIntegrationSetup (cognitive 118) src/commands/init.js:679— init.applyIntegrationSetup has cognitive complexity 118 (threshold 15). Drivers by points: if/else 54 (59 pts), ternaries 19 (39 pts), boolean chains 18, error handling 1, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudMembershipCard.CloudMembershipAccount (cognitive 110) dashboard/src/components/cloud/CloudMembershipCard.jsx:472— CloudMembershipCard.CloudMembershipAccount has cognitive complexity 110 (threshold 15). Drivers by points: ternaries 39 (77 pts), boolean chains 24, if/else 7 (8 pts), error handling 1 (nesting depth added 39). Of this number, 88 points are the body's own statements and 22 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-categorizer.computeClaudeGroundTruthBuckets (cognitive 107) src/lib/claude-categorizer.js:1193— claude-categorizer.computeClaudeGroundTruthBuckets has cognitive complexity 107 (threshold 15). Drivers by points: if/else 15 (59 pts), ternaries 5 (21 pts), boolean chains 10, error handling 3 (9 pts), loops 6 (8 pts) (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
session-analytics.scanGrokSession (cognitive 106) src/lib/session-analytics.js:1042— session-analytics.scanGrokSession has cognitive complexity 106 (threshold 15). Drivers by points: if/else 23 (53 pts), boolean chains 30, ternaries 13 (20 pts), error handling 1 (2 pts), loops 1 (nesting depth added 38). Of this number, 101 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.parseCopilotIncremental (cognitive 105) REDACTED:19540— rollout.parseCopilotIncremental has cognitive complexity 105 (threshold 15). Drivers by points: if/else 23 (62 pts), boolean chains 21, error handling 4 (9 pts), ternaries 7 (8 pts), loops 3 (5 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.
ActivityHeatmap3D.ActivityHeatmap3D (cognitive 102) REDACTED:81— ActivityHeatmap3D.ActivityHeatmap3D has cognitive complexity 102 (threshold 15). Drivers by points: if/else 42 (46 pts), ternaries 20 (28 pts), boolean chains 23, error handling 1 (3 pts), loops 2 (nesting depth added 14). Of this number, 28 points are the body's own statements and 74 belong to 30 function items inside it that branch. 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.
LeaderboardPage.LeaderboardPage (cognitive 102) dashboard/src/pages/LeaderboardPage.jsx:479— LeaderboardPage.LeaderboardPage has cognitive complexity 102 (threshold 15). Drivers by points: boolean chains 47, if/else 34, ternaries 15 (18 pts), error handling 2, loops 1 (nesting depth added 3). Of this number, 49 points are the body's own statements and 53 belong to 26 function items inside it that branch. 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.
CloudPage.CloudPlanView (cognitive 102) dashboard/src/pages/CloudPage.jsx:58— CloudPage.CloudPlanView has cognitive complexity 102 (threshold 15). Drivers by points: ternaries 41 (55 pts), boolean chains 41, if/else 6 (nesting depth added 14). Of this number, 87 points are the body's own statements and 15 belong to 8 function items inside it that branch. 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.
waffo-processing.reconcileWaffoOrder (cognitive 101) dashboard/edge-patches/cloud/waffo-processing.ts:7— waffo-processing.reconcileWaffoOrder has cognitive complexity 101 (threshold 15). Drivers by points: if/else 20 (47 pts), boolean chains 27, ternaries 8 (21 pts), loops 6 (nesting depth added 40). Of this number, 96 points are the body's own statements and 5 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
tokentracker-leaderboard-profile.default (cognitive 101) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:898— tokentracker-leaderboard-profile.default has cognitive complexity 101 (threshold 15). Drivers by points: if/else 23 (43 pts), boolean chains 31, ternaries 14 (17 pts), loops 6 (9 pts), error handling 1 (nesting depth added 26). Of this number, 100 points are the body's own statements and 1 belongs 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.
rollout.parseKiroCliIncremental (cognitive 100) REDACTED:9596— rollout.parseKiroCliIncremental has cognitive complexity 100 (threshold 15). Drivers by points: if/else 27 (58 pts), boolean chains 28, loops 6 (9 pts), ternaries 5 (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.
App.App (cognitive 100) dashboard/src/App.jsx:115— App.App has cognitive complexity 100 (threshold 15). Drivers by points: if/else 43 (44 pts), boolean chains 32, ternaries 12 (21 pts), loops 1 (2 pts), error handling 1 (nesting depth added 11). Of this number, 72 points are the body's own statements and 28 belong to 7 function literals inside it that branch. 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.
rollout.parseOpencodeDbIncremental (cognitive 98) REDACTED:6282— rollout.parseOpencodeDbIncremental has cognitive complexity 98 (threshold 15). Drivers by points: if/else 22 (45 pts), ternaries 17 (27 pts), boolean chains 24, loops 2 (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.
rollout.parseLmstudioIncremental (cognitive 97) REDACTED:14250— rollout.parseLmstudioIncremental has cognitive complexity 97 (threshold 15). Drivers by points: if/else 15 (40 pts), boolean chains 17, loops 8 (17 pts), ternaries 9 (15 pts), error handling 3 (8 pts) (nesting depth added 45). Of this number, 96 points are the body's own statements and 1 belongs 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.
session-analytics.scanOpencodeSessions (cognitive 97) src/lib/session-analytics.js:1276— session-analytics.scanOpencodeSessions has cognitive complexity 97 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 22, ternaries 8 (14 pts), loops 10 (13 pts), error handling 1 (3 pts) (nesting depth added 35). Of this number, 90 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseKimiCodeIncremental (cognitive 96) REDACTED:10433— rollout.parseKimiCodeIncremental has cognitive complexity 96 (threshold 15). Drivers by points: if/else 16 (43 pts), ternaries 10 (21 pts), boolean chains 20, error handling 4 (9 pts), loops 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.
rollout.parseOmpLikeIncremental (cognitive 96) REDACTED:17016— rollout.parseOmpLikeIncremental has cognitive complexity 96 (threshold 15). Drivers by points: boolean chains 30, if/else 15 (29 pts), ternaries 21 (29 pts), error handling 2 (5 pts), loops 2 (3 pts) (nesting depth added 26). Of this number, 67 points are the body's own statements and 29 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseMuseIncremental (cognitive 96) REDACTED:18508— rollout.parseMuseIncremental has cognitive complexity 96 (threshold 15). Drivers by points: if/else 28 (49 pts), boolean chains 31, error handling 7 (19 pts), ternaries 13 (19 pts), loops 6 (15 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rollout.parseMuseIncremental::handleRecord) 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.
uninstall.cmdUninstall (cognitive 95) src/commands/uninstall.js:33— uninstall.cmdUninstall has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 47 (88 pts), boolean chains 6, if/else 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseDevinIncremental (cognitive 91) REDACTED:15463— rollout.parseDevinIncremental has cognitive complexity 91 (threshold 15). Drivers by points: if/else 17 (36 pts), ternaries 15 (27 pts), boolean chains 26, loops 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseClaudeFile (cognitive 90) REDACTED:3131— rollout.parseClaudeFile has cognitive complexity 90 (threshold 15). Drivers by points: if/else 19 (50 pts), ternaries 5 (21 pts), boolean chains 13, error handling 2 (5 pts), loops 1 (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
matcher.lookupPricing (cognitive 89) src/lib/pricing/matcher.js:275— matcher.lookupPricing has cognitive complexity 89 (threshold 15). Drivers by points: if/else 32 (52 pts), boolean chains 20, ternaries 6 (11 pts), loops 3 (6 pts) (nesting depth added 28). Of this number, 86 points are the body's own statements and 3 belong to one function item 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.
LoginCard.LoginCard (cognitive 88) dashboard/src/components/LoginCard.jsx:47— LoginCard.LoginCard has cognitive complexity 88 (threshold 15). Drivers by points: boolean chains 40, if/else 29 (35 pts), ternaries 8 (11 pts), error handling 1 (2 pts) (nesting depth added 10). Of this number, 32 points are the body's own statements and 56 belong to 13 function literals inside it that branch. 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.
rollout.readKiroCliV2SessionTurns (cognitive 84) REDACTED:9192— rollout.readKiroCliV2SessionTurns has cognitive complexity 84 (threshold 15). Drivers by points: if/else 22 (47 pts), boolean chains 21, ternaries 6 (10 pts), error handling 4 (5 pts), loops 1 (nesting depth added 30). Of this number, 74 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.scanRolloutProjectFileContexts (cognitive 83) REDACTED:2947— rollout.scanRolloutProjectFileContexts has cognitive complexity 83 (threshold 15). Drivers by points: if/else 19 (49 pts), boolean chains 18, error handling 3 (9 pts), ternaries 2 (4 pts), loops 2 (3 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.
InsforgeAuthContext.InsforgeAuthProvider (cognitive 83) dashboard/src/contexts/InsforgeAuthContext.jsx:80— InsforgeAuthContext.InsforgeAuthProvider has cognitive complexity 83 (threshold 15). Drivers by points: if/else 41 (47 pts), boolean chains 21, ternaries 4 (8 pts), error handling 5 (7 pts) (nesting depth added 12). Most of this is not in the body itself: 2 of the 83 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 163, 142, 294, …). 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.
DashboardWindow.InitializeWebViewCoreAsync (cognitive 82) TokenTrackerWin/DashboardWindow.cs:367— DashboardWindow.InitializeWebViewCoreAsync has cognitive complexity 82 (threshold 15). Most of this is not in the body itself: 1 of the 82 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 474, 403, 443, …). 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.
SubscriptionSettingsCard.SubscriptionSettingsCard (cognitive 82) dashboard/src/ui/dashboard/components/SubscriptionSettingsCard.jsx:46— SubscriptionSettingsCard.SubscriptionSettingsCard has cognitive complexity 82 (threshold 15). Drivers by points: ternaries 30 (52 pts), boolean chains 16, if/else 10 (12 pts), error handling 2 (nesting depth added 24). Most of this is not in the body itself: 9 of the 82 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 398, renderForm, a function literal at line 167, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ActivityHeatmap.ActivityHeatmap (cognitive 82) dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx:81— ActivityHeatmap.ActivityHeatmap has cognitive complexity 82 (threshold 15). Drivers by points: if/else 27 (30 pts), boolean chains 25, ternaries 18 (22 pts), loops 2 (3 pts), error handling 2 (nesting depth added 8). Of this number, 30 points are the body's own statements and 52 belong to 23 function items inside it that branch. 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.
repairClaudeQueueFromGroundTruth (cognitive 82) src/commands/sync.js:7511— repairClaudeQueueFromGroundTruth has cognitive complexity 82 (threshold 15). Drivers by points: if/else 16 (36 pts), error handling 8 (19 pts), boolean chains 15, loops 7 (11 pts), ternaries 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseCommandCodeIncremental (cognitive 81) REDACTED:26305— rollout.parseCommandCodeIncremental has cognitive complexity 81 (threshold 15). Drivers by points: if/else 18 (34 pts), ternaries 12 (19 pts), boolean chains 17, loops 8 (11 pts) (nesting depth added 26). Of this number, 74 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-profile-likes.default (cognitive 81) dashboard/edge-patches/tokentracker-profile-likes.ts:218— tokentracker-profile-likes.default has cognitive complexity 81 (threshold 15). Drivers by points: if/else 25 (60 pts), boolean chains 9, error handling 3 (6 pts), ternaries 3 (6 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
use-trend-data.useTrendData.refresh (cognitive 78) dashboard/src/hooks/use-trend-data.ts:174— use-trend-data.useTrendData.refresh has cognitive complexity 78 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 25, ternaries 10 (23 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.
fetchZcodeLimits (cognitive 78) REDACTED:1372— fetchZcodeLimits has cognitive complexity 78 (threshold 15). Drivers by points: if/else 18 (39 pts), ternaries 7 (18 pts), boolean chains 16, loops 3, error handling 1 (2 pts) (nesting depth added 33). Of this number, 60 points are the body's own statements and 18 belong to 11 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
use-activity-heatmap.useActivityHeatmap.refresh (cognitive 77) dashboard/src/hooks/use-activity-heatmap.ts:134— use-activity-heatmap.useActivityHeatmap.refresh has cognitive complexity 77 (threshold 15). Drivers by points: if/else 28 (44 pts), boolean chains 15, ternaries 8 (11 pts), loops 2 (5 pts), error handling 2 (nesting depth added 22). Of this number, 75 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageOverview.UsageOverview (cognitive 77) dashboard/src/ui/dashboard/components/UsageOverview.jsx:236— UsageOverview.UsageOverview has cognitive complexity 77 (threshold 15). Drivers by points: boolean chains 37, ternaries 22 (28 pts), if/else 11 (12 pts) (nesting depth added 7). Of this number, 48 points are the body's own statements and 29 belong to 16 function items inside it that branch. 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.
openLock (cognitive 77) src/lib/fs.js:284— openLock has cognitive complexity 77 (threshold 15). Drivers by points: if/else 12 (47 pts), error handling 10 (28 pts), boolean chains 2 (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
status.renderLightTable (cognitive 75) src/commands/status.js:1651— status.renderLightTable has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 13 (28 pts), boolean chains 20, if/else 11 (19 pts), loops 6 (8 pts) (nesting depth added 25). Of this number, 73 points are the body's own statements and 2 belong to one function item 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.
ContextBreakdownPanel.ContextBreakdownPanel (cognitive 75) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:686— ContextBreakdownPanel.ContextBreakdownPanel has cognitive complexity 75 (threshold 15). Drivers by points: boolean chains 55, ternaries 11 (13 pts), if/else 7 (nesting depth added 2). Of this number, 40 points are the body's own statements and 35 belong to 9 function literals inside it that branch. 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.
quota.QuotaWidget (cognitive 75) dashboard/src/quota.jsx:11— quota.QuotaWidget has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 30 (62 pts), boolean chains 10, if/else 3 (nesting depth added 32). Of this number, 37 points are the body's own statements and 38 belong to 10 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetchQoderLimits (cognitive 75) src/lib/qoder-limits.js:843— fetchQoderLimits has cognitive complexity 75 (threshold 15). Drivers by points: if/else 21 (33 pts), ternaries 14 (26 pts), error handling 5 (8 pts), boolean chains 6, loops 1, other 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.filterColdCodexRolloutFiles (cognitive 74) REDACTED:810— rollout.filterColdCodexRolloutFiles has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (53 pts), boolean chains 14, ternaries 4 (6 pts), loops 1 (nesting depth added 29). Of this number, 67 points are the body's own statements and 7 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseCraftIncremental (cognitive 74) REDACTED:18742— rollout.parseCraftIncremental has cognitive complexity 74 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 18, ternaries 9 (15 pts), error handling 4 (9 pts), loops 3 (5 pts) (nesting depth added 27). Of this number, 72 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.
WidgetSnapshotWriter.limitProviders (cognitive 73) TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:291— WidgetSnapshotWriter.limitProviders has cognitive complexity 73 (threshold 15). Drivers by points: if/else 38 (62 pts), boolean chains 6, match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kimi-model-repair.repairKimiModelAttribution (cognitive 72) src/lib/kimi-model-repair.js:72— kimi-model-repair.repairKimiModelAttribution has cognitive complexity 72 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 19, loops 8 (15 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mock-data.getMockLeaderboard (cognitive 72) dashboard/src/lib/mock-data.ts:683— mock-data.getMockLeaderboard has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 16 (61 pts), boolean chains 10, if/else 1 (nesting depth added 45). Of this number, 68 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
rollout.parseKiroCliFromSessionFiles (cognitive 71) REDACTED:10039— rollout.parseKiroCliFromSessionFiles has cognitive complexity 71 (threshold 15). Drivers by points: if/else 11 (29 pts), ternaries 9 (18 pts), boolean chains 17, error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime.rpc (cognitive 71) dashboard/edge-patches/cloud/runtime.ts:120— runtime.rpc has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 11 (67 pts), boolean chains 3, if/else 1 (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
tokentracker-account-model-breakdown.handleAccountRequest (cognitive 71) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:896— tokentracker-account-model-breakdown.handleAccountRequest has cognitive complexity 71 (threshold 15). Drivers by points: boolean chains 45, if/else 12 (15 pts), ternaries 5 (8 pts), error handling 2, loops 1 (nesting depth added 6). Of this number, 64 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
SessionDetailModal.SessionDetailModal (cognitive 70) dashboard/src/ui/dashboard/components/SessionDetailModal.jsx:67— SessionDetailModal.SessionDetailModal has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 28 (37 pts), boolean chains 26, if/else 7 (nesting depth added 9). Of this number, 33 points are the body's own statements and 37 belong to 7 function literals inside it that branch. 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.
repairWorkbuddyContextUsage (cognitive 70) src/commands/sync.js:6101— repairWorkbuddyContextUsage has cognitive complexity 70 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 19, ternaries 9 (10 pts), error handling 7 (9 pts), loops 7 (nesting depth added 13). Of this number, 69 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
waffo.normalizeWaffoOrder (cognitive 69) REDACTED:443— waffo.normalizeWaffoOrder has cognitive complexity 69 (threshold 15). Drivers by points: if/else 17 (36 pts), ternaries 9 (18 pts), boolean chains 11, loops 3 (4 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudMembershipCard.CloudMachineList (cognitive 68) dashboard/src/components/cloud/CloudMembershipCard.jsx:77— CloudMembershipCard.CloudMachineList has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 21 (37 pts), if/else 12 (16 pts), boolean chains 10, error handling 4 (5 pts) (nesting depth added 21). Of this number, 18 points are the body's own statements and 50 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseGeminiIncremental (cognitive 66) REDACTED:1349— rollout.parseGeminiIncremental has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 16 (25 pts), if/else 11 (21 pts), boolean chains 19, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
repairDroidDuplicateSessionInflation (cognitive 66) src/commands/sync.js:7279— repairDroidDuplicateSessionInflation has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 18, error handling 9 (12 pts), loops 8 (nesting depth added 13). Of this number, 51 points are the body's own statements and 15 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mergeSessionFragments (cognitive 66) src/lib/session-analytics.js:3059— mergeSessionFragments has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (37 pts), boolean chains 21, ternaries 2 (6 pts), loops 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.
rollout.parseGeminiFile (cognitive 65) REDACTED:3247— rollout.parseGeminiFile has cognitive complexity 65 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 19, ternaries 10 (11 pts), error handling 1, 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.
tokentracker-ingest.default (cognitive 65) dashboard/edge-patches/tokentracker-ingest.ts:37— tokentracker-ingest.default has cognitive complexity 65 (threshold 15). Drivers by points: boolean chains 24, if/else 18 (22 pts), ternaries 8 (12 pts), loops 4 (5 pts), error handling 2 (nesting depth added 9). Of this number, 55 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
readQueueBatch (cognitive 65) src/commands/sync.js:4557— readQueueBatch has cognitive complexity 65 (threshold 15). Drivers by points: if/else 12 (27 pts), ternaries 6 (18 pts), boolean chains 15, error handling 2 (3 pts), loops 1, other 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.
parseGrokUpdatesFile (cognitive 65) src/lib/grok-context-breakdown.js:326— parseGrokUpdatesFile has cognitive complexity 65 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 20, loops 4 (6 pts), ternaries 5 (6 pts), error handling 2 (3 pts) (nesting depth added 17). Of this number, 47 points are the body's own statements and 18 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseKimiIncremental (cognitive 64) REDACTED:10238— rollout.parseKimiIncremental has cognitive complexity 64 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 14, error handling 4 (9 pts), ternaries 7 (8 pts), loops 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-public-visibility.default (cognitive 64) dashboard/edge-patches/tokentracker-public-visibility.ts:76— tokentracker-public-visibility.default has cognitive complexity 64 (threshold 15). Drivers by points: if/else 25 (50 pts), boolean chains 12, ternaries 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.
use-usage-data.useUsageData.refresh (cognitive 63) dashboard/src/hooks/use-usage-data.ts:144— use-usage-data.useUsageData.refresh has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 19, ternaries 9 (15 pts), error handling 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parseDshTranscript (cognitive 63) src/lib/dsh-session.js:299— parseDshTranscript has cognitive complexity 63 (threshold 15). Drivers by points: if/else 11 (27 pts), ternaries 8 (20 pts), boolean chains 11, error handling 1 (2 pts), match/switch 1 (2 pts), loops 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.
wrapped-aggregator.aggregateWrapped (cognitive 62) src/lib/wrapped-aggregator.js:70— wrapped-aggregator.aggregateWrapped has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 12, loops 4 (6 pts), ternaries 4 (5 pts) (nesting depth added 20). Of this number, 60 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createLimitsCache.normalizeEntry (cognitive 62) src/lib/limits-cache.js:244— createLimitsCache.normalizeEntry has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (38 pts), ternaries 5 (11 pts), boolean chains 8, loops 3, other 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.migrateCopilotChatLogRecordDedup (cognitive 61) REDACTED:19321— rollout.migrateCopilotChatLogRecordDedup has cognitive complexity 61 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 15, error handling 3 (7 pts), loops 6 (7 pts), ternaries 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.
rollout.parseTraeIncremental (cognitive 61) REDACTED:23717— rollout.parseTraeIncremental has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 16, ternaries 3 (6 pts), loops 4 (5 pts), error handling 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.
rollout.extractDshSessionUsage (cognitive 61) REDACTED:25312— rollout.extractDshSessionUsage has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 18, ternaries 4 (8 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageLimitsPanel.renderProviderGroup (cognitive 61) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1078— UsageLimitsPanel.renderProviderGroup has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 20 (39 pts), if/else 12 (13 pts), boolean chains 9 (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.
use-trend-data.useTrendData (cognitive 61) dashboard/src/hooks/use-trend-data.ts:24— use-trend-data.useTrendData has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 28, ternaries 7 (17 pts), if/else 13 (16 pts) (nesting depth added 13). Most of this is not in the body itself: 10 of the 61 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 376, 74, 163). 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.
pet.Pet (cognitive 61) dashboard/src/pet.jsx:529— pet.Pet has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 22, ternaries 11 (16 pts) (nesting depth added 8). Of this number, 34 points are the body's own statements and 27 belong to 13 function literals inside it that branch. 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.
ShareModal.ShareModal (cognitive 60) dashboard/src/ui/share/ShareModal.tsx:71— ShareModal.ShareModal has cognitive complexity 60 (threshold 15). Drivers by points: if/else 27 (33 pts), ternaries 13 (16 pts), boolean chains 8, error handling 2 (3 pts) (nesting depth added 10). Most of this is not in the body itself: 11 of the 60 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 180, 152, 124, …). 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.
PetPage.PetPage (cognitive 60) dashboard/src/pages/PetPage.jsx:347— PetPage.PetPage has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 14 (25 pts), if/else 11 (20 pts), boolean chains 12, error handling 3 (nesting depth added 20). Of this number, 29 points are the body's own statements and 31 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseRoocodeIncremental (cognitive 59) REDACTED:12807— rollout.parseRoocodeIncremental has cognitive complexity 59 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 10, error handling 4 (9 pts), ternaries 6, loops 2 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rollout.parseKilocodeIncremental) 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.
rollout.parseKilocodeIncremental (cognitive 59) REDACTED:16801— rollout.parseKilocodeIncremental has cognitive complexity 59 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 10, error handling 4 (9 pts), ternaries 6, loops 2 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rollout.parseRoocodeIncremental) 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.
UsageLimitsView.sectionIfContent (cognitive 59) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:163— UsageLimitsView.sectionIfContent has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 28, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
repairCodebuddyLogJsonlOverlap (cognitive 59) src/commands/sync.js:5908— repairCodebuddyLogJsonlOverlap has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 13, error handling 7 (9 pts), loops 7, ternaries 4 (nesting depth added 12). Of this number, 57 points are the body's own statements and 2 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildRow (cognitive 59) src/lib/dsh-session.js:465— buildRow has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 18, ternaries 7, loops 2 (nesting depth added 17). Of this number, 55 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseOpenclawSessionFile (cognitive 58) REDACTED:2094— rollout.parseOpenclawSessionFile has cognitive complexity 58 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 17, ternaries 9 (11 pts), error handling 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.
diagnostics.collectTrackerDiagnostics (cognitive 58) src/lib/diagnostics.js:70— diagnostics.collectTrackerDiagnostics has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 22 (32 pts), boolean chains 21, if/else 3 (5 pts) (nesting depth added 12). Of this number, 57 points are the body's own statements and 1 belongs 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.
rollout.readKiroCliSessionTurns (cognitive 57) REDACTED:9026— rollout.readKiroCliSessionTurns has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 17, ternaries 5 (8 pts), loops 4 (7 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.
rollout.parseCopilotAppDbIncremental (cognitive 57) REDACTED:21043— rollout.parseCopilotAppDbIncremental has cognitive complexity 57 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 15, ternaries 7 (10 pts), error handling 2 (4 pts), loops 2 (3 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.
ClawdCompanionView.activePetLimits (cognitive 57) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1494— ClawdCompanionView.activePetLimits has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (43 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 19). Of this number, 49 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
summarizeSessions (cognitive 57) src/lib/session-analytics.js:2760— summarizeSessions has cognitive complexity 57 (threshold 15). Drivers by points: if/else 10 (25 pts), ternaries 13, boolean chains 12, loops 3 (5 pts), other 2 (nesting depth added 17). Of this number, 50 points are the body's own statements and 7 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetchArkCodingPlanLimits (cognitive 57) src/lib/ark-coding-plan-limits.js:309— fetchArkCodingPlanLimits has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (23 pts), error handling 7 (13 pts), boolean chains 11, ternaries 6 (10 pts) (nesting depth added 17). Of this number, 44 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetchArkAgentPlanLimits (cognitive 57) src/lib/ark-agent-plan-limits.js:253— fetchArkAgentPlanLimits has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (23 pts), error handling 7 (13 pts), boolean chains 11, ternaries 6 (10 pts) (nesting depth added 17). Of this number, 44 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-categorizer.computeOutputTokenBreakdown (cognitive 56) src/lib/claude-categorizer.js:209— claude-categorizer.computeOutputTokenBreakdown has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 25, if/else 13 (17 pts), loops 5 (9 pts), ternaries 3 (5 pts) (nesting depth added 10). Of this number, 54 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills-manager.updateSkills (cognitive 56) src/lib/skills-manager.js:1399— skills-manager.updateSkills has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 10, loops 5 (9 pts), error handling 2 (5 pts), ternaries 2 (nesting depth added 25). Of this number, 53 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashboardViewModel.loadAll (cognitive 56) TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:166— DashboardViewModel.loadAll has cognitive complexity 56 (threshold 15). Drivers by points: if/else 28 (48 pts), error handling 8 (nesting depth added 20). Of this number, 55 points are the body's own statements and 1 belongs to one function item 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.
rollout.parseQoderDbIncremental (cognitive 55) REDACTED:6739— rollout.parseQoderDbIncremental has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 14, ternaries 10 (13 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.
rollout.parseZedIncremental (cognitive 55) REDACTED:13633— rollout.parseZedIncremental has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 16, error handling 4 (7 pts), ternaries 6 (7 pts), loops 3 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.inspectDshZstdFrames (cognitive 55) REDACTED:24629— rollout.inspectDshZstdFrames has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (32 pts), ternaries 7 (13 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 24). Of this number, 53 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkSection.NetworkSection (cognitive 55) dashboard/src/components/settings/NetworkSection.jsx:35— NetworkSection.NetworkSection has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 13 (22 pts), boolean chains 21, if/else 9 (10 pts), error handling 2 (nesting depth added 10). Of this number, 31 points are the body's own statements and 24 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NativeBridge.applySetting (cognitive 55) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:376— NativeBridge.applySetting has cognitive complexity 55 (threshold 15). Drivers by points: if/else 25 (46 pts), boolean chains 5, ternaries 1 (3 pts), match/switch 1 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rollout.parseCursorApiIncremental (cognitive 54) REDACTED:7877— rollout.parseCursorApiIncremental has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 14, loops 3 (6 pts), ternaries 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
limits-cache.createLimitsCache.normalize (cognitive 54) src/lib/limits-cache.js:244— limits-cache.createLimitsCache.normalize has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (38 pts), boolean chains 8, ternaries 3 (5 pts), loops 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readCodexObjectsIncremental (cognitive 54) REDACTED:1299— readCodexObjectsIncremental has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (33 pts), ternaries 6 (10 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 22). Of this number, 50 points are the body's own statements and 4 belong to one function item 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.
cloudContextualPromptDecision (cognitive 53) dashboard/src/lib/cloud-prompt-policy.js:185— cloudContextualPromptDecision has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 12 (20 pts), boolean chains 18, if/else 12 (15 pts) (nesting depth added 11). Of this number, 52 points are the body's own statements and 1 belongs 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.
jsonl-lines.physicalJsonlRecords (cognitive 52) src/lib/jsonl-lines.js:29— jsonl-lines.physicalJsonlRecords has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (32 pts), ternaries 5 (9 pts), error handling 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseOpencodeIncremental (cognitive 52) REDACTED:1519— rollout.parseOpencodeIncremental has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 15, if/else 8 (15 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.
rollout.parseOpenSquillaIncremental (cognitive 52) REDACTED:14574— rollout.parseOpenSquillaIncremental has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 11, ternaries 7 (9 pts), loops 7 (8 pts) (nesting depth added 14). Of this number, 48 points are the body's own statements and 4 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.
init.previewIntegrations (cognitive 52) src/commands/init.js:1163— init.previewIntegrations has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 16 (31 pts), if/else 20, 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.
zcode-limits.loadZcodeAuthCandidates (cognitive 52) REDACTED:437— zcode-limits.loadZcodeAuthCandidates has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 13 (27 pts), boolean chains 13, if/else 4 (8 pts), loops 2 (3 pts), error handling 1 (nesting depth added 19). Of this number, 47 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TrendMonitor.TrendMonitor (cognitive 52) dashboard/src/ui/dashboard/components/TrendMonitor.jsx:444— TrendMonitor.TrendMonitor has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 36, if/else 10, ternaries 5 (6 pts) (nesting depth added 1). Of this number, 28 points are the body's own statements and 24 belong to 15 function literals inside it that branch. 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.
rollout.parseGooseIncremental (cognitive 51) REDACTED:15860— rollout.parseGooseIncremental has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 16, ternaries 7 (10 pts), loops 2 (3 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.
CloudMembershipCard.RestoreCloudOrder (cognitive 51) dashboard/src/components/cloud/CloudMembershipCard.jsx:297— CloudMembershipCard.RestoreCloudOrder has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 14 (28 pts), boolean chains 16, if/else 4 (7 pts) (nesting depth added 17). Of this number, 16 points are the body's own statements and 35 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createCodexPerformanceCollector.consume (cognitive 51) src/lib/session-performance.js:135— createCodexPerformanceCollector.consume has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 25, if/else 17 (23 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-categorizer.classifyOneMessage (cognitive 50) src/lib/claude-categorizer.js:381— claude-categorizer.classifyOneMessage has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 18, loops 3 (8 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
project-usage-purge.purgeProjectUsage (cognitive 50) src/lib/project-usage-purge.js:6— project-usage-purge.purgeProjectUsage has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 8, error handling 2 (5 pts), loops 3 (4 pts), ternaries 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usage-limits.fetchAntigravityLimits (cognitive 50) src/lib/usage-limits.js:4154— usage-limits.fetchAntigravityLimits has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (28 pts), ternaries 4 (10 pts), error handling 4 (6 pts), boolean chains 5, loops 1 (nesting depth added 17). Of this number, 46 points are the body's own statements and 4 belong to one function item 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.
sync.scanCodexUsageLineages (cognitive 50) src/commands/sync.js:6844— sync.scanCodexUsageLineages has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (29 pts), error handling 3 (7 pts), boolean chains 6, loops 2 (4 pts), ternaries 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.
doctor.buildDiagnosticsChecks (cognitive 50) src/lib/doctor.js:294— doctor.buildDiagnosticsChecks has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 13 (26 pts), boolean chains 10, if/else 5 (9 pts), loops 2 (5 pts) (nesting depth added 20). Of this number, 45 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandPalette.CommandPalette (cognitive 50) dashboard/src/ui/dashboard/components/CommandPalette.jsx:18— CommandPalette.CommandPalette has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 13 (25 pts), boolean chains 14, if/else 11 (nesting depth added 12). Most of this is not in the body itself: 13 of the 50 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 67, a function literal at line 31, onInputKeyDown, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
drainQueueToCloud (cognitive 50) src/commands/sync.js:4457— drainQueueToCloud has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 5 (12 pts), boolean chains 9, error handling 2 (3 pts), loops 1, other 1 (nesting depth added 21). Of this number, 49 points are the body's own statements and 1 belongs to one function item 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.
session-performance.createCodexPerformanceCollector.consume (cognitive 49) src/lib/session-performance.js:135— session-performance.createCodexPerformanceCollector.consume has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 23, if/else 17 (23 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillDetailPanel.SkillDetailPanelInner (cognitive 49) dashboard/src/pages/SkillDetailPanel.jsx:90— SkillDetailPanel.SkillDetailPanelInner has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 23 (30 pts), boolean chains 15, if/else 4 (nesting depth added 7). Of this number, 41 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
annotateThreadUsage (cognitive 49) src/lib/session-analytics.js:3159— annotateThreadUsage has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 19, if/else 10 (18 pts), loops 6, ternaries 3 (6 pts) (nesting depth added 11). Of this number, 35 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.normalizeCommandCodeState (cognitive 48) REDACTED:26190— rollout.normalizeCommandCodeState has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 12, loops 3 (6 pts) (nesting depth added 21). Of this number, 40 points are the body's own statements and 8 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.
codex-rollout-parser.discoverCodexSessionFiles (cognitive 48) REDACTED:330— codex-rollout-parser.discoverCodexSessionFiles has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 9, error handling 2 (6 pts), ternaries 3 (5 pts), loops 3 (4 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.
InsforgeUserHeaderControls.InsforgeUserHeaderControls (cognitive 48) dashboard/src/components/InsforgeUserHeaderControls.jsx:55— InsforgeUserHeaderControls.InsforgeUserHeaderControls has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 15 (32 pts), boolean chains 11, if/else 4 (5 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RedeemProCode.RedeemProCode (cognitive 48) dashboard/src/components/cloud/RedeemProCode.jsx:14— RedeemProCode.RedeemProCode has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 19 (28 pts), boolean chains 24, if/else 16 (21 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. This shape REPEATS in the file: one other method here (RedeemProCode.RedeemProCode::perform) 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.
fetchAccountUsage (cognitive 48) src/lib/cloud-account.js:435— fetchAccountUsage has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 13, ternaries 6 (8 pts), error handling 1 (2 pts) (nesting depth added 12). Of this number, 29 points are the body's own statements and 19 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dumate.parseDumateIncremental (cognitive 47) src/lib/dumate.js:32— dumate.parseDumateIncremental has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 19, if/else 7 (19 pts), loops 5 (7 pts), ternaries 1 (2 pts) (nesting depth added 15). Of this number, 45 points are the body's own statements and 2 belong to one function item 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.
sync.repairCodexForkReplayInflation (cognitive 47) src/commands/sync.js:6658— sync.repairCodexForkReplayInflation has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (5 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.
device-login.cmdDeviceLogin (cognitive 47) src/commands/device-login.js:64— device-login.cmdDeviceLogin has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 15, ternaries 3 (6 pts), error handling 1 (2 pts), loops 2 (nesting depth added 13). Of this number, 32 points are the body's own statements and 15 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-account-heatmap.default (cognitive 47) dashboard/edge-patches/tokentracker-account-heatmap.ts:213— tokentracker-account-heatmap.default has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 13, loops 5 (8 pts), ternaries 6, error handling 2 (nesting depth added 6). Of this number, 37 points are the body's own statements and 10 belong to 2 function items inside it that branch. 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.
limitRows (cognitive 47) TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:170— limitRows has cognitive complexity 47 (threshold 15). Drivers by points: if/else 6 (21 pts), ternaries 3 (12 pts), loops 3 (6 pts), boolean chains 5, other 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.
rollout.readKiroCliMessageChars (cognitive 46) REDACTED:8950— rollout.readKiroCliMessageChars has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 10, error handling 4 (8 pts), loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-account-daily.default (cognitive 46) dashboard/edge-patches/tokentracker-account-daily.ts:901— tokentracker-account-daily.default has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 21, if/else 12 (15 pts), loops 3 (5 pts), ternaries 3, error handling 2 (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.
SessionsPage.SessionRow (cognitive 46) dashboard/src/pages/SessionsPage.jsx:207— SessionsPage.SessionRow has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 22 (27 pts), boolean chains 11, if/else 6, error handling 2 (nesting depth added 5). Of this number, 38 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
commitOpencodeShards (cognitive 46) src/lib/cursor-store.js:759— commitOpencodeShards has cognitive complexity 46 (threshold 15). Drivers by points: loops 9 (20 pts), if/else 5 (16 pts), boolean chains 4, error handling 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
native-qa-auth.createRAMAuthBroker.execute (cognitive 45) TokenTrackerBar/scripts/native-qa-auth.cjs:64— native-qa-auth.createRAMAuthBroker.execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 14, ternaries 4 (8 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.
rollout.parseUnslothIncremental (cognitive 45) REDACTED:14947— rollout.parseUnslothIncremental has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 11, loops 5 (8 pts), ternaries 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dsh-session.discoverDshSessionFiles (cognitive 45) src/lib/dsh-session.js:183— dsh-session.discoverDshSessionFiles has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (25 pts), error handling 3 (9 pts), loops 3 (6 pts), boolean chains 5 (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.
model-breakdown.buildAllModels (cognitive 45) dashboard/src/lib/model-breakdown.ts:447— model-breakdown.buildAllModels has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 6 (12 pts), boolean chains 9, loops 4 (6 pts) (nesting depth added 17). Of this number, 42 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudUsageExport.CloudUsageExport (cognitive 45) dashboard/src/components/cloud/CloudUsageExport.jsx:21— CloudUsageExport.CloudUsageExport has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 14, ternaries 12 (14 pts), error handling 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 23 belong to 7 function items inside it that branch. 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.
trae-usage.normalizeTraeUsage (cognitive 44) src/lib/trae-usage.js:6— trae-usage.normalizeTraeUsage has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 11, loops 4 (5 pts), error handling 1 (2 pts), ternaries 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.
skill-usage.scanFile (cognitive 44) src/lib/skill-usage.js:135— skill-usage.scanFile has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 8, loops 3 (5 pts), ternaries 2 (5 pts), error handling 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.
sync.repairZcodeUsageMigration (cognitive 44) src/commands/sync.js:5271— sync.repairZcodeUsageMigration has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 7, loops 3 (6 pts), ternaries 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-account-monthly.default (cognitive 44) dashboard/edge-patches/tokentracker-account-monthly.ts:140— tokentracker-account-monthly.default has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 18, if/else 14 (18 pts), ternaries 4 (5 pts), error handling 2, loops 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.
DeviceUsageCard.DeviceUsageCard (cognitive 44) REDACTED:27— DeviceUsageCard.DeviceUsageCard has cognitive complexity 44 (threshold 15). Drivers by points: boolean chains 19, ternaries 14 (19 pts), if/else 4 (5 pts), error handling 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 44 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 126, a function literal at line 284, commitEdit, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
commit (cognitive 44) src/lib/cursor-store.js:855— commit has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 11, error handling 4 (9 pts), loops 5 (8 pts), ternaries 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
firstStreamTokenTime (cognitive 44) src/lib/dsh-session.js:105— firstStreamTokenTime has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 12, ternaries 2 (6 pts), loops 2 (4 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.
workbuddy-ipc.openWorkbuddyIpc (cognitive 43) src/lib/workbuddy-ipc.js:62— workbuddy-ipc.openWorkbuddyIpc has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 10, error handling 3, loops 2, ternaries 1 (nesting depth added 6). None of this is in the body itself: all 43 points belong to 7 function literals inside it that branch (lines 123, 63, 167, …). 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.
local-api.scanCodexProjects (cognitive 43) src/lib/local-api.js:984— local-api.scanCodexProjects has cognitive complexity 43 (threshold 15). Drivers by points: if/else 6 (27 pts), loops 4 (10 pts), error handling 2 (6 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LimitsPage.LimitsPage (cognitive 43) dashboard/src/pages/LimitsPage.jsx:114— LimitsPage.LimitsPage has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 17 (19 pts), if/else 12 (13 pts), boolean chains 10, error handling 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 22 belong to 6 function literals inside it that branch. 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.
use-usage-data.useUsageData (cognitive 43) dashboard/src/hooks/use-usage-data.ts:20— use-usage-data.useUsageData has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 19, if/else 11 (12 pts), ternaries 7 (12 pts) (nesting depth added 6). Most of this is not in the body itself: 7 of the 43 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 338, 52, 419, …). 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.
TokenGalaxy.TokenGalaxy (cognitive 43) dashboard/src/ui/marketing/v3/TokenGalaxy.jsx:116— TokenGalaxy.TokenGalaxy has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (18 pts), error handling 10, boolean chains 9, ternaries 5, loops 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 43 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 159, 335, 122, …). 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.
normalizeZcodeBalanceResponse (cognitive 43) REDACTED:624— normalizeZcodeBalanceResponse has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 17, ternaries 12 (14 pts), if/else 6 (9 pts), loops 2 (3 pts) (nesting depth added 6). Of this number, 22 points are the body's own statements and 21 belong to 2 function literals inside it that branch. 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.
cleanRow (cognitive 43) src/lib/local-usage-transfer.js:35— cleanRow has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 15, loops 2 (3 pts), other 2, ternaries 1 (2 pts) (nesting depth added 12). Of this number, 25 points are the body's own statements and 18 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseAnythingllmIncremental (cognitive 42) REDACTED:15194— rollout.parseAnythingllmIncremental has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 12, ternaries 5 (8 pts), loops 3 (nesting depth added 12). Of this number, 41 points are the body's own statements and 1 belongs to one function item 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.
rollout.parseTraeCnApiIncremental (cognitive 42) REDACTED:24282— rollout.parseTraeCnApiIncremental has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, loops 4 (5 pts), ternaries 3 (4 pts), error handling 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.
index.computeRowCost (cognitive 42) src/lib/pricing/index.js:347— index.computeRowCost has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 25, if/else 8 (10 pts), loops 2 (5 pts), ternaries 2 (nesting depth added 5). Of this number, 40 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
usage-limits.normalizeCursorUsageSummary (cognitive 42) src/lib/usage-limits.js:808— usage-limits.normalizeCursorUsageSummary has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 12, ternaries 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session-analytics.groupClaudeFilesAcrossRoots (cognitive 42) src/lib/session-analytics.js:1888— session-analytics.groupClaudeFilesAcrossRoots has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 6 (9 pts), boolean chains 7 (nesting depth added 20). Of this number, 40 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-leaderboard.default (cognitive 42) dashboard/edge-patches/tokentracker-leaderboard.ts:94— tokentracker-leaderboard.default has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 19, if/else 11 (14 pts), ternaries 4 (5 pts), error handling 2 (4 pts) (nesting depth added 6). Of this number, 36 points are the body's own statements and 6 belong to 4 function items inside it that branch. 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.
repairMimoClaudeMislabel (cognitive 42) src/commands/sync.js:4930— repairMimoClaudeMislabel has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 10, loops 3 (6 pts), ternaries 4, error handling 2 (nesting depth added 10). Of this number, 40 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collectResourceGroups (cognitive 42) src/lib/workbuddy-limits.js:332— collectResourceGroups has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (16 pts), other 9, boolean chains 8, ternaries 4 (7 pts), loops 1 (2 pts) (nesting depth added 12). Of this number, 34 points are the body's own statements and 8 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetchOpencodeGoApiLimits (cognitive 42) REDACTED:559— fetchOpencodeGoApiLimits has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 9, other 7, error handling 2 (nesting depth added 12). Most of this is not in the body itself: 12 of the 42 points are its own statements and the rest belongs to 2 function items inside it that branch (resolveApiWindow, a function literal at line 610). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
runCommand (cognitive 42) src/lib/command-runner.js:19— runCommand has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (26 pts), boolean chains 8, error handling 4 (5 pts), ternaries 3 (nesting depth added 2). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 15 function items inside it that branch (a function literal at line 42, (anonymous)::settle, (anonymous)::scheduleCompletion, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TrendMonitorZoomModal.TrendMonitorZoomModal (cognitive 41) REDACTED:101— TrendMonitorZoomModal.TrendMonitorZoomModal has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 14, ternaries 11 (14 pts), if/else 11 (13 pts) (nesting depth added 5). Of this number, 22 points are the body's own statements and 19 belong to 13 function items inside it that branch. 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.
StatusBarController.buildMenu (cognitive 41) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:1161— StatusBarController.buildMenu has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 14 (25 pts), loops 3 (7 pts), if/else 3 (6 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.
cmdServe (cognitive 41) REDACTED:69— cmdServe has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 13, error handling 7 (9 pts), loops 1, ternaries 1 (nesting depth added 5). Of this number, 24 points are the body's own statements and 17 belong to 11 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.resolveProjectMetaForPath (cognitive 40) REDACTED:4824— rollout.resolveProjectMetaForPath has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (10 pts), boolean chains 7, ternaries 2 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TrendMonitor.computeInterpolatedSeries (cognitive 40) dashboard/src/ui/dashboard/components/TrendMonitor.jsx:343— TrendMonitor.computeInterpolatedSeries has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 5 (11 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scanForForkedCodexRollout (cognitive 40) src/commands/sync.js:6997— scanForForkedCodexRollout has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (18 pts), ternaries 4 (10 pts), error handling 2 (5 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
removeOpenclawSessionPluginConfig (cognitive 40) src/lib/openclaw-session-plugin.js:228— removeOpenclawSessionPluginConfig has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 11, error handling 3, loops 1 (2 pts) (nesting depth added 12). Of this number, 39 points are the body's own statements and 1 belongs to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createBackendResolver (cognitive 40) src/lib/claude-backend.js:152— createBackendResolver has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 9, ternaries 6 (7 pts), error handling 3 (5 pts), loops 3 (nesting depth added 9). Most of this is not in the body itself: 12 of the 40 points are its own statements and the rest belongs to 5 function items inside it that branch (refreshDecisions, validInterval, a function literal at line 222, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
removeOpenclawHookConfig (cognitive 40) src/lib/openclaw-hook.js:140— removeOpenclawHookConfig has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 11, error handling 2, loops 1 (2 pts) (nesting depth added 12). Of this number, 39 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildGitOutcomesInternal (cognitive 40) src/lib/git-outcomes.js:125— buildGitOutcomesInternal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, loops 5 (7 pts), ternaries 3 (6 pts), error handling 2 (4 pts) (nesting depth added 14). Of this number, 36 points are the body's own statements and 4 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
trae-snapshot.openTraeSnapshot (cognitive 39) REDACTED:131— trae-snapshot.openTraeSnapshot has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 7, error handling 3 (4 pts), loops 3, ternaries 3 (nesting depth added 3). Of this number, 26 points are the body's own statements and 13 belong to 2 function items inside it that branch. 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.
rollout.parseRolloutFile (cognitive 39) REDACTED:2371— rollout.parseRolloutFile has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 11 (24 pts), if/else 5 (9 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 18). Of this number, 31 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseKiroIncremental (cognitive 39) REDACTED:8182— rollout.parseKiroIncremental has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 8 (11 pts), boolean chains 8, 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.
rollout.parseHermesIncremental::ingestProfile (cognitive 39) REDACTED:8627— rollout.parseHermesIncremental::ingestProfile has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 13, ternaries 5 (6 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.
omp-hook.removeOmpHook (cognitive 39) src/lib/omp-hook.js:443— omp-hook.removeOmpHook has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 5 (12 pts), boolean chains 10, error handling 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-categorizer.buildToolCallsBreakdown (cognitive 39) src/lib/claude-categorizer.js:736— claude-categorizer.buildToolCallsBreakdown has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 33, if/else 3 (5 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 39 points are its own statements and the rest belongs to 7 function items inside it that branch (groupIntoCategories, a function literal at line 785, a function literal at line 798, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
sync.migrateRolloutCumulativeDeltaBuckets (cognitive 39) src/commands/sync.js:5809— sync.migrateRolloutCumulativeDeltaBuckets has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 10, loops 4 (7 pts), ternaries 3 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CostAnalysisModal.CostAnalysisModal (cognitive 39) dashboard/src/ui/dashboard/components/CostAnalysisModal.jsx:30— CostAnalysisModal.CostAnalysisModal has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 16 (26 pts), boolean chains 11, if/else 2 (nesting depth added 10). Most of this is not in the body itself: 2 of the 39 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 164, 78, 40, …). 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.
ProjectDetailModal.ProjectDetailModalContent (cognitive 39) dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx:121— ProjectDetailModal.ProjectDetailModalContent has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 19, ternaries 14 (17 pts), if/else 3 (nesting depth added 3). Of this number, 35 points are the body's own statements and 4 belong to 5 function items inside it that branch. 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.
UsageLimitsResponse.limitWindowReadings (cognitive 39) TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:200— UsageLimitsResponse.limitWindowReadings has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (25 pts), loops 4 (7 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 9). Of this number, 34 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
collectOpencodeGoLocal (cognitive 39) REDACTED:486— collectOpencodeGoLocal has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 5 (12 pts), boolean chains 7, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills-manager.listInstalledSkills (cognitive 38) src/lib/skills-manager.js:855— skills-manager.listInstalledSkills has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 4 (7 pts), boolean chains 6 (nesting depth added 20). Of this number, 28 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ThemeProvider.ThemeProvider (cognitive 38) dashboard/src/ui/foundation/ThemeProvider.jsx:64— ThemeProvider.ThemeProvider has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (21 pts), ternaries 6 (12 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 12). None of this is in the body itself: all 38 points belong to 9 function literals inside it that branch (lines 87, 66, 111, …). 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.
use-community-stats.useCommunityStats (cognitive 38) dashboard/src/hooks/use-community-stats.js:133— use-community-stats.useCommunityStats has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 11, if/else 9 (10 pts), error handling 1 (nesting depth added 4). None of this is in the body itself: all 38 points belong to 6 function literals inside it that branch (lines 151, 144, 229, …). 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.
ClawdCompanionView.clawdState (cognitive 38) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1321— ClawdCompanionView.clawdState has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 11 (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.
rollout.dedupeDroidSettingsFilesBySession (cognitive 37) REDACTED:16325— rollout.dedupeDroidSettingsFilesBySession has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (11 pts), error handling 2 (6 pts), loops 3 (4 pts), ternaries 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.
rollout.parseMuseIncremental::handleRecord (cognitive 37) REDACTED:18523— rollout.parseMuseIncremental::handleRecord has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 13, 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. This shape REPEATS in the file: one other method here (rollout.parseMuseIncremental) 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.
rollout.resolveDshSessionFiles (cognitive 37) REDACTED:24568— rollout.resolveDshSessionFiles has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (6 pts), boolean chains 5, ternaries 1 (5 pts) (nesting depth added 22). Of this number, 24 points are the body's own statements and 13 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.computeLocalAchievements (cognitive 37) src/lib/local-api.js:576— local-api.computeLocalAchievements has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 14, loops 4, ternaries 1 (nesting depth added 8). Of this number, 22 points are the body's own statements and 15 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
migrateLegacyDeepseekHarnessSource (cognitive 37) src/commands/sync.js:4007— migrateLegacyDeepseekHarnessSource has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8, error handling 3 (5 pts), loops 3, other 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.
saveUsageExport (cognitive 37) dashboard/src/lib/native-bridge.js:178— saveUsageExport has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 15, if/else 14, ternaries 4 (7 pts), error handling 1 (nesting depth added 3). Of this number, 20 points are the body's own statements and 17 belong to 7 function items inside it that branch. 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.
zcode-limits.scanZcodeBalanceLogs (cognitive 36) REDACTED:1010— zcode-limits.scanZcodeBalanceLogs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 9, ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 15). Of this number, 34 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.
skills-inventory.mergeSkillInventories (cognitive 36) dashboard/src/lib/skills-inventory.ts:104— skills-inventory.mergeSkillInventories has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 11, ternaries 3 (6 pts), loops 2 (3 pts) (nesting depth added 14). Of this number, 31 points are the body's own statements and 5 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.
ClawdCompanionView.quipPool (cognitive 36) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1700— ClawdCompanionView.quipPool has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (35 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.
repairGrokQueueFromSessionSnapshots (cognitive 36) src/commands/sync.js:5603— repairGrokQueueFromSessionSnapshots has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, error handling 2 (3 pts), loops 3, ternaries 1 (3 pts) (nesting depth added 11). Of this number, 32 points are the body's own statements and 4 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.
readQoderLocalQuotaWithAge (cognitive 36) src/lib/qoder-limits.js:766— readQoderLocalQuotaWithAge has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (5 pts), other 5, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 14). Of this number, 30 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsagePoller.FetchTopModelsAsync (cognitive 35) TokenTrackerWin/UsagePoller.cs:340— UsagePoller.FetchTopModelsAsync has cognitive complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs 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.
rollout.collectPiStyleSubagentFiles (cognitive 35) REDACTED:12429— rollout.collectPiStyleSubagentFiles has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 6 (13 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 15). Of this number, 23 points are the body's own statements and 12 belong to one function item 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.
runtime-config.resolveRuntimeConfig (cognitive 35) REDACTED:20— runtime-config.resolveRuntimeConfig has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 17 (23 pts), boolean chains 12 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
grok-context-breakdown.computeGrokContextBreakdownUncached (cognitive 35) src/lib/grok-context-breakdown.js:676— grok-context-breakdown.computeGrokContextBreakdownUncached has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 23, if/else 4 (8 pts), loops 3, ternaries 1 (nesting depth added 4). Of this number, 24 points are the body's own statements and 11 belong to 7 function items inside it that branch. 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.
CursorConnectionControl.CursorConnectionControl (cognitive 35) dashboard/src/ui/dashboard/components/CursorConnectionControl.jsx:10— CursorConnectionControl.CursorConnectionControl has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 10 (11 pts), boolean chains 7, error handling 3 (nesting depth added 5). Of this number, 19 points are the body's own statements and 16 belong to 4 function items inside it that branch. 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.
pet-quips.buildQuipPool (cognitive 35) dashboard/src/lib/pet-quips.js:611— pet-quips.buildQuipPool has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 5, ternaries 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.
relabelClaudeMemQueueRows (cognitive 35) src/commands/sync.js:7814— relabelClaudeMemQueueRows has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 4 (8 pts), boolean chains 7, ternaries 2 (4 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.
upsertOmpHook (cognitive 35) src/lib/omp-hook.js:283— upsertOmpHook has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 5 (11 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResumableDownloader.DownloadAsync (cognitive 34) TokenTrackerWin/ResumableDownloader.cs:38— ResumableDownloader.DownloadAsync has cognitive complexity 34 (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.
rollout.resolveWorkbuddyProjectFiles (cognitive 34) REDACTED:11412— rollout.resolveWorkbuddyProjectFiles has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 4 (8 pts), boolean chains 7, ternaries 4, loops 2 (nesting depth added 8). Most of this is not in the body itself: 3 of the 34 points are its own statements and the rest belongs to 3 function items inside it that branch (walkJsonl, walkTraces, a function literal at line 11460). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rollout.extractAntigravityGenInfo (cognitive 34) REDACTED:23144— rollout.extractAntigravityGenInfo has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 3 (7 pts), boolean chains 3, error handling 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.
antigravity-discovery.discoverT3AntigravityBrainDirs (cognitive 34) src/lib/antigravity-discovery.js:67— antigravity-discovery.discoverT3AntigravityBrainDirs has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, error handling 2 (5 pts), loops 3 (5 pts), ternaries 2 (5 pts) (nesting depth added 15). Of this number, 31 points are the body's own statements and 3 belong to one function item 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.
categorizer-utils.categorizeTool (cognitive 34) src/lib/categorizer-utils.js:12— categorizer-utils.categorizeTool has cognitive complexity 34 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
usage-limits.parseLinuxProcListeningPorts (cognitive 34) src/lib/usage-limits.js:3196— usage-limits.parseLinuxProcListeningPorts has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (22 pts), error handling 3 (5 pts), loops 3 (4 pts), boolean chains 3 (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.
tokentracker-account-summary.default (cognitive 34) dashboard/edge-patches/tokentracker-account-summary.ts:927— tokentracker-account-summary.default has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 11, ternaries 5, loops 3, error handling 2 (nesting depth added 2). Of this number, 30 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
activity-heatmap.buildActivityHeatmap (cognitive 34) dashboard/src/lib/activity-heatmap.ts:80— activity-heatmap.buildActivityHeatmap has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 7 (11 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 12). Of this number, 28 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cloud-sync.syncCloudUsageWithRecovery (cognitive 34) dashboard/src/lib/cloud-sync.ts:127— cloud-sync.syncCloudUsageWithRecovery has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 8, error handling 1, ternaries 1 (nesting depth added 7). Of this number, 31 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LikeButton.LikeButton (cognitive 34) REDACTED:45— LikeButton.LikeButton has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 10 (11 pts), boolean chains 6, error handling 3 (4 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 63, a function literal at line 87, sendAction, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
LoginPage.LoginPage (cognitive 34) dashboard/src/pages/LoginPage.jsx:15— LoginPage.LoginPage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 7 (10 pts), error handling 4 (7 pts), boolean chains 5 (nesting depth added 7). Most of this is not in the body itself: 12 of the 34 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 51, 36, 69, …). 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.
installSkill (cognitive 34) src/lib/skills-manager.js:919— installSkill has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 19, if/else 7 (9 pts), ternaries 2 (3 pts), loops 2, error handling 1 (nesting depth added 3). Of this number, 29 points are the body's own statements and 5 belong to 7 function literals inside it that branch. 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.
rollout.preserveCodexModelBuckets (cognitive 33) REDACTED:3535— rollout.preserveCodexModelBuckets has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 9, loops 4, 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.
rollout.normalizeHourlyState (cognitive 33) REDACTED:4122— rollout.normalizeHourlyState has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 8 (10 pts), boolean chains 8, 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.
CloudBillingParts.cloudBillingErrorText (cognitive 33) dashboard/src/components/cloud/CloudBillingParts.jsx:7— CloudBillingParts.cloudBillingErrorText has cognitive complexity 33 (threshold 15). Drivers by points: if/else 25, ternaries 3 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
startLinuxPetHost (cognitive 33) dashboard/src/lib/pet-linux-host.js:154— startLinuxPetHost has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15, boolean chains 11, error handling 4, other 2, ternaries 1. None of this is in the body itself: all 33 points belong to 13 function items inside it that branch (refreshUsage, fetchHeatmap, fetchTopModels, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rollout.resolveOpenclawSessionFiles (cognitive 32) REDACTED:1725— rollout.resolveOpenclawSessionFiles has cognitive complexity 32 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 5 (13 pts), boolean chains 2 (nesting depth added 21). Of this number, 31 points are the body's own statements and 1 belongs 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.
upload-queue.compactPendingQueue (cognitive 32) src/lib/upload-queue.js:64— upload-queue.compactPendingQueue has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5, ternaries 2 (4 pts), loops 3, 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.
outcomes-engine.computeQualityPerDollar (cognitive 32) src/lib/outcomes-engine.js:198— outcomes-engine.computeQualityPerDollar has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 22, if/else 3 (6 pts), loops 4 (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.
api.fetchLocalJson (cognitive 32) dashboard/src/lib/api.ts:183— api.fetchLocalJson has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (5 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 14). Of this number, 27 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResumableDownloader.urlSession (cognitive 32) TokenTrackerBar/TokenTrackerBar/Services/ResumableDownloader.swift:183— ResumableDownloader.urlSession has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 8, match/switch 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.
UsageLimitsView.toolSection (cognitive 32) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:290— UsageLimitsView.toolSection has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 16, if/else 12, ternaries 3 (4 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
trae-snapshot.indexWal (cognitive 31) REDACTED:86— trae-snapshot.indexWal has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.parseOpencodeMessageFile (cognitive 31) REDACTED:3375— rollout.parseOpencodeMessageFile has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (9 pts), ternaries 7, error handling 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.
codex-config.readTomlArrayLiteral::scanChunk (cognitive 31) src/lib/codex-config.js:422— codex-config.readTomlArrayLiteral::scanChunk has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), boolean chains 3, loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (codex-config.findTomlArrayBlockEnd::scanChunk) 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.
codex-config.findTomlArrayBlockEnd::scanChunk (cognitive 31) src/lib/codex-config.js:490— codex-config.findTomlArrayBlockEnd::scanChunk has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), boolean chains 3, loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (codex-config.readTomlArrayLiteral::scanChunk) 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.
opencode-go-limits.fetchOpencodeGoLimits (cognitive 31) REDACTED:739— opencode-go-limits.fetchOpencodeGoLimits has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, ternaries 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pi-session.listNestedJsonlSync::walk (cognitive 31) src/lib/pi-session.js:162— pi-session.listNestedJsonlSync::walk has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, error handling 2 (4 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.
session-analytics.normalizeModelUsageRows (cognitive 31) src/lib/session-analytics.js:224— session-analytics.normalizeModelUsageRows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (8 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 15). Of this number, 30 points are the body's own statements and 1 belongs 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.
tokentracker-account-model-breakdown.getUsageModelPricing (cognitive 31) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:864— tokentracker-account-model-breakdown.getUsageModelPricing has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (17 pts), boolean chains 13, if/else 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.
use-trend-data.fillHourlyGaps (cognitive 31) dashboard/src/hooks/use-trend-data.ts:655— use-trend-data.fillHourlyGaps has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 5 (9 pts), boolean chains 5, loops 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashboardView.DashboardView (cognitive 31) dashboard/src/ui/dashboard/views/DashboardView.jsx:104— DashboardView.DashboardView has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 10, if/else 3, match/switch 2 (nesting depth added 7). Most of this is not in the body itself: 10 of the 31 points are its own statements and the rest belongs to 5 function items inside it that branch (renderRightCard, renderLeftCard, a function literal at line 403, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
NativeBridge.handle (cognitive 31) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:122— NativeBridge.handle has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, ternaries 1 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DashboardViewModel.loadMenuBarSummaries (cognitive 31) TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:597— DashboardViewModel.loadMenuBarSummaries has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (24 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClawdCompanionView.drawDisconnected (cognitive 31) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1047— ClawdCompanionView.drawDisconnected has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 12, if/else 10, ternaries 4 (8 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
extractGeminiOauthClientCredentials (cognitive 31) src/lib/usage-limits.js:1241— extractGeminiOauthClientCredentials has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 2 (6 pts), loops 3 (6 pts), boolean chains 3, other 1, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
discoverSessionFiles (cognitive 31) src/lib/session-analytics.js:2073— discoverSessionFiles has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 13, if/else 2 (3 pts), loops 1 (nesting depth added 2). Of this number, 22 points are the body's own statements and 9 belong to 16 function items inside it that branch. 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.
refreshGrokTokens (cognitive 31) src/lib/grok-limits.js:294— refreshGrokTokens has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (11 pts), ternaries 4, error handling 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
pet-packages.readCodexBuiltinPets (cognitive 30) src/lib/pet-packages.js:548— pet-packages.readCodexBuiltinPets has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, error handling 5 (6 pts), ternaries 2 (5 pts), loops 2 (nesting depth added 8). Of this number, 24 points are the body's own statements and 6 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.
usage-limits.readPlaintextCopilotAuth (cognitive 30) src/lib/usage-limits.js:1879— usage-limits.readPlaintextCopilotAuth has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 2 (6 pts), boolean chains 3, loops 2 (3 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.
static-server.serveStaticFile (cognitive 30) src/lib/static-server.js:64— static-server.serveStaticFile has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 5, ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 7). Of this number, 29 points are the body's own statements and 1 belongs 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.
tokentracker-badge-svg.default (cognitive 30) dashboard/edge-patches/tokentracker-badge-svg.ts:189— tokentracker-badge-svg.default has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13, ternaries 6 (9 pts), boolean chains 7, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
tokentracker-device-usage-reset.default (cognitive 30) dashboard/edge-patches/tokentracker-device-usage-reset.ts:22— tokentracker-device-usage-reset.default has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 4 (8 pts), boolean chains 7, 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.
AchievementsSection.AchievementsSection (cognitive 30) dashboard/src/ui/achievements/AchievementsSection.jsx:25— AchievementsSection.AchievementsSection has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (15 pts), boolean chains 9, if/else 4 (5 pts), loops 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 14 belong to 4 function literals inside it that branch. 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.
UpdateChecker.handleResult (cognitive 30) TokenTrackerBar/TokenTrackerBar/Services/UpdateChecker.swift:98— UpdateChecker.handleResult has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 2, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parseKiroUsageOutput (cognitive 30) src/lib/usage-limits.js:1687— parseKiroUsageOutput has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 11, ternaries 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.
normalizeEntriesForCommand (cognitive 30) src/lib/claude-config.js:181— normalizeEntriesForCommand has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 11, ternaries 3 (4 pts) (nesting depth added 3). None of this is in the body itself: all 30 points belong to 5 function items inside it that branch (a function literal at line 189, a function literal at line 214, a function literal at line 200, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
claude-user-identity.collectClaudeForkAliases (cognitive 29) src/lib/claude-user-identity.js:27— claude-user-identity.collectClaudeForkAliases has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (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.
rollout.resolveGooseDbPath (cognitive 29) REDACTED:15745— rollout.resolveGooseDbPath has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8, ternaries 4 (7 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.
rollout.resolveCommandCodeSessionFiles (cognitive 29) REDACTED:25979— rollout.resolveCommandCodeSessionFiles has cognitive complexity 29 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (8 pts), boolean chains 6, error handling 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.
claude-categorizer.getConfiguredResources (cognitive 29) src/lib/claude-categorizer.js:1052— claude-categorizer.getConfiguredResources has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills-manager.scanPluginInventoryRoot::walk (cognitive 29) src/lib/skills-manager.js:390— skills-manager.scanPluginInventoryRoot::walk has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 5, loops 2 (4 pts), 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.
tokentracker-account-hourly.default (cognitive 29) dashboard/edge-patches/tokentracker-account-hourly.ts:222— tokentracker-account-hourly.default has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (10 pts), ternaries 3, error handling 2, 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.
tokentracker-account-skills.default (cognitive 29) dashboard/edge-patches/tokentracker-account-skills.ts:163— tokentracker-account-skills.default has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 9, error handling 1 (2 pts), ternaries 2 (nesting depth added 6). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SearchableSelect.SearchableSelect (cognitive 29) dashboard/src/ui/components/SearchableSelect.jsx:26— SearchableSelect.SearchableSelect has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 7 (10 pts), boolean chains 6 (nesting depth added 6). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to 6 function items inside it that branch (handleKeyDown, a function literal at line 80, a function literal at line 145, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
useLimitsDisplayPrefs (cognitive 29) dashboard/src/hooks/use-limits-display-prefs.js:335— useLimitsDisplayPrefs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 4, ternaries 1 (nesting depth added 4). None of this is in the body itself: all 29 points belong to 28 function items inside it that branch (a function literal at line 400, a function literal at line 339, a function literal at line 356, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
codex-token-usage.consumeUsageDelta (cognitive 28) src/lib/codex-token-usage.js:98— codex-token-usage.consumeUsageDelta has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.recordOpencodeMessage (cognitive 28) REDACTED:4381— rollout.recordOpencodeMessage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 9, 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.
rollout.parseClaudeScienceIncremental (cognitive 28) REDACTED:7756— rollout.parseClaudeScienceIncremental has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 5 (10 pts), boolean chains 5, 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.
rollout.findDshJsonProperty::valueEnd (cognitive 28) REDACTED:25105— rollout.findDshJsonProperty::valueEnd has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rollout.findDshJsonProperty) 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.
zcode-limits.readZcodeLimitsCache (cognitive 28) REDACTED:1131— zcode-limits.readZcodeLimitsCache has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (8 pts), boolean chains 7, error handling 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.
session-analytics.scanCodexSession (cognitive 28) src/lib/session-analytics.js:825— session-analytics.scanCodexSession has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 20, ternaries 5, if/else 3. Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
sync.applyOpenclawTotalsFallback (cognitive 28) src/commands/sync.js:4154— sync.applyOpenclawTotalsFallback has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 20, if/else 5, ternaries 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.
sync.repairZcodePruneWindowRestore (cognitive 28) src/commands/sync.js:5464— sync.repairZcodePruneWindowRestore has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, loops 3 (4 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.
tokentracker-device-token-issue.default (cognitive 28) dashboard/edge-patches/tokentracker-device-token-issue.ts:96— tokentracker-device-token-issue.default has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (9 pts), boolean chains 6, 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, 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.
UsageLimitsPanel.UsageLimitsPanel (cognitive 28) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1677— UsageLimitsPanel.UsageLimitsPanel has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 8, ternaries 5, loops 1 (2 pts) (nesting depth added 9). Of this number, 25 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LeaderboardProfileModal.ProfileContent (cognitive 28) dashboard/src/components/leaderboard/LeaderboardProfileModal.jsx:445— LeaderboardProfileModal.ProfileContent has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 17, ternaries 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.
model-breakdown.buildFleetData (cognitive 28) dashboard/src/lib/model-breakdown.ts:325— model-breakdown.buildFleetData has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 9, if/else 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 370, 363, 331, …). 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.
AnnualReportCard.rebucket (cognitive 28) dashboard/src/ui/share/variants/AnnualReportCard.jsx:60— AnnualReportCard.rebucket has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 4 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 13). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (lv, a function literal at line 70, a function literal at line 70). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
SkillsPage.BrowseCard (cognitive 28) REDACTED:616— SkillsPage.BrowseCard has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 14 (19 pts), boolean chains 9 (nesting depth added 5). Of this number, 25 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NativeQAProfile.permitsNativeMessage (cognitive 28) TokenTrackerBar/Shared/NativeQAProfile.swift:186— NativeQAProfile.permitsNativeMessage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 11, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
buildCodexFileShardMetadata (cognitive 28) src/lib/cursor-store.js:1385— buildCodexFileShardMetadata has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 3 (8 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 12). Of this number, 27 points are the body's own statements and 1 belongs 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.
collectPetLimitRows (cognitive 28) dashboard/src/lib/pet-quips.js:391— collectPetLimitRows has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), loops 3 (5 pts), other 2, ternaries 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 12 belong to 20 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PetWindow.HoverTick (cognitive 27) TokenTrackerWin/PetWindow.cs:403— PetWindow.HoverTick has cognitive complexity 27 (threshold 15). 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.
rollout.collectCodexDominantModels (cognitive 27) REDACTED:4061— rollout.collectCodexDominantModels has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.readLmstudioFileRecords (cognitive 27) REDACTED:14100— rollout.readLmstudioFileRecords has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 3 (7 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.resolveCraftWorkspaceRoots (cognitive 27) REDACTED:18106— rollout.resolveCraftWorkspaceRoots has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (7 pts), ternaries 2 (5 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.readCommandCodeSessionSnapshot (cognitive 27) REDACTED:26242— rollout.readCommandCodeSessionSnapshot has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (5 pts), boolean chains 4, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deepseek-status.parseDeepSeekStatusPage (cognitive 27) src/lib/deepseek-status.js:94— deepseek-status.parseDeepSeekStatusPage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (9 pts), boolean chains 5, loops 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.
qoder-limits.parseQoderAccountUsageLog (cognitive 27) src/lib/qoder-limits.js:675— qoder-limits.parseQoderAccountUsageLog has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (8 pts), error handling 3 (7 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
waffo.providerOrders (cognitive 27) REDACTED:246— waffo.providerOrders has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 5, boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
use-usage-limits.useUsageLimits (cognitive 27) dashboard/src/hooks/use-usage-limits.ts:177— use-usage-limits.useUsageLimits has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 7, ternaries 3, error handling 2 (nesting depth added 1). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 368, 249, 359, …). 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.
use-trend-data.parseHourLabel (cognitive 27) dashboard/src/hooks/use-trend-data.ts:864— use-trend-data.parseHourLabel has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CloudMembershipCard.cloudMembershipSummary (cognitive 27) dashboard/src/components/cloud/CloudMembershipCard.jsx:64— CloudMembershipCard.cloudMembershipSummary has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (20 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
repriceSessionRecord (cognitive 27) src/lib/session-analytics.js:303— repriceSessionRecord has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, ternaries 3 (5 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.
performMint (cognitive 27) src/lib/cloud-account.js:246— performMint has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 10, ternaries 6 (9 pts), if/else 6, error handling 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.
releaseOwnedLock (cognitive 27) src/lib/fs.js:226— releaseOwnedLock has cognitive complexity 27 (threshold 15). Drivers by points: error handling 8 (16 pts), if/else 5 (9 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.
claude-backend.preserveLegacyClaudeGroups (cognitive 26) src/lib/claude-backend.js:93— claude-backend.preserveLegacyClaudeGroups has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 12). Of this number, 19 points are the body's own statements and 7 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.
categorizer-utils.inferExecCommandKind (cognitive 26) src/lib/categorizer-utils.js:76— categorizer-utils.inferExecCommandKind has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, boolean chains 7. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
grok-limits.fetchGrokLimits (cognitive 26) src/lib/grok-limits.js:790— grok-limits.fetchGrokLimits has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (8 pts), boolean chains 5, 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.
pi-session.discoverPiSessionFiles (cognitive 26) src/lib/pi-session.js:385— pi-session.discoverPiSessionFiles has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 3 (5 pts), boolean chains 3, 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.
sync.dropZcodeQueueRows (cognitive 26) src/commands/sync.js:5205— sync.dropZcodeQueueRows has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (7 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BadgeDetailModal.BadgeDetailBody (cognitive 26) dashboard/src/ui/achievements/BadgeDetailModal.jsx:62— BadgeDetailModal.BadgeDetailBody has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 7 (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.
CommunityStatsModal.CommunityStatsModalContent (cognitive 26) dashboard/src/components/leaderboard/CommunityStatsModal.jsx:467— CommunityStatsModal.CommunityStatsModalContent has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 14, boolean chains 9, if/else 3. Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 474, onTablistKeyDown, a function literal at line 542, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
LeaderboardPage.MobileLeaderboardRow (cognitive 26) dashboard/src/pages/LeaderboardPage.jsx:284— LeaderboardPage.MobileLeaderboardRow has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 7, if/else 2 (nesting depth added 3). Of this number, 24 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
use-usage-model-breakdown.useUsageModelBreakdown.refresh (cognitive 26) dashboard/src/hooks/use-usage-model-breakdown.ts:110— use-usage-model-breakdown.useUsageModelBreakdown.refresh has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, ternaries 3, 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, 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.
model-breakdown.buildTopModels (cognitive 26) dashboard/src/lib/model-breakdown.ts:551— model-breakdown.buildTopModels has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 6 (7 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eyefit.resous (cognitive 26) dashboard/src/lib/bot/eyefit.ts:242— eyefit.resous has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 6 (9 pts), ternaries 2, boolean chains 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function item 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.
NativeQAProfile.validate (cognitive 26) TokenTrackerBar/Shared/NativeQAProfile.swift:106— NativeQAProfile.validate has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 23, 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.
DashboardWindowController.handleScriptMessage (cognitive 26) TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:565— DashboardWindowController.handleScriptMessage has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (8 pts), ternaries 2 (6 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.
PetCatalog.refresh (cognitive 26) TokenTrackerBar/TokenTrackerBar/Services/DesktopPetWindowController.swift:673— PetCatalog.refresh has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 3 (7 pts), ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
StatusBarController.togglePopover (cognitive 26) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:834— StatusBarController.togglePopover has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalizeCodexCreditWindow (cognitive 26) src/lib/usage-limits.js:510— normalizeCodexCreditWindow has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 16, if/else 6 (8 pts), other 1, 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.
normalizeZcodeCodingPlanQuotaResponse (cognitive 26) REDACTED:895— normalizeZcodeCodingPlanQuotaResponse has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, ternaries 7 (10 pts), if/else 5 (nesting depth added 3). Of this number, 25 points are the body's own statements and 1 belongs to 4 function literals inside it that branch. 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.
useCloudSyncControl (cognitive 26) dashboard/src/components/settings/useAccountProfileSettings.js:21— useCloudSyncControl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (7 pts), boolean chains 6, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 53, a function literal at line 76, a function literal at line 86, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
buildTopModels (cognitive 26) dashboard/src/lib/pet-linux-host.js:52— buildTopModels has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 3 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 11). Of this number, 22 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runtime-copy.copyRuntimeTree (cognitive 25) src/lib/runtime-copy.js:25— runtime-copy.copyRuntimeTree has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.recordProjectMeta (cognitive 25) REDACTED:4995— rollout.recordProjectMeta has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), ternaries 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
trae-cn-config.parseTraeCnAuthValue (cognitive 25) src/lib/trae-cn-config.js:200— trae-cn-config.parseTraeCnAuthValue has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 3 (7 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex-rollout-parser.iterateCodexObjects (cognitive 25) REDACTED:1450— codex-rollout-parser.iterateCodexObjects has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 pts), boolean chains 2, error handling 1 (2 pts), ternaries 2 (nesting depth added 9). Of this number, 22 points are the body's own statements and 3 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.
omp-session.discoverOmpSessionFiles (cognitive 25) src/lib/omp-session.js:171— omp-session.discoverOmpSessionFiles has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 3 (5 pts), boolean chains 3, 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.
paddle.normalizePaddleEvent (cognitive 25) dashboard/edge-patches/cloud/paddle.ts:355— paddle.normalizePaddleEvent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, 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.
tokentracker-account-devices.default (cognitive 25) dashboard/edge-patches/tokentracker-account-devices.ts:174— tokentracker-account-devices.default has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 7, error handling 3, ternaries 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.
api.fetchAccountFunction (cognitive 25) dashboard/src/lib/api.ts:917— api.fetchAccountFunction has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). Of this number, 13 points are the body's own statements and 12 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.
SkillsPage.SkillRow (cognitive 25) REDACTED:220— SkillsPage.SkillRow has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 9, if/else 1 (nesting depth added 3). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
loadOpencodeMessagesForBatchUnchecked (cognitive 25) src/lib/cursor-store.js:432— loadOpencodeMessagesForBatchUnchecked has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (8 pts), loops 3, ternaries 2 (nesting depth added 2). Of this number, 23 points are the body's own statements and 2 belong to 4 function literals inside it that branch. 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.
probeWslDistros (cognitive 25) src/lib/wsl-probe.js:57— probeWslDistros has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), ternaries 3 (5 pts), error handling 2 (4 pts) (nesting depth added 7). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scopeSessionsToRange (cognitive 25) dashboard/src/lib/sessions-insights.js:5— scopeSessionsToRange has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (8 pts), boolean chains 7 (nesting depth added 6). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 7, sum, a function literal at line 9, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ServerManager.StartHealthLoop (cognitive 24) TokenTrackerWin/ServerManager.cs:776— ServerManager.StartHealthLoop has cognitive complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 790). 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.
UsagePoller.FetchAsync (cognitive 24) TokenTrackerWin/UsagePoller.cs:226— UsagePoller.FetchAsync has cognitive complexity 24 (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.
scan-roots.resolveScanRoots (cognitive 24) src/lib/scan-roots.js:163— scan-roots.resolveScanRoots has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (7 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex-config.parseTomlStringArray::parseString (cognitive 24) src/lib/codex-config.js:354— codex-config.parseTomlStringArray::parseString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-categorizer.categorizeSessionFile (cognitive 24) src/lib/claude-categorizer.js:498— claude-categorizer.categorizeSessionFile has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, error handling 2 (3 pts), 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.
trae-cn-config.fetchTraeCnUsagePage (cognitive 24) src/lib/trae-cn-config.js:342— trae-cn-config.fetchTraeCnUsagePage has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), error handling 2, 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.
pet-packages.importFromCodex (cognitive 24) src/lib/pet-packages.js:656— pet-packages.importFromCodex has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (5 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 9). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qoder-limits.normalizeQoderRpcUsage (cognitive 24) src/lib/qoder-limits.js:279— qoder-limits.normalizeQoderRpcUsage has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 5, if/else 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.
usage-limits.normalizeCodexSparkRateWindows (cognitive 24) src/lib/usage-limits.js:601— usage-limits.normalizeCodexSparkRateWindows has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
status.formatCopilotLines (cognitive 24) src/commands/status.js:1536— status.formatCopilotLines has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, ternaries 5 (6 pts), if/else 3, loops 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.
cloud-billing.cloudBillingRequest (cognitive 24) dashboard/src/lib/cloud-billing.ts:109— cloud-billing.cloudBillingRequest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 5). Of this number, 22 points are the body's own statements and 2 belong to one function item 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.
ContextBreakdownPanel.normalizeToolRows (cognitive 24) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:223— ContextBreakdownPanel.normalizeToolRows has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 16, ternaries 8. Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 225, 247). 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.
ClawdCompanionView.drawIdleLiving (cognitive 24) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:654— ClawdCompanionView.drawIdleLiving has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 10, loops 1, 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.
toSessionBrowserRow (cognitive 24) src/lib/session-analytics.js:2982— toSessionBrowserRow has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 16, ternaries 5, other 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.
parseCsv (cognitive 24) REDACTED:50— parseCsv has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerManager.StartTrackerProcess (cognitive 23) TokenTrackerWin/ServerManager.cs:677— ServerManager.StartTrackerProcess has cognitive complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TrayApplicationContext.InstalledCustomPets (cognitive 23) TokenTrackerWin/TrayApplicationContext.cs:564— TrayApplicationContext.InstalledCustomPets has cognitive complexity 23 (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.
rollout.readZcodeNativeUsageMessages (cognitive 23) REDACTED:6184— rollout.readZcodeNativeUsageMessages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8, error handling 2 (3 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.
rollout.resolveKiroCliSessionFiles (cognitive 23) REDACTED:8875— rollout.resolveKiroCliSessionFiles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 3 (4 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.readKiroCliRequests (cognitive 23) REDACTED:9537— rollout.readKiroCliRequests has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.resolveKilocodeRoots (cognitive 23) REDACTED:12630— rollout.resolveKilocodeRoots has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.retractStaleSourceQueueRows (cognitive 23) REDACTED:21652— rollout.retractStaleSourceQueueRows has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (3 pts), boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init.parseArgs (cognitive 23) src/commands/init.js:1410— init.parseArgs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, 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.
async-queue-reader.createAsyncQueueReader::load (cognitive 23) src/lib/async-queue-reader.js:34— async-queue-reader.createAsyncQueueReader::load has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (5 pts), boolean chains 2, 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.
devin-limits.readDevinCredentials (cognitive 23) src/lib/devin-limits.js:55— devin-limits.readDevinCredentials has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 7 (8 pts), boolean chains 3, error handling 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.
proxy-env.applyUndiciProxyIfNeeded (cognitive 23) REDACTED:409— proxy-env.applyUndiciProxyIfNeeded has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (8 pts), boolean chains 3, error handling 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.
skills-manager.hashDirectory::walk (cognitive 23) src/lib/skills-manager.js:470— skills-manager.hashDirectory::walk has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (10 pts), error handling 3 (7 pts), if/else 3 (5 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.
local-api.aggregateHourlyByDay (cognitive 23) src/lib/local-api.js:742— local-api.aggregateHourlyByDay has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 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.
local-api.buildProxyHeaders (cognitive 23) src/lib/local-api.js:1118— local-api.buildProxyHeaders has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sync.collectZcodeQueuePeaks (cognitive 23) src/commands/sync.js:5378— sync.collectZcodeQueuePeaks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (4 pts), boolean chains 3, error handling 2 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sync.isCodexHistoryCovered (cognitive 23) src/commands/sync.js:6966— sync.isCodexHistoryCovered has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (6 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tokentracker-account-daily.getRowPricing (cognitive 23) dashboard/edge-patches/tokentracker-account-daily.ts:677— tokentracker-account-daily.getRowPricing has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 10 (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.
tokentracker-account-model-breakdown.getRowPricing (cognitive 23) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:696— tokentracker-account-model-breakdown.getRowPricing has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 10 (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.
tokentracker-account-summary.getRowPricing (cognitive 23) dashboard/edge-patches/tokentracker-account-summary.ts:663— tokentracker-account-summary.getRowPricing has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 10 (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.
tokentracker-device-rename.default (cognitive 23) dashboard/edge-patches/tokentracker-device-rename.ts:84— tokentracker-device-rename.default has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 5, boolean chains 4, error handling 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.
tokentracker-leaderboard-profile.getRowPricing (cognitive 23) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:635— tokentracker-leaderboard-profile.getRowPricing has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 10 (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.
tokentracker-leaderboard-profile.computeRowCost (cognitive 23) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:686— tokentracker-leaderboard-profile.computeRowCost has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 16, ternaries 3 (4 pts), if/else 3 (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.
tokentracker-leaderboard-refresh.getRowPricing (cognitive 23) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:676— tokentracker-leaderboard-refresh.getRowPricing has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 10 (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.
tokentracker-leaderboard-refresh.computeRowCost (cognitive 23) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:708— tokentracker-leaderboard-refresh.computeRowCost has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 16, ternaries 3 (4 pts), if/else 3 (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.
SegmentedControl.SegmentedControl (cognitive 23) dashboard/src/ui/components/SegmentedControl.jsx:19— SegmentedControl.SegmentedControl has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10, boolean chains 8, ternaries 4, loops 1. Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 7 function items inside it that branch (moveSelection, a function literal at line 54, a function literal at line 106, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TrendMonitor.TrendBar (cognitive 23) dashboard/src/ui/dashboard/components/TrendMonitor.jsx:212— TrendMonitor.TrendBar has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (15 pts), boolean chains 4, if/else 4 (nesting depth added 5). Of this number, 17 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NativeAuthCallbackPage.NativeAuthCallbackPage (cognitive 23) dashboard/src/pages/NativeAuthCallbackPage.jsx:41— NativeAuthCallbackPage.NativeAuthCallbackPage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 9, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 88, 56, 77, …). 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.
CloudUsageExport.save (cognitive 23) TokenTrackerBar/Shared/CloudUsageExport.swift:47— CloudUsageExport.save has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppDelegate.application (cognitive 23) TokenTrackerBar/TokenTrackerBar/TokenTrackerBarApp.swift:266— AppDelegate.application has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BotSpriteView.draw (cognitive 23) TokenTrackerBar/TokenTrackerBar/Views/BotSpriteView.swift:104— BotSpriteView.draw has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7, loops 3, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
providerRoots (cognitive 23) src/lib/session-analytics.js:1820— providerRoots has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), ternaries 3 (5 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalizeZcodeQuotaLimit (cognitive 23) REDACTED:862— normalizeZcodeQuotaLimit has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, ternaries 5, if/else 4, other 1. Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
collectExpiringResourceCredits (cognitive 23) src/lib/workbuddy-limits.js:421— collectExpiringResourceCredits has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 2, ternaries 1 (2 pts), other 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.
readWebpDimensions (cognitive 23) src/lib/pet-packages.js:86— readWebpDimensions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 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.
useCommunityStats::(anonymous)::run (cognitive 23) dashboard/src/hooks/use-community-stats.js:151— useCommunityStats::(anonymous)::run has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10, boolean chains 8, if/else 3 (4 pts), error handling 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.
CloudUsageExport.Save (cognitive 22) TokenTrackerWin/CloudUsageExport.cs:48— CloudUsageExport.Save 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.
ResumableDownloader.DownloadNextChunkAsync (cognitive 22) TokenTrackerWin/ResumableDownloader.cs:135— ResumableDownloader.DownloadNextChunkAsync 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.
UpdateReleaseClient.ReadApiReleaseAsync (cognitive 22) TokenTrackerWin/UpdateReleaseClient.cs:62— UpdateReleaseClient.ReadApiReleaseAsync 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.
rollout.resolveGitConfigPath (cognitive 22) REDACTED:5165— rollout.resolveGitConfigPath has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.collectQoderRuntimeModels (cognitive 22) REDACTED:7057— rollout.collectQoderRuntimeModels has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (5 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 1 belongs 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.
rollout.writeKiroCliCreditsSidecar (cognitive 22) REDACTED:9411— rollout.writeKiroCliCreditsSidecar has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (6 pts), error handling 2, loops 2, 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.
rollout.scanClineSessionFiles (cognitive 22) REDACTED:13069— rollout.scanClineSessionFiles has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, error handling 2 (3 pts), 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.
rollout.resolvePiSessionFiles (cognitive 22) REDACTED:17434— rollout.resolvePiSessionFiles has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 4 (5 pts), boolean chains 3, loops 3 (nesting depth added 5). Of this number, 16 points are the body's own statements and 6 belong to one function item 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.
rollout.resolveCopilotOtelPaths (cognitive 22) REDACTED:18971— rollout.resolveCopilotOtelPaths has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (6 pts), boolean chains 3, error handling 1 (nesting depth added 8). Of this number, 17 points are the body's own statements and 5 belong to one function item 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.
rollout.extractGrokTurnUsageEvents (cognitive 22) REDACTED:21470— rollout.extractGrokTurnUsageEvents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 6, loops 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.readGrokUpdateTokenEvents (cognitive 22) REDACTED:21519— rollout.readGrokUpdateTokenEvents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, error handling 3 (4 pts), ternaries 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.
cli-ui.promptMenu (cognitive 22) src/lib/cli-ui.js:53— cli-ui.promptMenu has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, ternaries 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 92, rerender, a function literal at line 66, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
workbuddy-ipc.readWorkbuddyIpcDiscovery (cognitive 22) src/lib/workbuddy-ipc.js:18— workbuddy-ipc.readWorkbuddyIpcDiscovery has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, 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.
usage-limits.extractClaudeScopedWeekly (cognitive 22) src/lib/usage-limits.js:387— usage-limits.extractClaudeScopedWeekly has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (8 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usage-limits.persistAntigravityCredentials (cognitive 22) src/lib/usage-limits.js:3844— usage-limits.persistAntigravityCredentials has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 3 (4 pts), 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.
session-analytics.createCodexDeliverySignalCollector.consume (cognitive 22) src/lib/session-analytics.js:775— session-analytics.createCodexDeliverySignalCollector.consume has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.buildCodexCategoryFallbackFromQueue (cognitive 22) src/lib/local-api.js:456— local-api.buildCodexCategoryFallbackFromQueue has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 4 (8 pts), loops 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
sync.reincludeClaudeMemObserverFiles (cognitive 22) src/commands/sync.js:7764— sync.reincludeClaudeMemObserverFiles has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 4, loops 2 (3 pts) (nesting depth added 4). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
tokentracker-account-daily.computeRowCost (cognitive 22) dashboard/edge-patches/tokentracker-account-daily.ts:857— tokentracker-account-daily.computeRowCost has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 15, ternaries 3 (4 pts), if/else 3 (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.
tokentracker-account-summary.computeRowCost (cognitive 22) dashboard/edge-patches/tokentracker-account-summary.ts:857— tokentracker-account-summary.computeRowCost has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 15, ternaries 3 (4 pts), if/else 3 (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.
copy-registry-plugin.parseCsv (cognitive 22) dashboard/scripts/copy-registry-plugin.mjs:11— copy-registry-plugin.parseCsv has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (21 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.
StatusBarController.buildMenuBarDisplayValues (cognitive 22) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:440— StatusBarController.buildMenuBarDisplayValues has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parseAntigravityCredentialPayload (cognitive 22) src/lib/usage-limits.js:3643— parseAntigravityCredentialPayload has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, if/else 4, error handling 2 (3 pts), other 1 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createCodexDeliverySignalCollector.consume (cognitive 22) src/lib/session-analytics.js:775— createCodexDeliverySignalCollector.consume has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fetchAccountFunction (cognitive 22) src/lib/cloud-account.js:382— fetchAccountFunction has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 6 (8 pts), boolean chains 3, 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.
ensureOpenclawSessionPluginPolicy (cognitive 22) src/lib/openclaw-session-plugin.js:180— ensureOpenclawSessionPluginPolicy has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 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.
computeStableMachineId (cognitive 22) src/lib/machine-id.js:104— computeStableMachineId has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3 (6 pts), ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsagePoller.RefreshAsync (cognitive 21) TokenTrackerWin/UsagePoller.cs:131— UsagePoller.RefreshAsync has cognitive complexity 21 (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.
native-qa-server.installFileAndProcessGuards (cognitive 21) TokenTrackerBar/scripts/native-qa-server.cjs:37— native-qa-server.installFileAndProcessGuards has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (7 pts), boolean chains 5, if/else 2 (4 pts), ternaries 2 (3 pts), error handling 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 4 function items inside it that branch (allowed, a function literal at line 40, a function literal at line 57, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TokenTrackerIndicator._refreshOnce (cognitive 21) TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:1089— TokenTrackerIndicator._refreshOnce has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 3, boolean chains 2, 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.
cursor-config.readProtoFields (cognitive 21) src/lib/cursor-config.js:260— cursor-config.readProtoFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.diffGeminiTotals (cognitive 21) REDACTED:5317— rollout.diffGeminiTotals has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 16, if/else 4, 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.
rollout.normalizeGrokSessionSnapshots (cognitive 21) REDACTED:21270— rollout.normalizeGrokSessionSnapshots has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.resetAntigravityBucketsForRebuild (cognitive 21) REDACTED:22449— rollout.resetAntigravityBucketsForRebuild has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, 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.
rollout.findAntigravityProtoFields (cognitive 21) REDACTED:23107— rollout.findAntigravityProtoFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.readDshSessionSnapshot (cognitive 21) REDACTED:24985— rollout.readDshSessionSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, 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.
openclaw-cli.resolveOpenclawCommand (cognitive 21) src/lib/openclaw-cli.js:18— openclaw-cli.resolveOpenclawCommand has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 2 (3 pts), 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.
V2CursorStore.materializeAllCodexState (cognitive 21) src/lib/cursor-store.js:381— V2CursorStore.materializeAllCodexState has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (13 pts), boolean chains 3, if/else 1 (3 pts), error handling 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
grok-context-breakdown.mapGrokToolName (cognitive 21) src/lib/grok-context-breakdown.js:189— grok-context-breakdown.mapGrokToolName has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, boolean chains 10. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
omp-session.listNestedJsonlSync::walk (cognitive 21) src/lib/omp-session.js:116— omp-session.listNestedJsonlSync::walk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session-analytics.loadCodexTitleIndex (cognitive 21) src/lib/session-analytics.js:2258— session-analytics.loadCodexTitleIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (5 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.buildDailyAggregates (cognitive 21) src/lib/local-api.js:413— local-api.buildDailyAggregates has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (10 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
browser-auth.isCommandAvailable (cognitive 21) src/lib/browser-auth.js:177— browser-auth.isCommandAvailable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (7 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NativeQAProfile.requestApproval (cognitive 21) TokenTrackerBar/Shared/NativeQAProfile.swift:224— NativeQAProfile.requestApproval has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, 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.
DashboardViewModel.buildTopModels (cognitive 21) TokenTrackerBar/TokenTrackerBar/ViewModels/DashboardViewModel.swift:1121— DashboardViewModel.buildTopModels has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (5 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.
fetchGeminiLimits (cognitive 21) src/lib/usage-limits.js:1454— fetchGeminiLimits has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 2 (3 pts), error handling 1, other 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.
normalizeGrokBillingResponse (cognitive 21) src/lib/grok-limits.js:616— normalizeGrokBillingResponse has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 8 (9 pts), ternaries 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.
normalizeManifest (cognitive 21) src/lib/pet-packages.js:130— normalizeManifest has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 8, 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.
preloadLeaderboardDefaultState (cognitive 21) dashboard/src/lib/dashboard-preload.js:383— preloadLeaderboardDefaultState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, other 3, error handling 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 5 belong to 3 function literals inside it that branch. 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.
native-qa-auth.createRAMAuthBroker.acceptSession (cognitive 20) TokenTrackerBar/scripts/native-qa-auth.cjs:41— native-qa-auth.createRAMAuthBroker.acceptSession has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, 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.
rollout.codebuddyJsonlHasUsage (cognitive 20) REDACTED:10656— rollout.codebuddyJsonlHasUsage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, error handling 3 (5 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.
rollout.resolveCodebuddyProjectFiles::walkLogs (cognitive 20) REDACTED:10799— rollout.resolveCodebuddyProjectFiles::walkLogs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rollout.resolveCodebuddyProjectFiles) 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.
rollout.resolveOpenSquillaDbPaths (cognitive 20) REDACTED:14460— rollout.resolveOpenSquillaDbPaths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, ternaries 3 (nesting depth added 1). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
rollout.scanOmpLikeTranscript (cognitive 20) REDACTED:16973— rollout.scanOmpLikeTranscript has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 4 (7 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.coalesceCopilotDbStatesByIdentity (cognitive 20) REDACTED:20757— rollout.coalesceCopilotDbStatesByIdentity has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (5 pts), error handling 2 (4 pts), boolean chains 3, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.normalizeTraeCnSession (cognitive 20) REDACTED:24123— rollout.normalizeTraeCnSession has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 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.
rollout.isCompleteCommandCodeRecord (cognitive 20) REDACTED:26067— rollout.isCompleteCommandCodeRecord has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pet-packages.migrateLegacyCodexPets (cognitive 20) src/lib/pet-packages.js:476— pet-packages.migrateLegacyCodexPets has cognitive complexity 20 (threshold 15). Drivers by points: error handling 6 (9 pts), if/else 5 (8 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.
grok-limits.fetchGrokBilling (cognitive 20) src/lib/grok-limits.js:704— grok-limits.fetchGrokBilling has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, error handling 3 (4 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
opencode-go-limits.scrapeOpencodeGoWeb (cognitive 20) REDACTED:655— opencode-go-limits.scrapeOpencodeGoWeb has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, error handling 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usage-limits.describeCopilotOtelStatus (cognitive 20) src/lib/usage-limits.js:2258— usage-limits.describeCopilotOtelStatus has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (6 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usage-limits.fetchKiroLimits (cognitive 20) src/lib/usage-limits.js:2369— usage-limits.fetchKiroLimits has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 2 (4 pts), error handling 2 (3 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.
usage-limits.listAntigravityPorts (cognitive 20) src/lib/usage-limits.js:3255— usage-limits.listAntigravityPorts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session-analytics.scopeSessionUsage (cognitive 20) src/lib/session-analytics.js:2715— session-analytics.scopeSessionUsage has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (5 pts), ternaries 3 (5 pts), loops 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 3 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.
skills-manager.fetchPopularSkillsSh (cognitive 20) src/lib/skills-manager.js:1531— skills-manager.fetchPopularSkillsSh has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (8 pts), loops 2 (3 pts), error handling 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.createLocalApiHandler.handleLocalApi::aggregateEntries (cognitive 20) src/lib/local-api.js:3211— local-api.createLocalApiHandler.handleLocalApi::aggregateEntries has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (8 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (local-api.createLocalApiHandler.handleLocalApi) 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.
sync.collectZcodeQueueLatest (cognitive 20) src/commands/sync.js:5414— sync.collectZcodeQueueLatest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), error handling 2 (3 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.
doctor.buildRuntimeChecks (cognitive 20) src/lib/doctor.js:45— doctor.buildRuntimeChecks has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
waffo.currentPeriod (cognitive 20) REDACTED:376— waffo.currentPeriod has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4 (nesting depth added 7). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 381). 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.
waffo.closeSingleUnpaidWaffoOrder (cognitive 20) REDACTED:572— waffo.closeSingleUnpaidWaffoOrder has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 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.
tokentracker-community-models.default (cognitive 20) dashboard/edge-patches/tokentracker-community-models.ts:56— tokentracker-community-models.default has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, if/else 5, boolean chains 4, error handling 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.
tokentracker-leaderboard-refresh.verifiedClaimsFromJwt (cognitive 20) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:48— tokentracker-leaderboard-refresh.verifiedClaimsFromJwt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
compare-visual-baselines.run (cognitive 20) dashboard/scripts/compare-visual-baselines.mjs:196— compare-visual-baselines.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (6 pts), boolean chains 3, 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.
CloudContextualPrompt.CloudContextualPrompt (cognitive 20) dashboard/src/components/cloud/CloudContextualPrompt.jsx:78— CloudContextualPrompt.CloudContextualPrompt has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, ternaries 4 (6 pts), if/else 3 (4 pts) (nesting depth added 3). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 91). 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.
limit-alerts.buildPredictiveLimitAlerts (cognitive 20) dashboard/src/lib/limit-alerts.js:17— limit-alerts.buildPredictiveLimitAlerts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 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.
UsageLimitsPanel.LimitBar (cognitive 20) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:190— UsageLimitsPanel.LimitBar has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 8, if/else 1 (nesting depth added 3). Of this number, 19 points are the body's own statements and 1 belongs 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.
UsageLimitsPanel.ZcodeResetBankSection (cognitive 20) dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:720— UsageLimitsPanel.ZcodeResetBankSection has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 5, if/else 2 (3 pts), loops 2 (nesting depth added 3). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 727, 784, 740). 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.
AchievementBadge.AchievementBadge (cognitive 20) dashboard/src/ui/achievements/AchievementBadge.jsx:19— AchievementBadge.AchievementBadge has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (13 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.
model-breakdown.mergeSourcesByAlias (cognitive 20) dashboard/src/lib/model-breakdown.ts:284— model-breakdown.mergeSourcesByAlias has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, 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.
ContextBreakdownPanel.ToolCallsExpanded (cognitive 20) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:610— ContextBreakdownPanel.ToolCallsExpanded has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, if/else 3, ternaries 1 (2 pts) (nesting depth added 1). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 632, 646, 655). 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.
AnnualReportCard.streak (cognitive 20) dashboard/src/ui/share/variants/AnnualReportCard.jsx:97— AnnualReportCard.streak has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DevicePage.DevicePage::onSubmit (cognitive 20) dashboard/src/pages/DevicePage.jsx:47— DevicePage.DevicePage::onSubmit has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 8, 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.
WrappedPage.WrappedPage (cognitive 20) dashboard/src/pages/WrappedPage.jsx:33— WrappedPage.WrappedPage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 7, ternaries 2. Of this number, 13 points are the body's own statements and 7 belong to 4 function literals inside it that branch. 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.
CloudSection.CloudRebuildControl (cognitive 20) dashboard/src/components/settings/CloudSection.jsx:75— CloudSection.CloudRebuildControl has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (5 pts), boolean chains 3, error handling 1 (nesting depth added 6). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (rebuild). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CloudUsageExport.init (cognitive 20) TokenTrackerBar/Shared/CloudUsageExport.swift:13— CloudUsageExport.init has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (4 pts), ternaries 2 (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.
FireworkOverlayView.body (cognitive 20) TokenTrackerBar/TokenTrackerBar/Services/ScreenConfettiOverlayController.swift:225— FireworkOverlayView.body has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 2, if/else 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.
UsageLimitsView.subscriptionByProvider (cognitive 20) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:128— UsageLimitsView.subscriptionByProvider has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, 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.
getZonedParts (cognitive 20) src/lib/local-api.js:663— getZonedParts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 2 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 3 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.
readZcodeLogSnapshotCache (cognitive 20) REDACTED:1267— readZcodeLogSnapshotCache has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 7, if/else 4, error handling 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.
parseCursorCsv (cognitive 20) src/lib/cursor-config.js:445— parseCursorCsv has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (6 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalizeCachedData (cognitive 20) dashboard/src/hooks/use-community-stats.js:44— normalizeCachedData has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, boolean chains 9, 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.
getOrCreateMachineId (cognitive 20) src/lib/machine-id.js:177— getOrCreateMachineId has cognitive complexity 20 (threshold 15). Drivers by points: error handling 5 (7 pts), if/else 5 (6 pts), boolean chains 5, 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.
wsl-probe.discoverWslHome (cognitive 19) src/lib/wsl-probe.js:180— wsl-probe.discoverWslHome has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (5 pts), error handling 1 (3 pts), loops 2 (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.
trae-db.resolveTraeDbPaths (cognitive 19) src/lib/trae-db.js:15— trae-db.resolveTraeDbPaths has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 5, if/else 2 (4 pts), ternaries 3 (4 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cursor-login.createCursorLogin.finishPoll (cognitive 19) src/lib/cursor-login.js:82— cursor-login.createCursorLogin.finishPoll has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 3, boolean chains 2, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
cursor-config.decodeCursorSandUsageStatus (cognitive 19) src/lib/cursor-config.js:327— cursor-config.decodeCursorSandUsageStatus has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, 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.
rollout.listRolloutDayFiles (cognitive 19) REDACTED:149— rollout.listRolloutDayFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 2, 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.
rollout.activeCodexRolloutDates (cognitive 19) REDACTED:995— rollout.activeCodexRolloutDates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 3 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.enqueueTouchedProjectBuckets (cognitive 19) REDACTED:3983— rollout.enqueueTouchedProjectBuckets has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 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.
rollout.resolveClaudeScienceDbPaths (cognitive 19) REDACTED:7619— rollout.resolveClaudeScienceDbPaths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.findDshJsonProperty (cognitive 19) REDACTED:25088— rollout.findDshJsonProperty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 21 (39 pts), loops 5 (6 pts), boolean chains 4, ternaries 2 (3 pts), error handling 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. This shape REPEATS in the file: one other method here (rollout.findDshJsonProperty::valueEnd) 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.
claude-categorizer.extractExecCommands (cognitive 19) src/lib/claude-categorizer.js:96— claude-categorizer.extractExecCommands has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (7 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
V2CursorStore.materializeAllOpencodeState (cognitive 19) src/lib/cursor-store.js:570— V2CursorStore.materializeAllOpencodeState has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 2 (6 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
cursor-store.openCursorStore (cognitive 19) src/lib/cursor-store.js:25— cursor-store.openCursorStore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, 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.
pet-packages.readZipEntries (cognitive 19) src/lib/pet-packages.js:187— pet-packages.readZipEntries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 5, error handling 1, ternaries 1. Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 203, 243, 196, …). 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.
limits-cache.withLimitsCacheFallback (cognitive 19) src/lib/limits-cache.js:406— limits-cache.withLimitsCacheFallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 4 (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.
workbuddy-limits.fetchPlanQuota (cognitive 19) src/lib/workbuddy-limits.js:725— workbuddy-limits.fetchPlanQuota has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 3 (5 pts), loops 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 741). 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.
usage-limits.fetchClaudeUsageLimits (cognitive 19) src/lib/usage-limits.js:413— usage-limits.fetchClaudeUsageLimits has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
usage-limits.resolveCopilotAuthDbTokenFromRows (cognitive 19) src/lib/usage-limits.js:2065— usage-limits.resolveCopilotAuthDbTokenFromRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (usage-limits.resolveCopilotAuthDbTokenFromRowsAsync) 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.
usage-limits.resolveCopilotAuthDbTokenFromRowsAsync (cognitive 19) src/lib/usage-limits.js:2104— usage-limits.resolveCopilotAuthDbTokenFromRowsAsync has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (usage-limits.resolveCopilotAuthDbTokenFromRows) 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.
context-health.computeContextHealth (cognitive 19) src/lib/context-health.js:64— context-health.computeContextHealth has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 3 (4 pts), ternaries 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
status.formatSubscriptionLine (cognitive 19) src/commands/status.js:1587— status.formatSubscriptionLine has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 7, 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.
tokentracker-device-flow-poll.default (cognitive 19) dashboard/edge-patches/tokentracker-device-flow-poll.ts:60— tokentracker-device-flow-poll.default has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), error handling 2 (3 pts), ternaries 2, 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.
Badge3DCoin.Badge3DCoin (cognitive 19) dashboard/src/ui/achievements/Badge3DCoin.jsx:20— Badge3DCoin.Badge3DCoin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 7 function items inside it that branch (onPointerMove, onPointerEnd, onKeyDown, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
use-trend-data.fillMonthlyGaps (cognitive 19) dashboard/src/hooks/use-trend-data.ts:745— use-trend-data.fillMonthlyGaps has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (7 pts), boolean chains 6, 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.
RedeemProCode.RedeemProCode::perform (cognitive 19) dashboard/src/components/cloud/RedeemProCode.jsx:65— RedeemProCode.RedeemProCode::perform has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, 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. This shape REPEATS in the file: one other method here (RedeemProCode.RedeemProCode) 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.
cloud-usage-export.fetchCloudUsageExport (cognitive 19) dashboard/src/lib/cloud-usage-export.ts:41— cloud-usage-export.fetchCloudUsageExport has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
LocalDataSection.LocalDataSection (cognitive 19) dashboard/src/components/settings/LocalDataSection.jsx:25— LocalDataSection.LocalDataSection has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 5, error handling 3, ternaries 1 (2 pts) (nesting depth added 1). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 8 function items inside it that branch (run, a function literal at line 67, a function literal at line 89, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
mainUsageHourTotalsFromState (cognitive 19) src/commands/sync.js:7212— mainUsageHourTotalsFromState has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (7 pts), if/else 2 (4 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.
codexSparkFallbackCandidates (cognitive 19) src/lib/usage-limits.js:571— codexSparkFallbackCandidates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handleLocalApi::aggregateByDay (cognitive 19) REDACTED:622— handleLocalApi::aggregateByDay has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (8 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
fetchVariant (cognitive 19) src/lib/workbuddy-limits.js:845— fetchVariant has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 3, error handling 1 (nesting depth added 3). Of this number, 18 points are the body's own statements and 1 belongs to one function item 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.
loadGrokAuthEntry (cognitive 19) src/lib/grok-limits.js:187— loadGrokAuthEntry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 2 (4 pts), error handling 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.
upsertNotify (cognitive 19) src/lib/codex-config.js:60— upsertNotify has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (6 pts), boolean chains 5, error handling 1 (nesting depth added 7). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
aggregateSessionStates (cognitive 19) src/lib/account-usage-dedup.js:147— aggregateSessionStates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 2 (3 pts), other 2, ternaries 2 (nesting depth added 5). Of this number, 18 points are the body's own statements and 1 belongs 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.
pickLegacyRow (cognitive 19) src/lib/account-usage-dedup.js:188— pickLegacyRow has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, other 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.
sanitizeOutcome (cognitive 19) src/lib/outcomes-engine.js:37— sanitizeOutcome has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 3, loops 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.
detectPassiveProviders (cognitive 19) src/lib/passive-mode.js:93— detectPassiveProviders has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 16, other 3. Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 8 function items inside it that branch (logsPredicate, logsPredicate, logsPredicate, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
rollout.sameOpenclawFileGeneration (cognitive 18) REDACTED:2040— rollout.sameOpenclawFileGeneration has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (4 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
rollout.normalizeQoderNewTokens (cognitive 18) REDACTED:7165— rollout.normalizeQoderNewTokens has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 2 (4 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.
rollout.buildKiroModelTimeline (cognitive 18) REDACTED:8101— rollout.buildKiroModelTimeline has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 3 (6 pts), boolean chains 3, 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.
rollout.resolveZedDbPath (cognitive 18) REDACTED:13473— rollout.resolveZedDbPath has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 3 (6 pts), if/else 4 (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.
rollout.copilotOtelCursorHasLegacyCliUsage (cognitive 18) REDACTED:19501— rollout.copilotOtelCursorHasLegacyCliUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, error handling 1 (2 pts), ternaries 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
rollout.clearSourceHourlyBuckets (cognitive 18) REDACTED:21632— rollout.clearSourceHourlyBuckets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-config.hasHook (cognitive 18) src/lib/claude-config.js:143— claude-config.hasHook has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). Of this number, 15 points are the body's own statements and 3 belong to one function item 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.
codex-rollout-parser.isConservativeRangeCandidate (cognitive 18) REDACTED:247— codex-rollout-parser.isConservativeRangeCandidate has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 6. Of this number, 14 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
grok-context-breakdown.discoverGrokSessionFiles (cognitive 18) src/lib/grok-context-breakdown.js:132— grok-context-breakdown.discoverGrokSessionFiles has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
codex-token-refresh.refreshCodexTokens (cognitive 18) src/lib/codex-token-refresh.js:38— codex-token-refresh.refreshCodexTokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, error handling 1 (2 pts), ternaries 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.
opencode-go-limits.parseDataSlotFormat (cognitive 18) REDACTED:155— opencode-go-limits.parseDataSlotFormat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
qoder-limits.listRecentQoderLogs (cognitive 18) src/lib/qoder-limits.js:602— qoder-limits.listRecentQoderLogs has cognitive complexity 18 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 3 (5 pts), boolean chains 4, 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.
ark-coding-plan-limits.normalizeArkCodingPlanResponse (cognitive 18) src/lib/ark-coding-plan-limits.js:176— ark-coding-plan-limits.normalizeArkCodingPlanResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 2, 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.
ark-agent-plan-limits.normalizeArkAgentPlanResponse (cognitive 18) src/lib/ark-agent-plan-limits.js:151— ark-agent-plan-limits.normalizeArkAgentPlanResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 2, 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.
usage-limits.normalizeAntigravityResponse (cognitive 18) src/lib/usage-limits.js:3475— usage-limits.normalizeAntigravityResponse has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8, boolean chains 5, if/else 5. Of this number, 11 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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.
sync.mergeCopilotAppDbStates (cognitive 18) src/commands/sync.js:434— sync.mergeCopilotAppDbStates has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 1 (3 pts), loops 2 (3 pts), ternaries 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.
status.formatResolvedPaths (cognitive 18) src/commands/status.js:145— status.formatResolvedPaths has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (4 pts), ternaries 2 (3 pts), loops 2 (nesting depth added 7). Of this number, 12 points are the body's own statements and 6 belong to one function item 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.
tokentracker-account-daily.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-daily.ts:82— tokentracker-account-daily.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-account-devices.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-devices.ts:36— tokentracker-account-devices.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-account-heatmap.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-heatmap.ts:79— tokentracker-account-heatmap.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-account-hourly.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-hourly.ts:37— tokentracker-account-hourly.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-account-model-breakdown.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-model-breakdown.ts:124— tokentracker-account-model-breakdown.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-account-monthly.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-monthly.ts:37— tokentracker-account-monthly.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-account-summary.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-account-summary.ts:90— tokentracker-account-summary.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
tokentracker-device-rename.verifiedUserIdFromJwt (cognitive 18) dashboard/edge-patches/tokentracker-device-rename.ts:50— tokentracker-device-rename.verifiedUserIdFromJwt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, 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.
api.cachedAccountJsonGet (cognitive 18) dashboard/src/lib/api.ts:75— api.cachedAccountJsonGet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 2, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 96). 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.
build-share-card-data.buildShareCardData (cognitive 18) dashboard/src/ui/share/build-share-card-data.ts:87— build-share-card-data.buildShareCardData has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, ternaries 7 (9 pts) (nesting depth added 2). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. 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.
BotEngine.sample (cognitive 18) dashboard/src/lib/bot/engine.ts:424— BotEngine.sample has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8, if/else 4 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
DynamicIslandController.islandScreenHasFullscreenWindow (cognitive 18) TokenTrackerBar/TokenTrackerBar/Services/DynamicIslandController.swift:672— DynamicIslandController.islandScreenHasFullscreenWindow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runSyncCommand (cognitive 18) src/lib/local-api.js:884— runSyncCommand has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 4, ternaries 2, other 1. None of this is in the body itself: all 18 points belong to 7 function items inside it that branch (a function literal at line 885, a function literal at line 927, (anonymous)::finish, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
openWorkbuddyIpc::(anonymous)::onPacket (cognitive 18) src/lib/workbuddy-ipc.js:123— openWorkbuddyIpc::(anonymous)::onPacket has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerManager.StartServerOnceAsync (cognitive 17) TokenTrackerWin/ServerManager.cs:140— ServerManager.StartServerOnceAsync has cognitive complexity 17 (threshold 15). 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.
ServerManager.StartDirectSync (cognitive 17) TokenTrackerWin/ServerManager.cs:231— ServerManager.StartDirectSync has cognitive complexity 17 (threshold 15). 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.
codex-model-attribution.applyCodexModelEvent (cognitive 17) src/lib/codex-model-attribution.js:80— codex-model-attribution.applyCodexModelEvent has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 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.
rollout.buildProjectFileContext (cognitive 17) REDACTED:4886— rollout.buildProjectFileContext has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 3 (4 pts), boolean chains 3, 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.
rollout.resolveCraftSessionFiles (cognitive 17) REDACTED:18143— rollout.resolveCraftSessionFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
claude-categorizer.computeClaudeCategoryBreakdown (cognitive 17) src/lib/claude-categorizer.js:628— claude-categorizer.computeClaudeCategoryBreakdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, loops 3, error handling 1, ternaries 1 (nesting depth added 3). Of this number, 11 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-usage-transfer.createLocalUsageTransfer.ownRows (cognitive 17) src/lib/local-usage-transfer.js:134— local-usage-transfer.createLocalUsageTransfer.ownRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (3 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.
opencode-status.parseOpenCodeStatusPayload (cognitive 17) src/lib/opencode-status.js:42— opencode-status.parseOpenCodeStatusPayload has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 2, 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.
grok-limits.normalizeGrokProductUsage (cognitive 17) src/lib/grok-limits.js:589— grok-limits.normalizeGrokProductUsage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zcode-limits.fetchZcodeBilling (cognitive 17) REDACTED:716— zcode-limits.fetchZcodeBilling has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 2 (6 pts), boolean chains 3, 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.
session-performance.createClaudePerformanceCollector.finish (cognitive 17) src/lib/session-performance.js:93— session-performance.createClaudePerformanceCollector.finish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 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.
session-analytics.analyticsEntryStatKey (cognitive 17) src/lib/session-analytics.js:2286— session-analytics.analyticsEntryStatKey has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 2 (3 pts) (nesting depth added 1). Of this number, 13 points are the body's own statements and 4 belong to 3 function literals inside it that branch. 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.
context-health.walkNamedFiles (cognitive 17) src/lib/context-health.js:25— context-health.walkNamedFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.scanClaudeProjects (cognitive 17) src/lib/local-api.js:1036— local-api.scanClaudeProjects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (10 pts), error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local-api.createLocalApiHandler (cognitive 17) src/lib/local-api.js:1159— local-api.createLocalApiHandler has cognitive complexity 17 (threshold 15). Drivers by points: if/else 116 (161 pts), boolean chains 81, ternaries 23 (31 pts), error handling 15, loops 8 (11 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (local-api.createLocalApiHandler::captureSetCookies, local-api.createLocalApiHandler::tryServeAccountView, local-api.createLocalApiHandler::buildRelayCookieHeader) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
sync.normalizeIsoOrEpoch (cognitive 17) src/commands/sync.js:4274— sync.normalizeIsoOrEpoch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 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.
wrapped.renderAscii (cognitive 17) src/commands/wrapped.js:43— wrapped.renderAscii has cognitive complexity 17 (threshold 15). Drivers by points: loops 5 (11 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.
waffo.confirmExpiredUnusedWaffoCheckout (cognitive 17) REDACTED:662— waffo.confirmExpiredUnusedWaffoCheckout has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, 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.
tokentracker-paddle-webhook.default (cognitive 17) dashboard/edge-patches/tokentracker-paddle-webhook.ts:21— tokentracker-paddle-webhook.default has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, error handling 2, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 13 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
tokentracker-user-badges-refresh.default (cognitive 17) dashboard/edge-patches/tokentracker-user-badges-refresh.ts:72— tokentracker-user-badges-refresh.default has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 6, boolean chains 3, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
format.formatUsdCurrency (cognitive 17) dashboard/src/lib/format.ts:174— format.formatUsdCurrency has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 3, ternaries 3, error handling 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.
mock-data.buildDailyRows (cognitive 17) dashboard/src/lib/mock-data.ts:158— mock-data.buildDailyRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 4, 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.
cloud-sync.rebuildCloudDeviceUsage (cognitive 17) dashboard/src/lib/cloud-sync.ts:209— cloud-sync.rebuildCloudDeviceUsage has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 8, 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.
Sidebar.MobileDrawer (cognitive 17) dashboard/src/ui/components/Sidebar.jsx:450— Sidebar.MobileDrawer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 3. Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 464, 490, 456, …). 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.
LeaderboardSummaryCard.LeaderboardMeChip (cognitive 17) dashboard/src/components/LeaderboardSummaryCard.jsx:34— LeaderboardSummaryCard.LeaderboardMeChip has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, ternaries 7 (8 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.
detail-sort.compareIntLike (cognitive 17) dashboard/src/lib/detail-sort.ts:17— detail-sort.compareIntLike has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 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.
BotAnimated.BotAnimated (cognitive 17) dashboard/src/ui/foundation/BotAnimated.jsx:87— BotAnimated.BotAnimated has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8, if/else 5, boolean chains 4. Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 144, a function literal at line 164, a function literal at line 169, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
UsageLimitsView.body (cognitive 17) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:80— UsageLimitsView.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
resolveZcodeDbRebuildFloorMs (cognitive 17) src/commands/sync.js:5067— resolveZcodeDbRebuildFloorMs has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 3 (4 pts), error handling 2 (3 pts), boolean chains 1, loops 1, other 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.
normalizeAntigravityQuotaSummary (cognitive 17) src/lib/usage-limits.js:3535— normalizeAntigravityQuotaSummary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 5, loops 2 (3 pts), ternaries 3 (nesting depth added 2). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
buildSessionBrowserFacets (cognitive 17) src/lib/session-analytics.js:3272— buildSessionBrowserFacets has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, 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.
isGenerationMetadata (cognitive 17) src/lib/cursor-store.js:1207— isGenerationMetadata has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
opencodeStateForNamespace (cognitive 17) src/lib/cursor-store.js:1568— opencodeStateForNamespace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, 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.
validateProjectSummary (cognitive 17) src/lib/cursor-store.js:1673— validateProjectSummary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (2 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.
importLocalSkill (cognitive 17) src/lib/skills-manager.js:1143— importLocalSkill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
localDataApiPlugin.configureServer (cognitive 17) REDACTED:1229— localDataApiPlugin.configureServer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, error handling 2 (4 pts) (nesting depth added 4). None of this is in the body itself: all 17 points belong to 3 function literals inside it that branch (lines 1231, 1279, 1285). 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.
dayKeyFromIso (cognitive 17) src/lib/grok-context-breakdown.js:80— dayKeyFromIso has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, 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.
openValidatedResumeFile (cognitive 17) src/lib/codex-context-breakdown.js:295— openValidatedResumeFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 6, error handling 2 (3 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.
createLocalUsageTransfer.ownRows (cognitive 17) src/lib/local-usage-transfer.js:134— createLocalUsageTransfer.ownRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (3 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.
publishCloudPromptBilling (cognitive 17) dashboard/src/lib/cloud-prompt-policy.js:56— publishCloudPromptBilling has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5, ternaries 2 (4 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.
createClaudePerformanceCollector.finish (cognitive 17) src/lib/session-performance.js:93— createClaudePerformanceCollector.finish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 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.
QuotaWidgetWindow.ReceiveMessage (cognitive 16) TokenTrackerWin/QuotaWidgetWindow.cs:235— QuotaWidgetWindow.ReceiveMessage has cognitive complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs 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.
rollout.isProjectFileContextFresh (cognitive 16) REDACTED:4914— rollout.isProjectFileContextFresh has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, ternaries 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.clampAndCapKiroCliState (cognitive 16) REDACTED:9989— rollout.clampAndCapKiroCliState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 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.
rollout.resolveCodebuddyProjectFiles (cognitive 16) REDACTED:10740— rollout.resolveCodebuddyProjectFiles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15 (34 pts), error handling 4 (14 pts), boolean chains 10, loops 3 (6 pts), ternaries 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (rollout.resolveCodebuddyProjectFiles::walkLogs) 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.
rollout.lmstudioBalancedObjectEnd (cognitive 16) REDACTED:13900— rollout.lmstudioBalancedObjectEnd has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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.
rollout.extractDroidModelFromSidecarJsonl (cognitive 16) REDACTED:16192— rollout.extractDroidModelFromSidecarJsonl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 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.
rollout.resolveGrokBuildSessions (cognitive 16) REDACTED:21228— rollout.resolveGrokBuildSessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 3 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.grokTimestampToIso (cognitive 16) REDACTED:21382— rollout.grokTimestampToIso has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.listAntigravitySessionFilesWithStatus (cognitive 16) REDACTED:22242— rollout.listAntigravitySessionFilesWithStatus has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, error handling 2 (3 pts), 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.
rollout.decodeAntigravityVarint (cognitive 16) REDACTED:23081— rollout.decodeAntigravityVarint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rollout.readAntigravityConversationDb (cognitive 16) REDACTED:23249— rollout.readAntigravityConversationDb has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 3, error handling 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
claude-config.removeClaudeHooks (cognitive 16) src/lib/claude-config.js:54— claude-config.removeClaudeHooks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init.cmdInit (cognitive 16) src/commands/init.js:172— init.cmdInit has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), error handling 2, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cloud-usage-reset.resetCloudDeviceUsage (cognitive 16) src/lib/cloud-usage-reset.js:55— cloud-usage-reset.resetCloudDeviceUsage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 5. Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
V2CursorStore.loadCodexFilesForPaths (cognitive 16) src/lib/cursor-store.js:299— V2CursorStore.loadCodexFilesForPaths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (5 pts), loops 3 (4 pts), ternaries 2 (4 pts), error handling 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.
accept-encoding.parseAcceptEncoding (cognitive 16) src/lib/accept-encoding.js:4— accept-encoding.parseAcceptEncoding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (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.
index.computeModelPricingInfo (cognitive 16) src/lib/pricing/index.js:159— index.computeModelPricingInfo has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 6, if/else 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.
codex-context-breakdown.selectAppendHashPaths (cognitive 16) src/lib/codex-context-breakdown.js:240— codex-context-breakdown.selectAppendHashPaths has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (6 pts), loops 1, ternaries 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.
grok-context-breakdown.timestampToIso (cognitive 16) src/lib/grok-context-breakdown.js:62— grok-context-breakdown.timestampToIso has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
workbuddy-limits.fetchVariantLive (cognitive 16) src/lib/workbuddy-limits.js:799— workbuddy-limits.fetchVariantLive has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (4 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.
usage-limits.fetchCopilotLimits (cognitive 16) src/lib/usage-limits.js:2292— usage-limits.fetchCopilotLimits has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4, ternaries 2 (3 pts), error handling 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.
usage-limits.fetchAntigravityQuotaSummaryJson (cognitive 16) src/lib/usage-limits.js:3965— usage-limits.fetchAntigravityQuotaSummaryJson has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, error handling 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.
pi-session.piSessionProbe (cognitive 16) src/lib/pi-session.js:353— pi-session.piSessionProbe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills-manager.readYamlField (cognitive 16) src/lib/skills-manager.js:255— skills-manager.readYamlField has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skills-manager.searchSkillsSh (cognitive 16) src/lib/skills-manager.js:1235— skills-manager.searchSkillsSh has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 2 (3 pts), ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 1245). 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.
sync.parseArgs (cognitive 16) src/commands/sync.js:3849— sync.parseArgs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 1, 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.
sync.scanForInterleavedCodexUsage (cognitive 16) src/commands/sync.js:6814— sync.scanForInterleavedCodexUsage has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 3 (6 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.
wechat.normalizeWechatEvent (cognitive 16) dashboard/edge-patches/cloud/wechat.ts:243— wechat.normalizeWechatEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tokentracker-device-token-issue.verifiedUserIdFromJwt (cognitive 16) dashboard/edge-patches/tokentracker-device-token-issue.ts:49— tokentracker-device-token-issue.verifiedUserIdFromJwt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, 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.
tokentracker-profile-likes.verifiedUserIdFromJwt (cognitive 16) dashboard/edge-patches/tokentracker-profile-likes.ts:95— tokentracker-profile-likes.verifiedUserIdFromJwt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, 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.
tokentracker-public-visibility.verifiedUserIdFromJwt (cognitive 16) dashboard/edge-patches/tokentracker-public-visibility.ts:42— tokentracker-public-visibility.verifiedUserIdFromJwt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, 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.
tokentracker-telemetry.default (cognitive 16) dashboard/edge-patches/tokentracker-telemetry.ts:37— tokentracker-telemetry.default has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 5, boolean chains 1, error handling 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.
insforge-deployment-config.validateInsforgeDeployment (cognitive 16) dashboard/src/lib/insforge-deployment-config.mjs:16— insforge-deployment-config.validateInsforgeDeployment has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 2, error handling 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.
use-trend-data.buildHourlySlotLabels (cognitive 16) dashboard/src/hooks/use-trend-data.ts:622— use-trend-data.buildHourlySlotLabels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AccountViewContext.AccountViewProvider (cognitive 16) dashboard/src/contexts/AccountViewContext.jsx:37— AccountViewContext.AccountViewProvider has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 3. Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 105, 61, 69, …). 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.
use-activity-heatmap.useActivityHeatmap (cognitive 16) dashboard/src/hooks/use-activity-heatmap.ts:18— use-activity-heatmap.useActivityHeatmap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 3 (4 pts) (nesting depth added 2). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 354, 124). 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.
detail-sort.parseHourKey (cognitive 16) dashboard/src/lib/detail-sort.ts:75— detail-sort.parseHourKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 7. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ContextBreakdownPanel.normalizeExecRows (cognitive 16) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:323— ContextBreakdownPanel.normalizeExecRows has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, ternaries 2. Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 325, 349). 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.
ContextBreakdownPanel.Row (cognitive 16) dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:399— ContextBreakdownPanel.Row has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnnualReportCard.groupMonths (cognitive 16) dashboard/src/ui/share/variants/AnnualReportCard.jsx:73— AnnualReportCard.groupMonths has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SettingsPage.SettingsPage (cognitive 16) dashboard/src/pages/SettingsPage.jsx:58— SettingsPage.SettingsPage has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 2. Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
pet-quips.getPetLimitDisplay (cognitive 16) dashboard/src/lib/pet-quips.js:506— pet-quips.getPetLimitDisplay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NativeQAProfile.load (cognitive 16) TokenTrackerBar/Shared/NativeQAProfile.swift:76— NativeQAProfile.load has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, 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.
UsageLimitsResponse.isProviderAvailable (cognitive 16) TokenTrackerBar/TokenTrackerBar/Models/MenuBarDisplayPreferences.swift:203— UsageLimitsResponse.isProviderAvailable has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, if/else 1, match/switch 1. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
NativeBridge.applyPetSetting (cognitive 16) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:505— NativeBridge.applyPetSetting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 1 (3 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.
ClawdCompanionView.drawWorkingUltrathink (cognitive 16) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:904— ClawdCompanionView.drawWorkingUltrathink has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), loops 4, boolean chains 2, if/else 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.
ClawdCompanionView.startIdleVariantLoop (cognitive 16) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1878— ClawdCompanionView.startIdleVariantLoop has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
UsageTrendChart.body (cognitive 16) TokenTrackerBar/TokenTrackerBar/Views/UsageTrendChart.swift:162— UsageTrendChart.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 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.
_draw (cognitive 16) TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:586— _draw has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), boolean chains 2, other 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.
fetchTraeCnUsage (cognitive 16) src/lib/trae-cn-config.js:455— fetchTraeCnUsage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1, other 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.
accessTokenFromRefreshPayload (cognitive 16) src/lib/cloud-account.js:44— accessTokenFromRefreshPayload has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, ternaries 2, 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.
refreshTokenFromRefreshPayload (cognitive 16) src/lib/cloud-account.js:56— refreshTokenFromRefreshPayload has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, ternaries 2, 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.
startLocalCallbackServer (cognitive 16) src/lib/browser-auth.js:29— startLocalCallbackServer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 1. Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 39, 119, 34, …). 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.
D4 · Code Duplication· Near-duplicate member family (3 members, 7 shared lines) · ×1
Near-duplicate member family (3 members, 7 shared lines) TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:29— TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:29-47 | TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:147-190 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1241-1279 — These 3 members are variants of one another: a block of 7 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:43— TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:43-54 | TokenTrackerBar/TokenTrackerBar/Models/HourlyUsage.swift:41-52 | TokenTrackerBar/TokenTrackerBar/Models/MonthlyUsage.swift:43-54 | TokenTrackerBar/TokenTrackerBar/Models/TokenTotals.swift:32-43 — 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 (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:811— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:811-855 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:857-902 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:768— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:768-809 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1113-1164 — 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 copies of one member (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:744— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:744-766 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1257-1273 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1275-1292 — 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 copy of a member (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/BoltShape.swift:6— TokenTrackerBar/TokenTrackerBar/Views/BoltShape.swift:6-50 | TokenTrackerBar/generate_menubar_icon.swift:5-40 — 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, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1179— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1179-1196 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1198-1217 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1219-1233 — 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.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×1
Edited copy of a member (20 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:192— TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:192-211 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1281-1302 — 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 (14 corresponding lines) · ×1
Edited copy of a member (14 corresponding lines) TokenTrackerBar/TokenTrackerBar/Utilities/TokenFormatter.swift:19— TokenTrackerBar/TokenTrackerBar/Utilities/TokenFormatter.swift:19-37 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetTheme.swift:60-73 — 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.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×1
Edited copy of a member (27 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/DashboardLoadFailureView.swift:17— TokenTrackerBar/TokenTrackerBar/Views/DashboardLoadFailureView.swift:17-44 | TokenTrackerBar/TokenTrackerBar/Views/ServerOfflineView.swift:8-34 — 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 (13 corresponding lines) · ×1
Edited copy of a member (13 corresponding lines) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:613— TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:613-625 | TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:696-709 — 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 (26 corresponding lines) · ×1
Edited copy of a member (26 corresponding lines) TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:190— TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:190-222 | TokenTrackerBar/TokenTrackerBar/Services/MenuBarAnimator.swift:232-257 — 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 copies of one member (6 members, 7+ corresponding lines) · ×1
Edited copies of one member (6 members, 7+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:543— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:543-549 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:551-557 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:601-607 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:659-665 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:667-673 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:682-689 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×1
Edited copy of a member (17 corresponding lines) TokenTrackerLinux/src-tauri/src/server.rs:113— TokenTrackerLinux/src-tauri/src/server.rs:113-129 | TokenTrackerLinux/src-tauri/src/server.rs:589-606 — 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.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:562— TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:562-571 | TokenTrackerBar/TokenTrackerBar/Services/StatusBarController.swift:573-582 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×1
Edited copy of a member (8 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/ActivityHeatmapView.swift:171— TokenTrackerBar/TokenTrackerBar/Views/ActivityHeatmapView.swift:171-178 | TokenTrackerBar/TokenTrackerBar/Views/ActivityHeatmapView.swift:198-205 — 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.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×1
Edited copy of a member (6 corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift:35— TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift:35-40 | TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift:55-60 — 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.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×1
Edited copy of a member (15 corresponding lines) TokenTrackerBar/TokenTrackerBar/Views/DashboardView.swift:73— TokenTrackerBar/TokenTrackerBar/Views/DashboardView.swift:73-87 | TokenTrackerBar/TokenTrackerBar/Views/ServerOfflineView.swift:39-53 — 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 copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:12— TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:12-17 | TokenTrackerBar/TokenTrackerBar/Models/HourlyUsage.swift:11-15 | TokenTrackerBar/TokenTrackerBar/Models/MonthlyUsage.swift:12-17 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 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, 9+ corresponding lines) · ×1
Edited copies of one member (4 members, 9+ corresponding lines) TokenTrackerBar/TokenTrackerWidget/Widgets/HeatmapWidget.swift:11— TokenTrackerBar/TokenTrackerWidget/Widgets/HeatmapWidget.swift:11-19 | TokenTrackerBar/TokenTrackerWidget/Widgets/SummaryWidget.swift:13-21 | TokenTrackerBar/TokenTrackerWidget/Widgets/TopModelsWidget.swift:10-18 | TokenTrackerBar/TokenTrackerWidget/Widgets/UsageLimitsWidget.swift:11-19 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 3+ corresponding lines) · ×1
Edited copies of one member (3 members, 3+ corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift:10— TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift:10-12 | TokenTrackerBar/TokenTrackerBar/Models/UsageSummary.swift:10-12 | TokenTrackerBar/TokenTrackerBar/Models/UsageSummary.swift:55-57 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 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, 9+ corresponding lines) · ×1
Edited copies of one member (6 members, 9+ corresponding lines) TokenTrackerWin/NativeLocalization.cs:63— TokenTrackerWin/NativeLocalization.cs:63-76 | TokenTrackerWin/NativeTheme.cs:57-70 | TokenTrackerWin/PetWindow.cs:919-927 | TokenTrackerWin/PetWindow.cs:1097-1105 | TokenTrackerWin/PetWindow.cs:1111-1119 | TokenTrackerWin/TokenUnits.cs:47-55 — These 6 members are one piece of code written 6 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 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) TokenTrackerWin/AutoUpdatePolicy.cs:39— TokenTrackerWin/AutoUpdatePolicy.cs:39-52 | TokenTrackerWin/NativeLocalization.cs:50-60 | TokenTrackerWin/NativeTheme.cs:44-54 | TokenTrackerWin/TokenUnits.cs:33-44 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:8— TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:8-10 | TokenTrackerBar/TokenTrackerBar/Models/MonthlyUsage.swift:8-10 — 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 (8 lines × 5) TokenTrackerWin/AutoUpdatePolicy.cs:55— TokenTrackerWin/AutoUpdatePolicy.cs:55-65 | TokenTrackerWin/Currency.cs:73-80 | TokenTrackerWin/NativeLocalization.cs:79-89 | TokenTrackerWin/NativeTheme.cs:73-83 | TokenTrackerWin/TokenUnits.cs:58-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 all 5 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 (14–21 lines × 2) TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:250— TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:250-263 | TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:277-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 `TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift: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.
Duplicated block (16–17 lines × 2) TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:203— TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:203-218 | TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:233-249 — both copies are in the same file, so extract the 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 `TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:203` 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, `TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:202` calls `NSHomeDirectory` and `TokenTrackerBar/TokenTrackerBar/Services/ServerManager.swift:232` 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–15 lines × 2) TokenTrackerBar/TokenTrackerBar/Models/MenuBarDisplayPreferences.swift:149— TokenTrackerBar/TokenTrackerBar/Models/MenuBarDisplayPreferences.swift:149-161 | TokenTrackerBar/TokenTrackerBar/Models/MenuBarDisplayPreferences.swift:360-374 — both copies are in the same file, so extract the 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 `TokenTrackerBar/TokenTrackerBar/Models/MenuBarDisplayPreferences.swift:149` 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) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1309— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1309-1322 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1324-1337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:536— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:536-548 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:626-637 — both copies are in the same file, so extract the 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 `TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:536` 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–10 lines × 2) TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:792— TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:792-801 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:884-891 — both copies are in the same file, so extract the 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 `TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:792` 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 × 4) TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:65— TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:65-73 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:75-83 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:85-93 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:95-103 — 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. 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–9 lines × 3) TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:137— TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:137-145 | TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:381-388 | TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:425-432 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:134` calls `makeFullWindowBackground`, `addSubview` and `TokenTrackerBar/TokenTrackerBar/Services/DashboardWindowController.swift:424` 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 (6–8 lines × 6) TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:371— TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:371-378 | TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:405-412 | TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:428-435 | TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:447-454 | TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:461-468 | TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:472-477 — 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 `TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:371` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:370` calls `LimitProvider` and `TokenTrackerBar/TokenTrackerBar/Services/WidgetSnapshotWriter.swift:472` 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 (7 lines × 3) TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:30— TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:30-36 | TokenTrackerBar/TokenTrackerBar/Views/LimitsSettingsView.swift:152-158 | TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift:1246-1252 — 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 `TokenTrackerBar/TokenTrackerBar/Models/WeeklyLimitResetDetector.swift:30` 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 (4–6 lines × 3) TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:354— TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:354-357 | TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:618-623 | TokenTrackerBar/TokenTrackerBar/Services/NativeBridge.swift:702-707 — 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. 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 (2–5 lines × 12) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:674— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:674-678 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:817-821 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:866-868 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:914-916 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1065-1069 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1169-1171 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1182-1184 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1201-1203 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1222-1224 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1238-1240 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1263-1264 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1281-1282 — all 12 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 `TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:674` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:822` calls `fill`, `Path`, `r` and `TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:916` 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 (1–5 lines × 25) TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:179— TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:179-184 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:250-250 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:251-251 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:255-260 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:422-427 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:443-448 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:504-504 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:505-505 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:508-508 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:509-509 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:517-517 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:518-518 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:572-572 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:573-573 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:583-583 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:584-584 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:585-585 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:586-586 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:590-594 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:597-600 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:604-608 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:611-614 | TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:617-620 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:48-48 | TokenTrackerBar/TokenTrackerWidget/Views/WidgetStrings.swift:49-49 — there are 25 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 25 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:179` 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. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:185` calls `codexResetBankLabel` and `TokenTrackerBar/TokenTrackerBar/Utilities/Strings.swift:504` 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 (3–5 lines × 3) TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:754— TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:754-758 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:779-783 | TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:1122-1124 — 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 `TokenTrackerBar/TokenTrackerBar/Views/ClawdCompanionView.swift:754` 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 (3–12 lines × 5) TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:43— TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:43-54 | TokenTrackerBar/TokenTrackerBar/Models/HourlyUsage.swift:41-52 | TokenTrackerBar/TokenTrackerBar/Models/MonthlyUsage.swift:43-54 | TokenTrackerBar/TokenTrackerBar/Models/TokenTotals.swift:34-36 | TokenTrackerBar/TokenTrackerBar/Models/TokenTotals.swift:37-39 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `TokenTrackerBar/TokenTrackerBar/Models/TokenTotals.swift:33` calls `container`, `decodeIfPresent` and `TokenTrackerBar/TokenTrackerBar/Models/DailyUsage.swift:43` 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.
Coverage not measured — .NET suite — Coverage NOT MEASURED: the .NET half could not be measured — the coverage run wrote reports, but they instrument no source line — nothing was measured; the JavaScript/TypeScript half measured 92.1% (node:test via `npm ci --ignore-scripts` in the repository root, the 3 run(s) test reliability made; its `test:icons` script (`node --test test/sync-tauri-icon.test.mjs`) under node's V8 coverage via `npm ci --ignore-scripts` in TokenTrackerLinux/). This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
Duplication concentrated across 4 sibling directories (46 clone groups) REDACTED:50— 46 duplicated blocks under the repository root have copies in at least two of the sibling directories TokenTrackerLinux, dashboard, scripts, src — 34 of them are reported below, and 12 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 46 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 46 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 46 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 6 sibling directories (39 clone groups) dashboard/src/hooks/use-trend-data.ts:871— 39 duplicated blocks under dashboard/src/ have copies in at least two of the sibling directories components, contexts, hooks, lib, pages, ui — 20 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 39 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 39 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 39 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 2 sibling directories (12 clone groups) src/commands/uninstall.js:50— 12 duplicated blocks under src/ have copies in at least two of the sibling directories commands, lib — 10 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Wholesale file copy (576 identical lines × 2 files) dashboard/edge-patches/tokentracker-account-daily.ts:5— dashboard/edge-patches/tokentracker-account-daily.ts:5 · dashboard/edge-patches/tokentracker-account-summary.ts:32 — these 2 files are line-for-line copies of one another — 576 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (258 matched lines × 2 locations) · ×1
Duplicated block with local edits (258 matched lines × 2 locations) dashboard/src/hooks/use-trend-data.ts:33— dashboard/src/hooks/use-trend-data.ts:33 · dashboard/src/hooks/use-usage-data.ts:27 — the two spans are one implementation copied and then locally edited — 1611 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Wholesale file copy (215 identical lines × 2 files) src/lib/ark-agent-plan-limits.js:24— src/lib/ark-agent-plan-limits.js:24 · src/lib/ark-coding-plan-limits.js:24 — these 2 files are line-for-line copies of one another — 215 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (131 matched lines × 2 locations) · ×1
Duplicated block with local edits (131 matched lines × 2 locations) REDACTED:13598— REDACTED:13598 · REDACTED:15821 — the two spans are one implementation copied and then locally edited — 879 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (125 matched lines × 2 locations) · ×1
Duplicated block with local edits (125 matched lines × 2 locations) src/lib/omp-session.js:219— src/lib/omp-session.js:219 · src/lib/pi-session.js:427 — the two spans are one implementation copied and then locally edited — 1014 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (119 matched lines × 2 locations) · ×1
Duplicated block with local edits (119 matched lines × 2 locations) src/lib/omp-session.js:17— src/lib/omp-session.js:17 · src/lib/pi-session.js:22 — the two spans are one implementation copied and then locally edited — 864 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (114 matched lines × 2 locations) · ×1
Duplicated block with local edits (114 matched lines × 2 locations) dashboard/edge-patches/tokentracker-account-hourly.ts:81— dashboard/edge-patches/tokentracker-account-hourly.ts:81 · dashboard/edge-patches/tokentracker-account-monthly.ts:68 — the two spans are one implementation copied and then locally edited — 925 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (110 matched lines × 2 locations) · ×1
Duplicated block with local edits (110 matched lines × 2 locations) dashboard/src/hooks/use-activity-heatmap.ts:41— dashboard/src/hooks/use-activity-heatmap.ts:41 · dashboard/src/hooks/use-usage-model-breakdown.ts:26 — the two spans are one implementation copied and then locally edited — 685 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (63 matched lines × 2 locations) · ×1
Duplicated block with local edits (63 matched lines × 2 locations) REDACTED:2734— REDACTED:2734 · REDACTED:3076 — the two spans are one implementation copied and then locally edited — 321 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (59 lines × 2 locations) REDACTED:50— REDACTED:50 · scripts/copy-sync.cjs:68 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication· Duplicated block with local edits (59 matched lines × 2 locations) · ×1
Duplicated block with local edits (59 matched lines × 2 locations) scripts/copy-sync.cjs:68— scripts/copy-sync.cjs:68 · scripts/validate-copy-registry.cjs:10 — the two spans are one implementation copied and then locally edited — 343 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (58 matched lines × 2 locations) · ×1
Duplicated block with local edits (58 matched lines × 2 locations) REDACTED:12236— REDACTED:12236 · REDACTED:17306 — the two spans are one implementation copied and then locally edited — 310 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (57 lines × 3 locations) dashboard/edge-patches/tokentracker-account-devices.ts:14— dashboard/edge-patches/tokentracker-account-devices.ts:14 · dashboard/edge-patches/tokentracker-account-hourly.ts:8 · dashboard/edge-patches/tokentracker-account-monthly.ts:8 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
R10 · Code Duplication· Duplicated block with local edits (56 matched lines × 2 locations) · ×1
Duplicated block with local edits (56 matched lines × 2 locations) src/lib/claude-config.js:39— src/lib/claude-config.js:39 · src/lib/gemini-config.js:47 — the two spans are one implementation copied and then locally edited — 439 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (55 lines × 3 locations) dashboard/edge-patches/tokentracker-account-daily.ts:8— dashboard/edge-patches/tokentracker-account-daily.ts:8 · dashboard/edge-patches/tokentracker-account-heatmap.ts:9 · dashboard/edge-patches/tokentracker-account-summary.ts:35 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
Duplicated block (55 lines × 2 locations) dashboard/src/hooks/use-trend-data.ts:89— dashboard/src/hooks/use-trend-data.ts:89 · dashboard/src/hooks/use-usage-model-breakdown.ts:38 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (54 lines × 2 locations) REDACTED:12804— REDACTED:12804 · REDACTED:16798 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Wholesale file copy (53 identical lines × 2 files) dashboard/src/lib/heatmap-compact.js:2— dashboard/src/lib/heatmap-compact.js:2 · src/lib/heatmap-compact.js:27 — these 2 files are line-for-line copies of one another — 53 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (49 matched lines × 2 locations) · ×1
Duplicated block with local edits (49 matched lines × 2 locations) dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx:140— dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx:140 · REDACTED:190 — the two spans are one implementation copied and then locally edited — 247 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (46 lines × 2 locations) src/lib/omp-session.js:399— src/lib/omp-session.js:399 · src/lib/pi-session.js:616 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (45 matched lines × 2 locations) · ×1
Duplicated block with local edits (45 matched lines × 2 locations) src/lib/workbuddy-limits.js:550— src/lib/workbuddy-limits.js:550 · REDACTED:1098 — the two spans are one implementation copied and then locally edited — 369 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (43 lines × 2 locations) src/commands/init.js:442— src/commands/init.js:442 · src/commands/init.js:486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (42 lines × 2 locations) src/commands/sync.js:2052— src/commands/sync.js:2052 · src/commands/sync.js:2121 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (38 lines × 5 locations) dashboard/edge-patches/tokentracker-account-daily.ts:477— dashboard/edge-patches/tokentracker-account-daily.ts:477 · dashboard/edge-patches/tokentracker-account-model-breakdown.ts:496 · dashboard/edge-patches/tokentracker-account-summary.ts:463 · dashboard/edge-patches/tokentracker-leaderboard-profile.ts:435 · +1 more site(s) not listed — the 5 copies are spread across 5 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (35 lines × 2 locations) src/commands/sync.js:5988— src/commands/sync.js:5988 · src/commands/sync.js:6158 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (34 matched lines × 2 locations) · ×1
Duplicated block with local edits (34 matched lines × 2 locations) src/commands/uninstall.js:50— src/commands/uninstall.js:50 · src/lib/diagnostics.js:88 — the two spans are one implementation copied and then locally edited — 252 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function cmdSync (cyclomatic 710, cognitive 1096) src/commands/sync.js:553— cmdSync has cyclomatic complexity 710 and cognitive complexity 1096; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleLocalApi (cyclomatic 645, cognitive 1058) src/lib/local-api.js:1886— handleLocalApi has cyclomatic complexity 645 and cognitive complexity 1058; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function cmdStatus (cyclomatic 381, cognitive 455) src/commands/status.js:198— cmdStatus has cyclomatic complexity 381 and cognitive complexity 455; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseAntigravityIncremental (cyclomatic 248, cognitive 355) REDACTED:22484— parseAntigravityIncremental has cyclomatic complexity 248 and cognitive complexity 355; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function CloudCheckoutPage (cyclomatic 207, cognitive 170) dashboard/src/pages/CloudCheckoutPage.jsx:49— CloudCheckoutPage has cyclomatic complexity 207 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseDshIncremental (cyclomatic 181, cognitive 234) REDACTED:25411— parseDshIncremental has cyclomatic complexity 181 and cognitive complexity 234; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function fetchUsageLimitsUncached (cyclomatic 156, cognitive 225) src/lib/usage-limits.js:4478— fetchUsageLimitsUncached has cyclomatic complexity 156 and cognitive complexity 225; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseWorkbuddyIncremental (cyclomatic 152, cognitive 212) REDACTED:11601— parseWorkbuddyIncremental has cyclomatic complexity 152 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseCodexRolloutFile (cyclomatic 151, cognitive 212) REDACTED:590— parseCodexRolloutFile has cyclomatic complexity 151 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseGrokBuildIncremental (cyclomatic 141, cognitive 239) REDACTED:21746— parseGrokBuildIncremental has cyclomatic complexity 141 and cognitive complexity 239; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleLocalApi (cyclomatic 133, cognitive 177) REDACTED:528— handleLocalApi has cyclomatic complexity 133 and cognitive complexity 177; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildSessionAnalyticsInternal (cyclomatic 126, cognitive 152) src/lib/session-analytics.js:2387— buildSessionAnalyticsInternal has cyclomatic complexity 126 and cognitive complexity 152; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseRolloutIncremental (cyclomatic 123, cognitive 148) REDACTED:325— parseRolloutIncremental has cyclomatic complexity 123 and cognitive complexity 148; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function enqueueTouchedBuckets (cyclomatic 122, cognitive 230) REDACTED:3598— enqueueTouchedBuckets has cyclomatic complexity 122 and cognitive complexity 230; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseRolloutRecords (cyclomatic 112, cognitive 173) REDACTED:2561— parseRolloutRecords has cyclomatic complexity 112 and cognitive complexity 173; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseCopilotSessionStoreIncremental (cyclomatic 111, cognitive 191) REDACTED:20241— parseCopilotSessionStoreIncremental has cyclomatic complexity 111 and cognitive complexity 191; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parsePiLikeIncremental (cyclomatic 109, cognitive 209) REDACTED:17582— parsePiLikeIncremental has cyclomatic complexity 109 and cognitive complexity 209; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 107, cognitive 137) TokenTrackerBar/scripts/native-qa-server.cjs:112— (anonymous) has cyclomatic complexity 107 and cognitive complexity 137; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function App (cyclomatic 107, cognitive 69) dashboard/src/App.jsx:115— App has cyclomatic complexity 107 and cognitive complexity 69; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function billing (cyclomatic 103, cognitive 167) dashboard/edge-patches/tokentracker-billing.ts:36— billing has cyclomatic complexity 103 and cognitive complexity 167; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseClaudeIncremental (cyclomatic 102, cognitive 155) REDACTED:1056— parseClaudeIncremental has cyclomatic complexity 102 and cognitive complexity 155; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function repairCodexRescanInflation (cyclomatic 99, cognitive 163) src/commands/sync.js:6291— repairCodexRescanInflation has cyclomatic complexity 99 and cognitive complexity 163; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function CloudPlanView (cyclomatic 99, cognitive 74) dashboard/src/pages/CloudPage.jsx:58— CloudPlanView has cyclomatic complexity 99 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseCodebuddyIncremental (cyclomatic 97, cognitive 218) REDACTED:10876— parseCodebuddyIncremental has cyclomatic complexity 97 and cognitive complexity 218; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseAntigravityFile (cyclomatic 88, cognitive 142) REDACTED:23304— parseAntigravityFile has cyclomatic complexity 88 and cognitive complexity 142; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readOmpSessionFiles (cyclomatic 86, cognitive 221) src/lib/omp-session.js:233— readOmpSessionFiles has cyclomatic complexity 86 and cognitive complexity 221; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readKimiSessions (cyclomatic 85, cognitive 220) src/lib/kimi-session.js:81— readKimiSessions has cyclomatic complexity 85 and cognitive complexity 220; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseDroidIncremental (cyclomatic 85, cognitive 160) REDACTED:16393— parseDroidIncremental has cyclomatic complexity 85 and cognitive complexity 160; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseQoderNewIncremental (cyclomatic 84, cognitive 145) REDACTED:7229— parseQoderNewIncremental has cyclomatic complexity 84 and cognitive complexity 145; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 83, cognitive 139) dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1048— (anonymous) has cyclomatic complexity 83 and cognitive complexity 139; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildZcodeSessionRecords (cyclomatic 82, cognitive 137) src/lib/session-analytics.js:1542— buildZcodeSessionRecords has cyclomatic complexity 82 and cognitive complexity 137; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function applyIntegrationSetup (cyclomatic 81, cognitive 118) src/commands/init.js:679— applyIntegrationSetup has cyclomatic complexity 81 and cognitive complexity 118; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 80, cognitive 101) dashboard/edge-patches/tokentracker-leaderboard-profile.ts:898— (anonymous) has cyclomatic complexity 80 and cognitive complexity 101; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readPiSessionFiles (cyclomatic 78, cognitive 215) src/lib/pi-session.js:441— readPiSessionFiles has cyclomatic complexity 78 and cognitive complexity 215; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 78, cognitive 95) scripts/cloud-sandbox/native-gateway.ts:79— (anonymous) has cyclomatic complexity 78 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
src/commands/sync.js: 7541 lines of code src/commands/sync.js:1— src/commands/sync.js has 7541 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/lib/usage-limits.js: 5042 lines of code src/lib/usage-limits.js:1— src/lib/usage-limits.js has 5042 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/lib/local-api.js: 3949 lines of code src/lib/local-api.js:1— src/lib/local-api.js has 3949 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/lib/session-analytics.js · ×1
src/lib/session-analytics.js: 3236 lines of code src/lib/session-analytics.js:1— src/lib/session-analytics.js has 3236 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/commands/init.js: 2286 lines of code src/commands/init.js:1— src/commands/init.js has 2286 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1827 lines of code REDACTED:1— REDACTED has 1827 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/lib/cursor-store.js: 1773 lines of code src/lib/cursor-store.js:1— src/lib/cursor-store.js has 1773 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/commands/status.js: 1702 lines of code src/commands/status.js:1— src/commands/status.js has 1702 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx · ×1
dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx: 1665 lines of code dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx:1— dashboard/src/ui/dashboard/components/UsageLimitsPanel.jsx has 1665 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/edge-patches/tokentracker-leaderboard-refresh.ts · ×1
dashboard/edge-patches/tokentracker-leaderboard-refresh.ts: 1534 lines of code dashboard/edge-patches/tokentracker-leaderboard-refresh.ts:1— dashboard/edge-patches/tokentracker-leaderboard-refresh.ts has 1534 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1502 lines of code REDACTED:1— REDACTED has 1502 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/pages/DashboardPage.jsx · ×1
dashboard/src/pages/DashboardPage.jsx: 1466 lines of code dashboard/src/pages/DashboardPage.jsx:1— dashboard/src/pages/DashboardPage.jsx has 1466 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/lib/skills-manager.js: 1466 lines of code src/lib/skills-manager.js:1— src/lib/skills-manager.js has 1466 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1419 lines of code REDACTED:1— REDACTED has 1419 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js · ×1
TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js: 1298 lines of code TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js:1— TokenTrackerLinux/gnome-extension/tokentracker@tokentracker.cc/extension.js has 1298 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 1247 lines of code REDACTED:1— REDACTED has 1247 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/lib/claude-categorizer.js · ×1
src/lib/claude-categorizer.js: 1238 lines of code src/lib/claude-categorizer.js:1— src/lib/claude-categorizer.js has 1238 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/edge-patches/tokentracker-embed-svg.ts · ×1
dashboard/edge-patches/tokentracker-embed-svg.ts: 1187 lines of code dashboard/edge-patches/tokentracker-embed-svg.ts:1— dashboard/edge-patches/tokentracker-embed-svg.ts has 1187 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/edge-patches/tokentracker-leaderboard-profile.ts · ×1
dashboard/edge-patches/tokentracker-leaderboard-profile.ts: 1177 lines of code dashboard/edge-patches/tokentracker-leaderboard-profile.ts:1— dashboard/edge-patches/tokentracker-leaderboard-profile.ts has 1177 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/pages/LeaderboardPage.jsx · ×1
dashboard/src/pages/LeaderboardPage.jsx: 1176 lines of code dashboard/src/pages/LeaderboardPage.jsx:1— dashboard/src/pages/LeaderboardPage.jsx has 1176 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/lib/mock-data.ts · ×1
dashboard/src/lib/mock-data.ts: 1150 lines of code dashboard/src/lib/mock-data.ts:1— dashboard/src/lib/mock-data.ts has 1150 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
dashboard/src/lib/api.ts: 1079 lines of code dashboard/src/lib/api.ts:1— dashboard/src/lib/api.ts has 1079 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/ui/dashboard/components/UsageOverview.jsx · ×1
dashboard/src/ui/dashboard/components/UsageOverview.jsx: 1072 lines of code dashboard/src/ui/dashboard/components/UsageOverview.jsx:1— dashboard/src/ui/dashboard/components/UsageOverview.jsx has 1072 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/edge-patches/tokentracker-account-model-breakdown.ts · ×1
dashboard/edge-patches/tokentracker-account-model-breakdown.ts: 1071 lines of code dashboard/edge-patches/tokentracker-account-model-breakdown.ts:1— dashboard/edge-patches/tokentracker-account-model-breakdown.ts has 1071 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/edge-patches/tokentracker-account-summary.ts · ×1
dashboard/edge-patches/tokentracker-account-summary.ts: 1053 lines of code dashboard/edge-patches/tokentracker-account-summary.ts:1— dashboard/edge-patches/tokentracker-account-summary.ts has 1053 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx · ×1
dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx: 1008 lines of code dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx:1— dashboard/src/ui/dashboard/components/ContextBreakdownPanel.jsx has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/lib/qoder-limits.js: 1008 lines of code src/lib/qoder-limits.js:1— src/lib/qoder-limits.js has 1008 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/edge-patches/tokentracker-account-daily.ts · ×1
dashboard/edge-patches/tokentracker-account-daily.ts: 1002 lines of code dashboard/edge-patches/tokentracker-account-daily.ts:1— dashboard/edge-patches/tokentracker-account-daily.ts has 1002 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
dashboard/src/pet.jsx: 976 lines of code dashboard/src/pet.jsx:1— dashboard/src/pet.jsx has 976 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx · ×1
dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx: 941 lines of code dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx:1— dashboard/src/ui/dashboard/components/ActivityHeatmap.jsx has 941 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/pages/SessionsPage.jsx · ×1
dashboard/src/pages/SessionsPage.jsx: 899 lines of code dashboard/src/pages/SessionsPage.jsx:1— dashboard/src/pages/SessionsPage.jsx has 899 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/lib/workbuddy-limits.js · ×1
src/lib/workbuddy-limits.js: 868 lines of code src/lib/workbuddy-limits.js:1— src/lib/workbuddy-limits.js has 868 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/hooks/use-trend-data.ts · ×1
dashboard/src/hooks/use-trend-data.ts: 866 lines of code dashboard/src/hooks/use-trend-data.ts:1— dashboard/src/hooks/use-trend-data.ts has 866 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/pages/CloudCheckoutPage.jsx · ×1
dashboard/src/pages/CloudCheckoutPage.jsx: 859 lines of code dashboard/src/pages/CloudCheckoutPage.jsx:1— dashboard/src/pages/CloudCheckoutPage.jsx has 859 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/ui/dashboard/components/TrendMonitor.jsx · ×1
dashboard/src/ui/dashboard/components/TrendMonitor.jsx: 844 lines of code dashboard/src/ui/dashboard/components/TrendMonitor.jsx:1— dashboard/src/ui/dashboard/components/TrendMonitor.jsx has 844 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/lib/grok-limits.js: 833 lines of code src/lib/grok-limits.js:1— src/lib/grok-limits.js has 833 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/lib/grok-context-breakdown.js · ×1
src/lib/grok-context-breakdown.js: 816 lines of code src/lib/grok-context-breakdown.js:1— src/lib/grok-context-breakdown.js has 816 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· dashboard/src/components/cloud/CloudMembershipCard.jsx · ×1
dashboard/src/components/cloud/CloudMembershipCard.jsx: 754 lines of code dashboard/src/components/cloud/CloudMembershipCard.jsx:1— dashboard/src/components/cloud/CloudMembershipCard.jsx has 754 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/lib/codex-context-breakdown.js · ×1
src/lib/codex-context-breakdown.js: 754 lines of code src/lib/codex-context-breakdown.js:1— src/lib/codex-context-breakdown.js has 754 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 752 lines of code REDACTED:1— REDACTED has 752 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling· Type errors in this package cannot fail any build or CI step · ×1
Type errors in this package cannot fail any build or CI step package.json:42— the root package is TypeScript, but a type error in it cannot fail anything this repository runs: its `gen:bot-frames` script (`node scripts/gen-bot-frames.cjs`) compiles TypeScript with a transpile-only tool that strips types without checking them, and no script, config or CI step of the package runs `tsc --noEmit` or another type checker over it. Add a type check that can fail — a `typecheck` script running `tsc --noEmit` (or `vue-tsc`/`svelte-check`) that CI or the workspace pipeline runs, or a build step that checks before it bundles.
R6 · Tooling· This package's lint script runs in no CI job · ×1
This package's lint script runs in no CI job dashboard/package.json:10— The package in `dashboard` declares the lint script `lint` (`eslint "src/**/*.{js,jsx,ts,tsx}"`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `dashboard` (or the workspace's task runner).
Dead file (~484 LoC) scripts/cloud-sandbox/hosted-archive-acceptance.cjs— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~148 LoC) dashboard/src/ui/dashboard/components/MacAppBanner.jsx— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~128 LoC) scripts/acceptance/gemini-hook-install.cjs— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~100 LoC) scripts/acceptance/opencode-plugin-install.cjs— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~94 LoC) dashboard/src/ui/dashboard/components/WidgetOnboardingCard.jsx— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~79 LoC) scripts/setup-waffo-cloud.cjs— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~63 LoC) scripts/acceptance/windows-queue-performance.cjs— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~40 LoC) dashboard/src/hooks/useClawdState.js— no import path from any entry point (149 application, 45 tooling, 693 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (dashboard/src/ui/dashboard/components/MacAppBanner.jsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Unused dependency 'ogl' dashboard/package.json:38— Declared in dashboard/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Orphaned file src/lib/omp-hook.js: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 dashboard/src/lib/dashboard-preload.js: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 src/lib/openclaw-hook.js: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 dashboard/src/ui/marketing/components/BorderGlow.jsx: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 src/lib/gemini-config.js: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 src/lib/outcomes-engine.js: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 dashboard/src/ui/dashboard/components/CommandPalette.jsx: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 src/lib/skill-usage.js: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 src/lib/categorizer-utils.js: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 src/lib/wrapped-aggregator.js: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 TokenTrackerLinux/src-tauri/src/paths.rs: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 src/lib/codex-token-usage.js: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 TokenTrackerBar/scripts/generate_dmg_bg.swift: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 src/lib/upload-throttle.js: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 dashboard/src/ui/marketing/LogoCarousel.jsx: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 dashboard/src/lib/activity-heatmap.ts: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 dashboard/src/lib/currency.ts: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 TokenTrackerBar/TokenTrackerBar/Utilities/DashboardBrowserOpener.swift: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 TokenTrackerBar/TokenTrackerWidget/Views/WidgetTheme.swift: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 src/lib/cli-ui.js: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 src/lib/pricing/litellm-fetcher.js: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 TokenTrackerBar/TokenTrackerBar/Models/UsagePublicationPolicy.swift: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 src/commands/wrapped.js: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 TokenTrackerBar/TokenTrackerBar/Models/ModelBreakdown.swift: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 dashboard/src/lib/timezone.ts: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.
Duplicated predicate TokenTrackerWin/DashboardWindow.cs:752— `!_coreReady || _server.Status != ServerManager.ServerStatus.Running` appears character-identically in 2 files — TokenTrackerWin/DashboardWindow.cs, TokenTrackerWin/PetWindow.cs. 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 REDACTED:479— `!Array.isArray(rows) || rows.length === 0` appears character-identically in 3 files — REDACTED, REDACTED, src/lib/usage-limits.js. 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 dashboard/src/lib/heatmap-compact.js:28— `!DAY_KEY_RE.test(String(payload.from)) || !DAY_KEY_RE.test(String(payload.to))` appears character-identically in 2 files — dashboard/src/lib/heatmap-compact.js, src/lib/heatmap-compact.js. 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 src/lib/workbuddy-limits.js:616— `!Number.isFinite(cachedAtMs) || cachedAtMs > nowMs + 60_000` appears character-identically in 2 files — src/lib/workbuddy-limits.js, REDACTED. 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 REDACTED:590— `!Number.isFinite(inputTokens) || !Number.isFinite(cachedInputTokens)` appears character-identically in 2 files — REDACTED, src/lib/local-api.js. 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 src/lib/ark-agent-plan-limits.js:264— `!Number.isFinite(providerTimeoutMs) || providerTimeoutMs <= 0` appears character-identically in 3 files — src/lib/ark-agent-plan-limits.js, src/lib/ark-coding-plan-limits.js, src/lib/usage-limits.js. 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 REDACTED:215— `!Number.isFinite(timeoutMs) || timeoutMs <= 0` appears character-identically in 2 files — REDACTED, src/lib/usage-limits.js. 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 dashboard/src/hooks/use-trend-data.ts:507— `!Number.isFinite(y) || !Number.isFinite(m) || !Number.isFinite(d)` appears character-identically in 4 files — dashboard/src/hooks/use-trend-data.ts, dashboard/src/hooks/use-usage-data.ts, dashboard/src/lib/date-range.ts, dashboard/src/lib/mock-data.ts. 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 dashboard/src/hooks/use-trend-data.ts:916— `!Number.isFinite(year) || !Number.isFinite(month)` appears character-identically in 2 files — dashboard/src/hooks/use-trend-data.ts, dashboard/src/lib/detail-sort.ts. 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 dashboard/src/hooks/use-trend-data.ts:875— `!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day)` appears character-identically in 2 files — dashboard/src/hooks/use-trend-data.ts, dashboard/src/lib/detail-sort.ts. 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 src/lib/local-usage-transfer.js:45— `!Number.isSafeInteger(value) || value < 0` appears character-identically in 3 files — src/lib/local-usage-transfer.js, REDACTED, src/lib/trae-db.js. 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 dashboard/src/lib/api.ts:929— `!accessToken || !isValidJwtShape(accessToken)` appears character-identically in 2 files — dashboard/src/lib/api.ts, dashboard/src/lib/skills-api.ts. 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 src/commands/sync.js:6977— `!cursors.files || typeof cursors.files !== "object"` appears character-identically in 3 files — src/commands/sync.js, src/lib/cursor-store.js, REDACTED. 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 src/commands/sync.js:1499— `!isCursorStoreRetry(error) || attempt > 0` appears character-identically in 2 files — src/commands/sync.js, src/lib/cursor-store.js. 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 dashboard/edge-patches/tokentracker-account-skills.ts:97— `!key || key.startsWith("/") || key.includes(":/") || /[A-Za-z]:\//.test(key)` appears character-identically in 2 files — dashboard/edge-patches/tokentracker-account-skills.ts, dashboard/src/lib/skills-inventory.ts. 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 dashboard/edge-patches/tokentracker-account-daily.ts:682— `!lower.includes("deepseek-v4-flash") && !lower.includes("deepseek-v4.1-flash") && !lower.includes("deepseek-flash") && !lower.includes("deep…` appears character-identically in 5 files — dashboard/edge-patches/tokentracker-account-daily.ts, dashboard/edge-patches/tokentracker-account-model-breakdown.ts, dashboard/edge-patches/tokentracker-account-summary.ts, dashboard/edge-patches/tokentracker-leaderboard-profile.ts. 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 src/lib/grok-limits.js:193— `!parsed || typeof parsed !== "object" || Array.isArray(parsed)` appears character-identically in 2 files — src/lib/grok-limits.js, src/lib/usage-limits.js. 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 src/lib/opencode-status.js:43— `!payload || typeof payload !== "object" || Array.isArray(payload)` appears character-identically in 2 files — src/lib/opencode-status.js, src/lib/subscriptions.js. 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 src/lib/ark-agent-plan-limits.js:381— `!plansResult?.error && plansResult?.status === 0` appears character-identically in 2 files — src/lib/ark-agent-plan-limits.js, src/lib/ark-coding-plan-limits.js. 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 dashboard/edge-patches/tokentracker-account-skills.ts:89— `!raw || raw.startsWith("/") || /^[A-Za-z]:\//.test(raw)` appears character-identically in 2 files — dashboard/edge-patches/tokentracker-account-skills.ts, dashboard/src/lib/skills-inventory.ts. 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 src/lib/outcomes-engine.js:38— `!raw || typeof raw !== "object" || Array.isArray(raw)` appears character-identically in 2 files — src/lib/outcomes-engine.js, src/lib/scan-roots.js. 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 dashboard/src/hooks/use-activity-heatmap.ts:139— `!resolvedToken && !mockEnabled && !isLocalMode && !useCloud` appears character-identically in 4 files — dashboard/src/hooks/use-activity-heatmap.ts, dashboard/src/hooks/use-trend-data.ts, dashboard/src/hooks/use-usage-data.ts, dashboard/src/hooks/use-usage-model-breakdown.ts. 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 REDACTED:585— `!row || (row.source !== "codex" && row.source !== "every-code")` appears character-identically in 2 files — REDACTED, src/lib/local-api.js. 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 src/lib/upload-queue.js:49— `!row || typeof row !== "object" || Array.isArray(row)` appears character-identically in 2 files — src/lib/upload-queue.js, src/lib/usage-limits.js. 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 src/lib/claude-config.js:98— `!settings || typeof settings !== "object"` appears character-identically in 4 files — src/lib/claude-config.js, src/lib/codex-service-tier.js, src/lib/gemini-config.js, REDACTED. 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 TokenTrackerWin/AutoUpdatePolicy.cs:61— `ReadSettings` swallows every exception into `return new JsonObject();` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch REDACTED:90— `ResolveProxy` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/Currency.cs:69— `ReadPersisted` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/Currency.cs:79— `ReadSettingsObject` swallows every exception into `return new JsonObject();` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/DashboardWindow.cs:743— `RecoverFromDispatcherException` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/DashboardWindow.cs:1128— `ReadCurrencyAsync` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/DashboardWindow.cs:1147— `ReadLocalePreferenceAsync` swallows every exception into `return NativeLocalization.SystemPreference;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/DashboardWindow.cs:1169— `ReadThemePreferenceAsync` swallows every exception into `return NativeTheme.DarkPreference;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/NativeLocalization.cs:72— `ReadStoredPreference` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/NativeLocalization.cs:85— `ReadSettingsObject` swallows every exception into `return new JsonObject();` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/NativeTheme.cs:66— `ReadStoredPreference` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/NativeTheme.cs:79— `ReadSettingsObject` swallows every exception into `return new JsonObject();` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/NativeTheme.cs:93— `IsWindowsAppLightTheme` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch REDACTED:247— `ReadOpenCommand` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:222— `IsPointOnPet` swallows every exception into `return true;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:926— `CurrentBotColor` swallows every exception into `return "auto";` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:983— `StoredVisible` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:1049— `IsBuiltinCharacterHidden` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:1104— `CurrentSize` swallows every exception into `return SizeMedium;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:1118— `CurrentCharacter` swallows every exception into `return CharacterClawd;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/PetWindow.cs:1315— `WriteSettings` swallows every exception and sets `settings = new JsonObject();` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/QuotaWidgetSettings.cs:23— `Load` swallows `Exception` into `return new();` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/QuotaWidgetWindow.cs:129— `ApplyLimits` swallows `JsonException` and sets `_failed = true;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/ResumableDownloader.cs:244— `LoadMetadata` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Silent fallback default in catch TokenTrackerWin/ServerManager.cs:394— `IsProcessAlive` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 25 significant file(s) lose their only recent owner: dashboard/src/pages/PetPage.jsx, src/lib/pet-packages.js, dashboard/src/components/leaderboard/CommunityStatsModal.jsx, dashboard/src/ui/dashboard/components/ProjectDetailModal.jsx, dashboard/src/ui/marketing/v3/galaxy-config.js, TokenTrackerBar/Shared/NativeQAProfile.swift, TokenTrackerBar/TokenTrackerBar/Services/ScreenConfettiOverlayController.swift, scripts/cloud-sandbox/native-gateway.ts (+17 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 10 significant file(s) lose their only recent owner: dashboard/src/ui/share/ShareModal.tsx, dashboard/src/ui/share/variants/AnnualReportCard.jsx, TokenTrackerBar/TokenTrackerWidget/Views/SharedWidgetViews.swift, TokenTrackerBar/TokenTrackerWidget/Widgets/SummaryWidget.swift, dashboard/src/lib/leaderboard-columns.js, dashboard/src/ui/share/native-save.ts, TokenTrackerBar/TokenTrackerWidget/Widgets/TopModelsWidget.swift, dashboard/src/lib/leaderboard-ui.js (+2 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: TokenTrackerLinux/src-tauri/src/pet.rs, dashboard/src/lib/pet-linux-host.js, dashboard/src/ui/dashboard/components/LinuxTopBarCard.jsx, dashboard/src/ui/dashboard/components/LinuxPetCard.jsx. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 4 significant file(s) lose their only recent owner: TokenTrackerWin/QuotaWidgetWindow.cs, dashboard/src/quota.jsx, dashboard/src/lib/desktop-quota.js, TokenTrackerWin/LocalSyncPublisher.cs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 3 significant file(s) lose their only recent owner: dashboard/src/lib/cloud-checkout.js, src/commands/doctor.js, src/lib/kimi-profile.js. Pair on, review, or document these before any departure.
redundant comment dashboard/src/ui/share/ShareModal.tsx:96— "Merge handle override + avatar into data for the card" repeats the code it sits on: 5 of its 6 words (handle, override, avatar, data, card) are already in `const cardData = data ? { ...data, handle: handleOverride || data.handle, avatarUrl } : data;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment test/codex-token-usage-record.test.js:84— "Session parser totals.total_tokens = input + cache write + output." repeats the code it sits on: 8 of its 9 words (parser, totals, total, tokens, input, cache, write, output) are already in `const parserTotal = (...us) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment test/cursor-config.test.js:29— 7 comments in this file only repeat the code they sit on (lines 29, 152, 175, 188, 209, 250, 355), for example "── parseCursorCsv — new format ──". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment test/trae-cn-parser.test.js:380— "Invalid usage_time / sessions / cursors." repeats the code it sits on: 4 of its 5 words (usage, time, sessions, cursors) are already in `await assert.rejects(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
R7 · Dead Code· Unused module-local declaration 'HourlyRow' · ×4
Unused module-local declaration 'HourlyRow' dashboard/edge-patches/tokentracker-account-daily.ts:709— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Unused module-local declaration 'HourlyRow' dashboard/edge-patches/tokentracker-account-hourly.ts:71— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Unused module-local declaration 'HourlyRow' dashboard/edge-patches/tokentracker-account-model-breakdown.ts:728— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Unused module-local declaration 'HourlyRow' dashboard/edge-patches/tokentracker-account-summary.ts:696— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'zonedDayKey' · ×2
Unused module-local declaration 'zonedDayKey' dashboard/edge-patches/tokentracker-account-daily.ts:45— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Unused module-local declaration 'zonedDayKey' dashboard/edge-patches/tokentracker-account-model-breakdown.ts:86— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 8 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (55 single-owned of 449 analysed files in total, 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; 449 of the 612 production source files in this repository met that bar). They are anonymized user #6 (2 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)), anonymized user #11 (1 file(s)) (+2 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: TokenTrackerBar/TokenTrackerBar/Models/AccountViewSource.swift, src/lib/codex-model-attribution.js, dashboard/src/ui/dashboard/components/SubscriptionSettingsCard.jsx, TokenTrackerLinux/src-tauri/src/ui_zoom.rs, src/lib/devin-usage.js, TokenTrackerWin/UpdateReleaseClient.cs, TokenTrackerWin/TiltWheelScrollForwarder.cs, TokenTrackerBar/TokenTrackerBar/Models/DynamicIslandCompactPolicy.swift (+1 more).
No ADRs found TokenTrackerWin/TokenTrackerWin.csproj:4— 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 `TokenTrackerWin/TokenTrackerWin.csproj` makes this repository a deployable product (line 4).
D21 · Naming Consistency· `resolveAllHermesDBPaths` spells `DB` where 62 names in the project spell it `Db` · ×1
`resolveAllHermesDBPaths` spells `DB` where 62 names in the project spell it `Db` REDACTED:8374— 62 of 63 names in project tokentracker-cli spell the token `Db` (62 of 63; unit: names in project tokentracker-cli containing `Db`). Peers: sync.mergeCopilotAppDbStates (src/commands/sync.js:434); sync.resolveZcodeDbRebuildFloorMs (src/commands/sync.js:5067); cursor-config.readCursorAccessTokenFromStateDb (src/lib/cursor-config.js:58); cursor-config.readCursorAccessTokenFromStateDb(stateDbPath) (src/lib/cursor-config.js:58); diagnostics.resolveKiroCliDbPathInline (src/lib/diagnostics.js:46). Rename to `resolveAllHermesDbPaths`. [rule N6]
D21 · Naming Consistency· `formatDateUTC` spells `UTC` where 12 names in the project spell it `Utc` · ×1
`formatDateUTC` spells `UTC` where 12 names in the project spell it `Utc` dashboard/src/lib/date-range.ts:9— 12 of 13 names in project tokentracker-cli spell the token `Utc` (12 of 13; unit: names in project tokentracker-cli containing `Utc`). Peers: use-trend-data.parseUtcDate (dashboard/src/hooks/use-trend-data.ts:499); use-trend-data.addUtcDays (dashboard/src/hooks/use-trend-data.ts:515); use-usage-data.parseUtcDate (dashboard/src/hooks/use-usage-data.ts:461); use-usage-data.addUtcDays (dashboard/src/hooks/use-usage-data.ts:477); activity-heatmap.addUtcDays (dashboard/src/lib/activity-heatmap.ts:34). Rename to `formatDateUtc`. [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 — 56 of 449 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; 449 of the 612 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: src/lib/omp-hook.js, dashboard/src/lib/dashboard-preload.js, src/lib/openclaw-hook.js, dashboard/src/ui/marketing/components/BorderGlow.jsx, src/lib/gemini-config.js, src/lib/outcomes-engine.js, dashboard/src/ui/dashboard/components/CommandPalette.jsx, src/lib/skill-usage.js (and 48 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/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `TokenTrackerLinux/src-tauri`.
P3 · Security & performance tooling· Dependabot does not watch nuget/cargo · ×1
Dependabot does not watch nuget/cargo REDACTED:2— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `nuget`, `cargo`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
R7 · Dead Code· Unused export 'emitCloudSyncChange' · ×1
Unused export 'emitCloudSyncChange' dashboard/src/contexts/AccountViewContext.jsx:32— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'visibleProviderIds' · ×1
Unused export 'visibleProviderIds' dashboard/src/hooks/use-limits-display-prefs.js:179— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'cachedPetById' · ×1
Unused export 'cachedPetById' dashboard/src/hooks/use-pet-catalog.js:6— Nothing imports this binding — it is safe to review for removal.
Unused export 'CURRENCY_CNY' dashboard/src/lib/currency.ts:5— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'getCurrencyLabelKey' · ×1
Unused export 'getCurrencyLabelKey' dashboard/src/lib/currency.ts:65— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'DASHBOARD_PRELOAD_STATUSES' · ×1
Unused export 'DASHBOARD_PRELOAD_STATUSES' dashboard/src/lib/dashboard-preload.js:5— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'LB_STICKY_TH_TOTAL' · ×1
Unused export 'LB_STICKY_TH_TOTAL' dashboard/src/lib/leaderboard-columns.js:37— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'lbStickyTdTotalOnly' · ×1
Unused export 'lbStickyTdTotalOnly' dashboard/src/lib/leaderboard-columns.js:62— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused module-local declaration 'getZonedParts' · ×1
Unused module-local declaration 'getZonedParts' dashboard/edge-patches/tokentracker-account-hourly.ts:168— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'formatDayKey' · ×1
Unused module-local declaration 'formatDayKey' dashboard/edge-patches/tokentracker-account-hourly.ts:218— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'MONO_STACK' · ×1
Unused module-local declaration 'MONO_STACK' dashboard/edge-patches/tokentracker-embed-svg.ts:183— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'hover' · ×1
Unused module-local declaration 'hover' dashboard/src/components/cloud/CloudMembershipCard.test.jsx:55— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
X5 · Nullable reference types· Strict null checking is not enabled everywhere the repository type-checks · ×1
Strict null checking is not enabled everywhere the repository type-checks — 1/2 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
Null assertions (`!`) override strict null checking — ~2.0 `!` null assertions per 1k TypeScript source lines — 55 assertion(s) across the 27692 source line(s) of the 108 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: dashboard/src/lib/bot/shape.ts (11), dashboard/edge-patches/tokentracker-profile-likes.ts (6), dashboard/src/lib/bot/engine.ts (6). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Null-forgiving operator (`!`) suppressions override nullable warnings — ~0.5 `!` suppressions per 1k syntax nodes — 20 suppression(s) across the 41190 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Silent fallback default on parse failure REDACTED:417— `CompareVersions` falls back to `0` when `i < pa.Length && int.TryParse(pa[i], out var x)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
Silent fallback default on Err TokenTrackerLinux/src-tauri/src/pet.rs:538— `js_string` turns every `Err` into `"\"\"".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 on the arm or in the doc comment, and the row stops firing.
Subsumed condition operand TokenTrackerWin/DispatcherExceptionPolicy.cs:34— `objectName.Contains("corewebview", StringComparison.OrdinalIgnoreCase)` can never decide this `||` — every value satisfying `objectName.Contains("corewebview", StringComparison.OrdinalIgnoreCase)` also satisfies `objectName.Contains("webview", StringComparison.OrdinalIgnoreCase)`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Outdated: libc — `libc` is locked at 0.2.186 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in TokenTrackerLinux/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
Outdated: serde — `serde` is locked at 1.0.228 but 1.0.229 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in TokenTrackerLinux/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.150 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in TokenTrackerLinux/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: tauri — `tauri` is locked at 2.12.0 but 2.12.6 is the current stable release on crates.io, and it already satisfies the `"2.12"` requirement declared in TokenTrackerLinux/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri` and commit the updated REDACTED.
Outdated: tauri-build — `tauri-build` is locked at 2.7.0 but 2.7.5 is the current stable release on crates.io, and it already satisfies the `"2.7"` requirement declared in TokenTrackerLinux/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-build` and commit the updated REDACTED.
Outdated: tauri-plugin-single-instance — `tauri-plugin-single-instance` is locked at 2.4.5 but 2.5.5 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in TokenTrackerLinux/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-single-instance` and commit the updated REDACTED.
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 9 file(s) — `TokenTrackerBar/Shared/NativeLocalization.swift`, `TokenTrackerBar/TokenTrackerBar/Services/APIClient.swift`, `TokenTrackerBar/TokenTrackerBar/Services/DynamicIslandController.swift`, `TokenTrackerBar/TokenTrackerBar/Views/DynamicIslandView.swift`, `TokenTrackerBar/TokenTrackerBar/Views/UsageLimitsView.swift`, … (+4 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
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 01a1eb2a-a267-7698-83fb-291bb2d81a41 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 157 · Warnings: 1984 · Recommendations: 193 · Info: 6 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 20:20 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.