Public report of jryang2026-code/MenuBarHome, 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, 12:39 UTC · Survey ID cd_4677a9e658bd41ee98fb07edd925903a
jryang2026-code/MenuBarHome
Measured 17 November 2026, 12:37 UTC, at code version c38ec53
First survey, so nothing to compare with yet
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 162,075 lines of product code in 9 projects, tests not counted · Estimated rebuild effort: about 1.7 person-years · Weakest lens: Code Health, 37.2
Findings by how serious they are
45 critical1924 serious87 minor
28 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, 12:37 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
65of 65 dimensions measured by tools.
2051of 2056 findings point to an exact file and line, so you can open each one in the code. The other 5 concern the repository as a whole, such as missing documentation.
65dimensions across 8 lenses, read from 162,075 lines of product code in 9 projects.
jryang2026-code/MenuBarHome falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 50.0 out of 100 and is rated Weak, and three of its 45 critical findings are security problems.
Code Health, at 37.2, is the weakest lens and counts most in the score. The best first step is splitting the oversized files, worth about 6.9 points. Simplifying the most tangled functions comes next, worth about 5.6 points. Raising Code Health to 70 would lift the score to about 60.3.
One automatic update takes new releases before a bad one can be spotted. One known security hole in a package the code depends on can be used by attackers. Setting a waiting period for automatic updates and updating the vulnerable packages would close both risks. Pinning each tool to an exact version would fix the pipeline tool referenced by a changeable name. The three loops of files that import each other need breaking.
The product code is 162,075 lines, about €240,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 37.2 to 70, the lowest score rated Strong, the score would rise from 50.0 to about 60.3.
Code composition: what the lines of code are
Product code 62%Tests 38%
Rebuild cost: about €240,000 · Estimate
Cost to rebuild
€81,000 to €410,000, for 1,344 to 4,265 hours of work, about 1.7 person-years for 1 to 4 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 50. 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: 162,075 lines of product code
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. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 6.9 points · Medium effort · Large Files
2
Resolve the 40 finding(s) in Cyclomatic Complexity.
Bring the 44 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with DeviceSynthesizer.buildSmartDevice (cyclomatic 169), PanelRenderPipeline.commitRender (cyclomatic 153), automationSettingsView.bindAutomationSettingsEvents (cyclomatic 152).
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 €240,000 to build again, about 1.7 person-years of work. Its weakest lens is Code Health, at 37.2 (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
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package. Of all the actions in this report, it raises the score most for the work it takes: about 6.9 points for medium effort. 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.2 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 7% to 16% on every change. The history of the code shows how much it changes: about 454,302 lines over the last 90 days, which is about 1,842,447 lines a year. At that pace, the extra work comes to an estimated 323.8 to 1942.7 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
111 modules, with 216 dependencies between them. One loop runs through 3 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 71 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.
windows.src.core.appUrlCommand uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.appUrlCommand, while a change to windows.src.core.appUrlCommand can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.appUrlCommand uses a module listed above it, which is the healthy direction.
windows.src.core.assistant.actionPolicy uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.assistant.actionPolicy, while a change to windows.src.core.assistant.actionPolicy can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.assistant.actionPolicy uses a module listed above it, which is the healthy direction.
windows.src.core.assistant.habits uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.core.assistant.habits, while a change to windows.src.core.assistant.habits can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.core.assistant.habits uses a module listed above it, which is the healthy direction.
windows.src.core.miCloud.client uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.core.miCloud.client, while a change to windows.src.core.miCloud.client can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.core.miCloud.client uses a module listed above it, which is the healthy direction.
windows.src.core.optimisticLock uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.optimisticLock, while a change to windows.src.core.optimisticLock can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.optimisticLock uses a module listed above it, which is the healthy direction.
windows.src.core.safetyAndHealth uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.safetyAndHealth, while a change to windows.src.core.safetyAndHealth can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.safetyAndHealth uses a module listed above it, which is the healthy direction.
windows.src.core.secureStore uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.core.secureStore, while a change to windows.src.core.secureStore can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.core.secureStore uses a module listed above it, which is the healthy direction.
windows.src.ui.deviceViews uses windows.src.core.energyHistory, so a change to windows.src.core.energyHistory can break windows.src.ui.deviceViews, while a change to windows.src.ui.deviceViews can't break windows.src.core.energyHistory.
Position
Below the diagonal: windows.src.ui.deviceViews uses a module listed above it, which is the healthy direction.
windows.src.ui.deviceViews uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.deviceViews, while a change to windows.src.ui.deviceViews can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.deviceViews uses a module listed above it, which is the healthy direction.
windows.src.ui.deviceViews uses windows.src.ui.sensorHistoryView, so a change to windows.src.ui.sensorHistoryView can break windows.src.ui.deviceViews, while a change to windows.src.ui.deviceViews can't break windows.src.ui.sensorHistoryView.
Position
Below the diagonal: windows.src.ui.deviceViews uses a module listed above it, which is the healthy direction.
windows.src.ui.energySettingsView uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.energySettingsView, while a change to windows.src.ui.energySettingsView can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.energySettingsView uses a module listed above it, which is the healthy direction.
19→33 windows.src.ui.energySettingsView uses windows.src.ui.settingsViewspart of a loop✕
Connections
1 pair of types, where a type in windows.src.ui.energySettingsView uses a type in windows.src.ui.settingsViews.
windows.src.ui.energySettingsView uses windows.src.ui.settingsViews, so a change to windows.src.ui.settingsViews can break windows.src.ui.energySettingsView, while a change to windows.src.ui.energySettingsView can't break windows.src.ui.settingsViews.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
windows.src.ui.listCut uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.listCut, while a change to windows.src.ui.listCut can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.listCut uses a module listed above it, which is the healthy direction.
windows.src.core.assistant uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.core.assistant, while a change to windows.src.core.assistant can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.core.assistant uses a module listed above it, which is the healthy direction.
windows.src.core.assistant uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.assistant, while a change to windows.src.core.assistant can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.assistant uses a module listed above it, which is the healthy direction.
windows.src.core.assistant uses windows.src.core.assistant.actionPolicy, so a change to windows.src.core.assistant.actionPolicy can break windows.src.core.assistant, while a change to windows.src.core.assistant can't break windows.src.core.assistant.actionPolicy.
Position
Below the diagonal: windows.src.core.assistant uses a module listed above it, which is the healthy direction.
windows.src.core.assistant uses windows.src.core.assistant.habits, so a change to windows.src.core.assistant.habits can break windows.src.core.assistant, while a change to windows.src.core.assistant can't break windows.src.core.assistant.habits.
Position
Below the diagonal: windows.src.core.assistant uses a module listed above it, which is the healthy direction.
windows.src.core.assistant.modelIntentResolver uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.assistant.modelIntentResolver, while a change to windows.src.core.assistant.modelIntentResolver can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.assistant.modelIntentResolver uses a module listed above it, which is the healthy direction.
windows.src.core.assistant.modelIntentResolver uses windows.src.core.assistant.actionPolicy, so a change to windows.src.core.assistant.actionPolicy can break windows.src.core.assistant.modelIntentResolver, while a change to windows.src.core.assistant.modelIntentResolver can't break windows.src.core.assistant.actionPolicy.
Position
Below the diagonal: windows.src.core.assistant.modelIntentResolver uses a module listed above it, which is the healthy direction.
windows.src.core.automationEngine uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.automationEngine, while a change to windows.src.core.automationEngine can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.automationEngine uses a module listed above it, which is the healthy direction.
windows.src.core.automationEngine uses windows.src.core.safetyAndHealth, so a change to windows.src.core.safetyAndHealth can break windows.src.core.automationEngine, while a change to windows.src.core.automationEngine can't break windows.src.core.safetyAndHealth.
Position
Below the diagonal: windows.src.core.automationEngine uses a module listed above it, which is the healthy direction.
windows.src.core.miCloud.spec uses windows.src.core.miCloud.client, so a change to windows.src.core.miCloud.client can break windows.src.core.miCloud.spec, while a change to windows.src.core.miCloud.spec can't break windows.src.core.miCloud.client.
Position
Below the diagonal: windows.src.core.miCloud.spec uses a module listed above it, which is the healthy direction.
windows.src.ui.appTypes uses windows.src.core.cameraQuality, so a change to windows.src.core.cameraQuality can break windows.src.ui.appTypes, while a change to windows.src.ui.appTypes can't break windows.src.core.cameraQuality.
Position
Below the diagonal: windows.src.ui.appTypes uses a module listed above it, which is the healthy direction.
windows.src.ui.appTypes uses windows.src.core.commandEffects, so a change to windows.src.core.commandEffects can break windows.src.ui.appTypes, while a change to windows.src.ui.appTypes can't break windows.src.core.commandEffects.
Position
Below the diagonal: windows.src.ui.appTypes uses a module listed above it, which is the healthy direction.
windows.src.ui.appTypes uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.ui.appTypes, while a change to windows.src.ui.appTypes can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.ui.appTypes uses a module listed above it, which is the healthy direction.
windows.src.ui.appTypes uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.appTypes, while a change to windows.src.ui.appTypes can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.appTypes uses a module listed above it, which is the healthy direction.
windows.src.ui.appTypes uses windows.src.core.assistant.habits, so a change to windows.src.core.assistant.habits can break windows.src.ui.appTypes, while a change to windows.src.ui.appTypes can't break windows.src.core.assistant.habits.
Position
Below the diagonal: windows.src.ui.appTypes uses a module listed above it, which is the healthy direction.
windows.src.core.diagnosticsAndScanner uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.core.diagnosticsAndScanner, while a change to windows.src.core.diagnosticsAndScanner can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.core.diagnosticsAndScanner uses a module listed above it, which is the healthy direction.
windows.src.core.diagnosticsAndScanner uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.core.diagnosticsAndScanner, while a change to windows.src.core.diagnosticsAndScanner can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.core.diagnosticsAndScanner uses a module listed above it, which is the healthy direction.
windows.src.core.homeProvider uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.homeProvider, while a change to windows.src.core.homeProvider can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.homeProvider uses a module listed above it, which is the healthy direction.
windows.src.core.homeProvider uses windows.src.core.miCloud.client, so a change to windows.src.core.miCloud.client can break windows.src.core.homeProvider, while a change to windows.src.core.homeProvider can't break windows.src.core.miCloud.client.
Position
Below the diagonal: windows.src.core.homeProvider uses a module listed above it, which is the healthy direction.
windows.src.core.homeProvider uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.core.homeProvider, while a change to windows.src.core.homeProvider can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.core.homeProvider uses a module listed above it, which is the healthy direction.
windows.src.core.miCloud uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.core.miCloud, while a change to windows.src.core.miCloud can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.core.miCloud uses a module listed above it, which is the healthy direction.
windows.src.core.miCloud uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.miCloud, while a change to windows.src.core.miCloud can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.miCloud uses a module listed above it, which is the healthy direction.
windows.src.core.miCloud uses windows.src.core.miCloud.client, so a change to windows.src.core.miCloud.client can break windows.src.core.miCloud, while a change to windows.src.core.miCloud can't break windows.src.core.miCloud.client.
Position
Below the diagonal: windows.src.core.miCloud uses a module listed above it, which is the healthy direction.
windows.src.core.miCloud uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.core.miCloud, while a change to windows.src.core.miCloud can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.core.miCloud uses a module listed above it, which is the healthy direction.
windows.src.ui.automationSettingsView uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.ui.automationSettingsView, while a change to windows.src.ui.automationSettingsView can't break windows.src.core.models.
Position
Below the diagonal: windows.src.ui.automationSettingsView uses a module listed above it, which is the healthy direction.
windows.src.ui.automationSettingsView uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.automationSettingsView, while a change to windows.src.ui.automationSettingsView can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.automationSettingsView uses a module listed above it, which is the healthy direction.
windows.src.ui.automationSettingsView uses windows.src.core.safetyAndHealth, so a change to windows.src.core.safetyAndHealth can break windows.src.ui.automationSettingsView, while a change to windows.src.ui.automationSettingsView can't break windows.src.core.safetyAndHealth.
Position
Below the diagonal: windows.src.ui.automationSettingsView uses a module listed above it, which is the healthy direction.
windows.src.ui.automationSettingsView uses windows.src.core.automationEngine, so a change to windows.src.core.automationEngine can break windows.src.ui.automationSettingsView, while a change to windows.src.ui.automationSettingsView can't break windows.src.core.automationEngine.
Position
Below the diagonal: windows.src.ui.automationSettingsView uses a module listed above it, which is the healthy direction.
windows.src.ui.automationSettingsView uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.automationSettingsView, while a change to windows.src.ui.automationSettingsView can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.automationSettingsView uses a module listed above it, which is the healthy direction.
windows.src.ui.cameraLive uses windows.src.core.cameraQuality, so a change to windows.src.core.cameraQuality can break windows.src.ui.cameraLive, while a change to windows.src.ui.cameraLive can't break windows.src.core.cameraQuality.
Position
Below the diagonal: windows.src.ui.cameraLive uses a module listed above it, which is the healthy direction.
windows.src.ui.cameraLive uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.ui.cameraLive, while a change to windows.src.ui.cameraLive can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.ui.cameraLive uses a module listed above it, which is the healthy direction.
windows.src.ui.cameraLive uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.ui.cameraLive, while a change to windows.src.ui.cameraLive can't break windows.src.core.models.
Position
Below the diagonal: windows.src.ui.cameraLive uses a module listed above it, which is the healthy direction.
windows.src.ui.cameraLive uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.ui.cameraLive, while a change to windows.src.ui.cameraLive can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.ui.cameraLive uses a module listed above it, which is the healthy direction.
windows.src.ui.cameraLive uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.cameraLive, while a change to windows.src.ui.cameraLive can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.cameraLive uses a module listed above it, which is the healthy direction.
windows.src.ui.layoutGestures uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.ui.layoutGestures, while a change to windows.src.ui.layoutGestures can't break windows.src.core.models.
Position
Below the diagonal: windows.src.ui.layoutGestures uses a module listed above it, which is the healthy direction.
windows.src.ui.layoutGestures uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.layoutGestures, while a change to windows.src.ui.layoutGestures can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.layoutGestures uses a module listed above it, which is the healthy direction.
windows.src.ui.layoutGestures uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.layoutGestures, while a change to windows.src.ui.layoutGestures can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.layoutGestures uses a module listed above it, which is the healthy direction.
windows.src.core.miAccountsStore uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.core.miAccountsStore, while a change to windows.src.core.miAccountsStore can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.core.miAccountsStore uses a module listed above it, which is the healthy direction.
windows.src.core.miAccountsStore uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.miAccountsStore, while a change to windows.src.core.miAccountsStore can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.miAccountsStore uses a module listed above it, which is the healthy direction.
windows.src.core.miAccountsStore uses windows.src.core.secureStore, so a change to windows.src.core.secureStore can break windows.src.core.miAccountsStore, while a change to windows.src.core.miAccountsStore can't break windows.src.core.secureStore.
Position
Below the diagonal: windows.src.core.miAccountsStore uses a module listed above it, which is the healthy direction.
windows.src.core.miAccountsStore uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.core.miAccountsStore, while a change to windows.src.core.miAccountsStore can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.core.miAccountsStore uses a module listed above it, which is the healthy direction.
windows.src.core.miAccountsStore uses windows.src.core.homeProvider, so a change to windows.src.core.homeProvider can break windows.src.core.miAccountsStore, while a change to windows.src.core.miAccountsStore can't break windows.src.core.homeProvider.
Position
Below the diagonal: windows.src.core.miAccountsStore uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsViews uses windows.src.core.energyHistory, so a change to windows.src.core.energyHistory can break windows.src.ui.settingsViews, while a change to windows.src.ui.settingsViews can't break windows.src.core.energyHistory.
Position
Below the diagonal: windows.src.ui.settingsViews uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsViews uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.settingsViews, while a change to windows.src.ui.settingsViews can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.settingsViews uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsViews uses windows.src.ui.energySettingsView, so a change to windows.src.ui.energySettingsView can break windows.src.ui.settingsViews, while a change to windows.src.ui.settingsViews can't break windows.src.ui.energySettingsView.
Position
Below the diagonal: windows.src.ui.settingsViews uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsViews uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.settingsViews, while a change to windows.src.ui.settingsViews can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.settingsViews uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsViews uses windows.src.ui.automationSettingsView, so a change to windows.src.ui.automationSettingsView can break windows.src.ui.settingsViews, while a change to windows.src.ui.settingsViews can't break windows.src.ui.automationSettingsView.
Position
Below the diagonal: windows.src.ui.settingsViews uses a module listed above it, which is the healthy direction.
33→35 windows.src.ui.settingsViews uses windows.src.ui.connectionsAndDiagViewpart of a loop✕
Connections
1 pair of types, where a type in windows.src.ui.settingsViews uses a type in windows.src.ui.connectionsAndDiagView.
windows.src.ui.settingsViews uses windows.src.ui.connectionsAndDiagView, so a change to windows.src.ui.connectionsAndDiagView can break windows.src.ui.settingsViews, while a change to windows.src.ui.settingsViews can't break windows.src.ui.connectionsAndDiagView.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
windows.src.core.dualSourceProvider uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.core.dualSourceProvider, while a change to windows.src.core.dualSourceProvider can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.core.dualSourceProvider uses a module listed above it, which is the healthy direction.
windows.src.core.dualSourceProvider uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core.dualSourceProvider, while a change to windows.src.core.dualSourceProvider can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core.dualSourceProvider uses a module listed above it, which is the healthy direction.
windows.src.core.dualSourceProvider uses windows.src.core.homeProvider, so a change to windows.src.core.homeProvider can break windows.src.core.dualSourceProvider, while a change to windows.src.core.dualSourceProvider can't break windows.src.core.homeProvider.
Position
Below the diagonal: windows.src.core.dualSourceProvider uses a module listed above it, which is the healthy direction.
windows.src.core.dualSourceProvider uses windows.src.core.miAccountsStore, so a change to windows.src.core.miAccountsStore can break windows.src.core.dualSourceProvider, while a change to windows.src.core.dualSourceProvider can't break windows.src.core.miAccountsStore.
Position
Below the diagonal: windows.src.core.dualSourceProvider uses a module listed above it, which is the healthy direction.
windows.src.ui.connectionsAndDiagView uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.connectionsAndDiagView, while a change to windows.src.ui.connectionsAndDiagView can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.connectionsAndDiagView uses a module listed above it, which is the healthy direction.
windows.src.ui.connectionsAndDiagView uses windows.src.core.secureStore, so a change to windows.src.core.secureStore can break windows.src.ui.connectionsAndDiagView, while a change to windows.src.ui.connectionsAndDiagView can't break windows.src.core.secureStore.
Position
Below the diagonal: windows.src.ui.connectionsAndDiagView uses a module listed above it, which is the healthy direction.
windows.src.ui.connectionsAndDiagView uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.ui.connectionsAndDiagView, while a change to windows.src.ui.connectionsAndDiagView can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.ui.connectionsAndDiagView uses a module listed above it, which is the healthy direction.
windows.src.ui.connectionsAndDiagView uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.connectionsAndDiagView, while a change to windows.src.ui.connectionsAndDiagView can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.connectionsAndDiagView uses a module listed above it, which is the healthy direction.
windows.src.ui.connectionsAndDiagView uses windows.src.core.diagnosticsAndScanner, so a change to windows.src.core.diagnosticsAndScanner can break windows.src.ui.connectionsAndDiagView, while a change to windows.src.ui.connectionsAndDiagView can't break windows.src.core.diagnosticsAndScanner.
Position
Below the diagonal: windows.src.ui.connectionsAndDiagView uses a module listed above it, which is the healthy direction.
windows.src.ui.connectionsAndDiagView uses windows.src.ui.settingsViews, so a change to windows.src.ui.settingsViews can break windows.src.ui.connectionsAndDiagView, while a change to windows.src.ui.connectionsAndDiagView can't break windows.src.ui.settingsViews.
Position
Below the diagonal: windows.src.ui.connectionsAndDiagView uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsEvents uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.settingsEvents, while a change to windows.src.ui.settingsEvents can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.settingsEvents uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsEvents uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.settingsEvents, while a change to windows.src.ui.settingsEvents can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.settingsEvents uses a module listed above it, which is the healthy direction.
windows.src.ui.settingsEvents uses windows.src.ui.settingsViews, so a change to windows.src.ui.settingsViews can break windows.src.ui.settingsEvents, while a change to windows.src.ui.settingsEvents can't break windows.src.ui.settingsViews.
Position
Below the diagonal: windows.src.ui.settingsEvents uses a module listed above it, which is the healthy direction.
windows.src.core uses raycast.src.snapshot, so a change to raycast.src.snapshot can break windows.src.core, while a change to windows.src.core can't break raycast.src.snapshot.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.cameraQuality, so a change to windows.src.core.cameraQuality can break windows.src.core, while a change to windows.src.core can't break windows.src.core.cameraQuality.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.commandEffects, so a change to windows.src.core.commandEffects can break windows.src.core, while a change to windows.src.core can't break windows.src.core.commandEffects.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.energyHistory, so a change to windows.src.core.energyHistory can break windows.src.core, while a change to windows.src.core can't break windows.src.core.energyHistory.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.core, while a change to windows.src.core can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.core, while a change to windows.src.core can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
36 pairs of types, where a type in windows.src.core uses a type in windows.src.core.models. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
windows.src.core uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.core, while a change to windows.src.core can't break windows.src.core.models.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.appUrlCommand, so a change to windows.src.core.appUrlCommand can break windows.src.core, while a change to windows.src.core can't break windows.src.core.appUrlCommand.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.miCloud.client, so a change to windows.src.core.miCloud.client can break windows.src.core, while a change to windows.src.core can't break windows.src.core.miCloud.client.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.optimisticLock, so a change to windows.src.core.optimisticLock can break windows.src.core, while a change to windows.src.core can't break windows.src.core.optimisticLock.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.safetyAndHealth, so a change to windows.src.core.safetyAndHealth can break windows.src.core, while a change to windows.src.core can't break windows.src.core.safetyAndHealth.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.secureStore, so a change to windows.src.core.secureStore can break windows.src.core, while a change to windows.src.core can't break windows.src.core.secureStore.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.automationEngine, so a change to windows.src.core.automationEngine can break windows.src.core, while a change to windows.src.core can't break windows.src.core.automationEngine.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.core, while a change to windows.src.core can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.diagnosticsAndScanner, so a change to windows.src.core.diagnosticsAndScanner can break windows.src.core, while a change to windows.src.core can't break windows.src.core.diagnosticsAndScanner.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.miAccountsStore, so a change to windows.src.core.miAccountsStore can break windows.src.core, while a change to windows.src.core can't break windows.src.core.miAccountsStore.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.core uses windows.src.core.dualSourceProvider, so a change to windows.src.core.dualSourceProvider can break windows.src.core, while a change to windows.src.core can't break windows.src.core.dualSourceProvider.
Position
Below the diagonal: windows.src.core uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.core.models.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.sensorHistoryView, so a change to windows.src.ui.sensorHistoryView can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.sensorHistoryView.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.core.assistant.habits, so a change to windows.src.core.assistant.habits can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.core.assistant.habits.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.energySettingsView, so a change to windows.src.ui.energySettingsView can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.energySettingsView.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.listCut, so a change to windows.src.ui.listCut can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.listCut.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.automationSettingsView, so a change to windows.src.ui.automationSettingsView can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.automationSettingsView.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.cameraLive, so a change to windows.src.ui.cameraLive can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.cameraLive.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.settingsViews, so a change to windows.src.ui.settingsViews can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.settingsViews.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.app uses windows.src.ui.connectionsAndDiagView, so a change to windows.src.ui.connectionsAndDiagView can break windows.src.ui.app, while a change to windows.src.ui.app can't break windows.src.ui.connectionsAndDiagView.
Position
Below the diagonal: windows.src.ui.app uses a module listed above it, which is the healthy direction.
windows.src.ui.intentExecution uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.ui.intentExecution, while a change to windows.src.ui.intentExecution can't break windows.src.core.models.
Position
Below the diagonal: windows.src.ui.intentExecution uses a module listed above it, which is the healthy direction.
windows.src.ui.intentExecution uses windows.src.core.optimisticLock, so a change to windows.src.core.optimisticLock can break windows.src.ui.intentExecution, while a change to windows.src.ui.intentExecution can't break windows.src.core.optimisticLock.
Position
Below the diagonal: windows.src.ui.intentExecution uses a module listed above it, which is the healthy direction.
windows.src.ui.intentExecution uses windows.src.ui.app, so a change to windows.src.ui.app can break windows.src.ui.intentExecution, while a change to windows.src.ui.intentExecution can't break windows.src.ui.app.
Position
Below the diagonal: windows.src.ui.intentExecution uses a module listed above it, which is the healthy direction.
windows.src.ui uses raycast.src.snapshot, so a change to raycast.src.snapshot can break windows.src.ui, while a change to windows.src.ui can't break raycast.src.snapshot.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.commandEffects, so a change to windows.src.core.commandEffects can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.commandEffects.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.energyHistory, so a change to windows.src.core.energyHistory can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.energyHistory.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.i18n, so a change to windows.src.core.i18n can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.i18n.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.miCloud.session, so a change to windows.src.core.miCloud.session can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.miCloud.session.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.models, so a change to windows.src.core.models can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.models.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.panelPrefs, so a change to windows.src.ui.panelPrefs can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.panelPrefs.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.sensorHistoryView, so a change to windows.src.ui.sensorHistoryView can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.sensorHistoryView.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.appUrlCommand, so a change to windows.src.core.appUrlCommand can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.appUrlCommand.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.assistant.habits, so a change to windows.src.core.assistant.habits can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.assistant.habits.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.miCloud.client, so a change to windows.src.core.miCloud.client can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.miCloud.client.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.safetyAndHealth, so a change to windows.src.core.safetyAndHealth can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.safetyAndHealth.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.deviceViews, so a change to windows.src.ui.deviceViews can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.deviceViews.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.energySettingsView, so a change to windows.src.ui.energySettingsView can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.energySettingsView.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.listCut, so a change to windows.src.ui.listCut can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.listCut.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.automationEngine, so a change to windows.src.core.automationEngine can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.automationEngine.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.miCloud.spec, so a change to windows.src.core.miCloud.spec can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.miCloud.spec.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.appTypes, so a change to windows.src.ui.appTypes can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.appTypes.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.diagnosticsAndScanner, so a change to windows.src.core.diagnosticsAndScanner can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.diagnosticsAndScanner.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.homeProvider, so a change to windows.src.core.homeProvider can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.homeProvider.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.automationSettingsView, so a change to windows.src.ui.automationSettingsView can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.automationSettingsView.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.cameraLive, so a change to windows.src.ui.cameraLive can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.cameraLive.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.layoutGestures, so a change to windows.src.ui.layoutGestures can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.layoutGestures.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.miAccountsStore, so a change to windows.src.core.miAccountsStore can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.miAccountsStore.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.settingsViews, so a change to windows.src.ui.settingsViews can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.settingsViews.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.core.dualSourceProvider, so a change to windows.src.core.dualSourceProvider can break windows.src.ui, while a change to windows.src.ui can't break windows.src.core.dualSourceProvider.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.connectionsAndDiagView, so a change to windows.src.ui.connectionsAndDiagView can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.connectionsAndDiagView.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.settingsEvents, so a change to windows.src.ui.settingsEvents can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.settingsEvents.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.app, so a change to windows.src.ui.app can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.app.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
windows.src.ui uses windows.src.ui.intentExecution, so a change to windows.src.ui.intentExecution can break windows.src.ui, while a change to windows.src.ui can't break windows.src.ui.intentExecution.
Position
Below the diagonal: windows.src.ui uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 37.2 · Weak · gated by D1, D2, R2, 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
10
High / Critical
A03:2025 — Software Supply Chain Failures
10
High / Critical
Roadmap
Top priorities: Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package; Resolve the 40 finding(s) in Cyclomatic Complexity; Bring the 44 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with DeviceSynthesizer.buildSmartDevice (cyclomatic 169), PanelRenderPipeline.commitRender (cyclomatic 153), automationSettingsView.bindAutomationSettingsEvents (cyclomatic 152).
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Bring the 44 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with DeviceSynthesizer.buildSmartDevice (cyclomatic 169), PanelRenderPipeline.commitRender (cyclomatic 153), automationSettingsView.bindAutomationSettingsEvents (cyclomatic 152).
Bring the 76 bodies over 60 down to 60 or less in Cognitive Complexity — start with DeviceSynthesizer.buildSmartDevice (cognitive 237), deviceViews.renderPrimaryDrawer (cognitive 228), commandEffects.applyCommandToDevices (cognitive 202).
Use the awaited twin of each blocking call, or move the work off the loop with `tokio::task::spawn_blocking` — a synchronous handler cannot simply `.await` in place.
Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
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 — 45
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 — 1924
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 — 87
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 28
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, 2051 of 2056 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the JavaScript/TypeScript half measured 95.3% (node:test in raycast/: not run; node:test via `npm ci --ignore-scripts` in windows/, the 3 run(s) test reliability made); the Swift half could not be measured — the Swift suite in . produced no coverage export. 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. This is OUR limitation, not a defect in the repo.
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 1,450 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 63 test source file(s) (.ts, .mjs) that it cannot: it reads the test types the .swift frontend declared, so a suite in any other language 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 SCORED: this repository's production source includes .swift, and the swift executor ran against the .swift half and never executed — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in raycast/ (2 tests); node:test via `npm ci --ignore-scripts` in windows/ (1016 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Swift Package.swift/Package.resolved, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its SwiftPM dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
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 crate 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.
D20 ADR Quality — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The ADR lexicon (adr-lexicon-1) covers de, en, it, nl. A record identified as another language, or whose language could not be identified (fewer than 25 words of prose, or no clear winner), is never read with English rules: its missing-section, status, consequence-cost and same-question rules abstain, and only the structural rules (title, single option, dangling link, enforcement field) run.
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 893 sampled here came from .swift files. This repository's .ts 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. `Sources/MenuBarMijiaApp/AutomationEngine.swift`, `Sources/MenuBarMijiaApp/CameraLivePanelController.swift`, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift`, `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift`, `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift`, … (+39 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.
D44 Platform End-of-Life — 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 dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The dev server kept running but no port it opened served a page in the time allowed. (rule: no-answer). The renderer reported: the dev server (`npm run dev` in raycast/) kept running but served no page within 2 minutes. Likely cause (not identified): the dev server kept running but no port it opened served a page in the time allowed. Last output: "> dev / > ray develop / warn - Raycast is not running / warn - Raycast is not running / info - entry points ["src/search-devices.tsx","src/search-scenes.tsx","src/ask.tsx"] / info - compiled entry points / info - generated extension's TypeScript definitions / ready - built extension successfully / warn - Raycast is not running" No runtime evidence was gathered.
AXR1 Runtime accessibility — 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. Render strategy: boot via DevServer (dev). the dev server (`npm run dev` in raycast/) kept running but served no page within 2 minutes. Likely cause (not identified): the dev server kept running but no port it opened served a page in the time allowed. Last output: "> dev / > ray develop / warn - Raycast is not running / warn - Raycast is not running / info - entry points ["src/search-devices.tsx","src/search-scenes.tsx","src/ask.tsx"] / info - compiled entry points / info - generated extension's TypeScript definitions / ready - built extension successfully / warn - Raycast is not running" No runtime evidence was gathered.
C1 Data Protection — 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. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — 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. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — 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. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — 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. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — 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. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
GD1 Unfinished & placeholder code — 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 reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's Python, Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — 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 reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and this repository's Python, Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
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. 150 further occurrence(s) are not listed individually; the score already reflects all 190.
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. 413 further occurrence(s) are not listed individually; the score already reflects all 453.
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. 14 further occurrence(s) are not listed individually; the score already reflects all 54.
S1 Web-Security Posture — 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. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
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. 42 further occurrence(s) are not listed individually; the score already reflects all 82.
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.
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.
X24 Document value interpolated into markup unescaped — 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.
X25 Inert configuration knob — 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 — 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.
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.
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.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
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 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
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.
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.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
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".
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.
414 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was DeviceSynthesizer.buildSmartDevice at 169. A further 31 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 models.localizeApplianceMode at 59 — 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: windows/src/ui/settingsSearch.ts (settingsSearch.resolveSettingsAnchorTab at 54), windows/src-tauri/src/home_assistant.rs (menubarmijia_windows::home_assistant::validate_call at 25), Sources/MijiaCore/AutomationRule.swift (AutomationTrigger.title at 21), Sources/MijiaCore/BareCategoryCommand.swift (IntentDeviceCategory.spokenNoun at 19), Sources/MijiaCore/DeviceListCut.swift (DeviceKind.tag at 16). 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.
+ 403 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 44 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with DeviceSynthesizer.buildSmartDevice (cyclomatic 169), PanelRenderPipeline.commitRender (cyclomatic 153), automationSettingsView.bindAutomationSettingsEvents (cyclomatic 152). — 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 44 together lifts Cyclomatic Complexity from 2.0 to about 4.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 488 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 76 bodies over 60 down to 60 or less in Cognitive Complexity — start with DeviceSynthesizer.buildSmartDevice (cognitive 237), deviceViews.renderPrimaryDrawer (cognitive 228), commandEffects.applyCommandToDevices (cognitive 202). — 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 76 together lifts Cognitive Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 60; 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 92 FileTooLong finding(s) in God Classes — start with GrokBallData.swift, synthesis.ts, CameraLivePanelController.swift. — One of this dimension's main actionable groups (92 warning-level).
Resolve the 51 MethodTooLong finding(s) in God Classes — start with SettingsWindowView.swift (3), HomeStore+Assistant.swift (3), HomeStore+Undo.swift (3). — One of this dimension's main actionable groups (51 warning-level).
Resolve the 44 FunctionTooLong finding(s) in God Classes — start with REDACTED (3), commandDispatch.ts (3), homeAssistant.ts (2). — One of this dimension's main actionable groups (44 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.
286 duplicated block group(s) detected. 6.7 % of the production lines (10,913 of 162,075) are in a reported copy. A further 153 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 7 of the 439 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. Measured on part of this repository only: .ts (39% 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.
+ 132 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 29 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with ClassicSensorCardView.swift (6), ClassicDeviceCardView.swift (4), ClassicControlCenterPanelLayout.swift (2). — One of this dimension's main actionable groups (29 warning-level).
Resolve the 23 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with ClassicControlCenterPanel.swift (5), ClassicControlCenterPanelChrome.swift (4), ClassicControlCenterPanelLayout.swift (3). — One of this dimension's main actionable groups (23 warning-level).
Resolve the 22 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with ClassicDeviceCardView.swift (4), ClassicControlCenterPanelLayout.swift (2), ClassicControlCenterPanel.swift (2). — One of this dimension's main actionable groups (22 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling9.1 / 10Stronggated by 1 serious finding✓ 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.
9 production modules (Cargo+npm+SwiftPM), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence, with abstractness counted on 7 of the 9 (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).
Off the main sequence: MijiaCore
What to do
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with HotkeyAndNotificationManager.swift, MenuBarPanelController.swift, DemoHomeProvider.swift. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality9.9 / 10Stronggated by 8 serious findings✓ 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, 8 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 1450 tests. Measured on the .swift suite only — at least 63 test source file(s) (.ts, .mjs) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: counterResetNeverGoesNegative · ×8Tests/MijiaCoreTests/EnergyHistoryTests.swift:131
What to do
Resolve the 8 No assertions finding(s) in Test Quality — start with EnergyHistoryTests.swift (3), FragmentedMP4DemuxerTests.swift (2), HAHomeSnapshotTests.swift. — One of this dimension's main actionable groups (8 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
0 outdated direct SwiftPM dependencies, 0 pinning defect(s). SwiftPM has no package registry: a dependency is a repository URL and its releases are that repository's semver tags, so currency is answered by listing tags rather than by querying an index. Only a newer tag on the SAME MAJOR is reported — a `from:` requirement admits everything below the next major and nothing above it, so a major crossing needs a Package.swift edit rather than an update, and naming the update as its remedy would be wrong. Whether any dependency is DEPRECATED or ABANDONED is not graded and cannot be: a repository publishes no such marker, and there is no registry that could carry one. Known CVEs in this dependency graph are D30's question.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: 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 479 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Swift Package.swift/Package.resolved and package.json, and the licences of those dependency graphs 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: windows/src/ui/bindEvents.ts (34×260=8840); windows/src/ui/app.ts (104×56=5824); Sources/MijiaCore/DeviceSynthesizer.swift (33×169=5577) Repeated repair below the complexity floor: Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift (6 of 8 changes were fixes); Sources/MijiaCore/AssistantSchedule.swift (5 of 9 changes were fixes); windows/src-tauri/src/window.rs (5 of 8 changes were fixes)
Resolve the 112 Hotspot finding(s) in Churn × Complexity Hotspots — start with bindEvents.ts, app.ts, DeviceSynthesizer.swift. — One of this dimension's main actionable groups (112 warning-level).
Resolve the 8 Repeated repair finding(s) in Churn × Complexity Hotspots — start with CameraLivePanelPTZ.swift, AssistantSchedule.swift, window.rs. — 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 Factor9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
4 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is Sources/MijiaCore/ModelIntentResolver.swift. Counted over 294 of the 334 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
✓ On the Gold path — maintain.
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.
0 deducted task-comment markers across 162075 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
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.
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.
4 naming inconsistencies among 74 declarations measured against a convention their peers follow.
`sharesDID` spells `DID` where 25 names in the project spell it `Did`Sources/MijiaCore/DeviceDeduplicator.swift:744
`cameraCardByHaDevice` spells `Ha` where 32 names in the project spell it `HA`windows/src/core/automationEngine.ts:1469
`sharesDID` spells `DID` where 13 names in the project spell it `Did`windows/src/core/dualSourceProvider.ts:434
`resolveHaCameraStreamUrl` spells `Ha` where 32 names in the project spell it `HA`windows/src/ui/cameraLive.ts:330
What to do
Resolve the 1 `sharesDID` spells `DID` where 25 names in the project spell it `Did` finding(s) in Naming Consistency — start with DeviceDeduplicator.swift. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `cameraCardByHaDevice` spells `Ha` where 32 names in the project spell… finding(s) in Naming Consistency — start with automationEngine.ts. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `sharesDID` spells `DID` where 13 names in the project spell it `Did` finding(s) in Naming Consistency — start with dualSourceProvider.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.
2 of 5 build units (Cargo, SwiftPM, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion · ×2Package.swift:1
What to do
Resolve the 2 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with Package.swift, package.json. — One of this dimension's main actionable groups (2 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
46 % of calls cross a namespace and 1 % 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 .swift source only — this repository's .ts 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: Secret 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.
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).
10 finding(s): 0 critical, 2 high, 8 medium, 0 low. semgrep hit a parse error in 28 file(s) — `.github/workflows/release.yml`, `Sources/MenuBarMijiaApp/CameraLivePanelController.swift`, `Sources/MenuBarMijiaApp/DeviceLayout.swift` (line 50, line 51, line 52, …), `Sources/MenuBarMijiaApp/PanelLayoutStore.swift` (line 22), `Sources/MijiaCore/AppURLCommand.swift` (lines 123–124, lines 124–125, lines 125–127), … (+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. Separately, one or more rules could not re-parse an embedded snippet in 3 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
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
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.
Resolve the 1 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 3 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 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.
Every significant source file has living knowledge — recently and meaningfully worked. Counted over 294 of the 334 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 8 Change coupling finding(s) in Change Coupling — start with HomeStore.swift (2), main.rs, MiotSynthesizer.swift. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with ControlCenterPanel.swift, HomeStore+Controls.swift. — One of this dimension's main actionable groups (2 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.
Build pipeline generates provenance, signs artifacts and produces an SBOM.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether 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.
No dependency in any ecosystem this repository declares is published as malicious.
✓ On the Gold path — maintain.
Detailed fixes: d43_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Do you agree with this assessment?
AC2 · Forms & labels4.9 / 10Weak✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×2) — windows/src/ui/onboardingGuide.ts:477, windows/src/ui/onboardingGuide.ts:522
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. — windows/src/ui/onboardingGuide.ts:570
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="app">, so there is no content here to wrap — render the <main> from the component mounted into it. — windows/index.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`#app[data-panel-theme="classic"] .cc-tile.is-active .cc-tile-orb` sets color: #ffffff on background-color: #ff453a — 3.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — windows/src/ui/styles.css:5226
`.cc-all-off-pill.is-holding .cc-hold-fill` moves (`transition: transform 600ms var(--ease-linear)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — windows/src/ui/styles.css:3272
`#app[data-panel-theme="classic"] .cc-tab-indicator` moves (`transition: transform 220ms var(--spring-lens), width 220ms var(--spring-lens), opacity var(--dur-fast) var(--ease-standard)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — windows/src/ui/styles.css:5168
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`SettingsEventsHost` declares 18 required operations: `clearPendingHighRisk`, `selectRoom`, `habitSequences`, `lastHabitAction`, `checkForAppUpdate`, `handleNaturalCommand`, `invalidateSourceControl`, `openSettingsSheet`, `openUpdatePage`, `refreshDevices`, `refreshHADevices`, `render`, `saveSettings`, `shouldKeepPopoverPinned`, `signOutXiaomiAccount`, `startUpdateInstall`, `startXiaomiQRLogin`, `syncKeyFieldWithEndpoint`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — REDACTED:75
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
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 · Event-Driven — Whether event/message handlers avoid synchronous blocking waits — a blocking wait inside a handler stalls throughput and risks deadlock.
Method: Roslyn semantic scan (event-driven gated): event-handler bodies scanned for HTTP/gRPC invocations by resolved symbol type, not substring. Deterministic, semantic-resolved.
`camera.scrub_persisted_streams_in_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_to_string`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:224
`camera.file_sha256_hex` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `File::open`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:399
`camera.component_is_usable` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::metadata`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:426
`camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:600
`camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. (×2) — windows/src-tauri/src/camera.rs:625, windows/src-tauri/src/camera.rs:635
`camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:628
`camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::rename`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:629
`camera.stage_go2rtc_exe` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:645
`camera.stage_go2rtc_exe` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::write`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:647
`camera.write_secret_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:711
`camera.write_secret_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::write`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:713
`camera.reserve_loopback_ports` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `TcpListener::bind`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:855
`camera.read_owner` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_to_string`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:924
`camera.ensure_go2rtc_running` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:1160
`camera.ensure_go2rtc_running` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_to_string`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/camera.rs:1178
`camera.spawn_cs2_udp_relay` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `UdpSocket::bind`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. (×3) — windows/src-tauri/src/camera.rs:1990, windows/src-tauri/src/camera.rs:2003, windows/src-tauri/src/camera.rs:2010
`companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/companion.rs:89
`companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `File::create`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/companion.rs:94
`companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. (×2) — windows/src-tauri/src/companion.rs:99, windows/src-tauri/src/companion.rs:103
`companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::rename`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/companion.rs:102
`companion.remove_snapshot_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/companion.rs:122
`network.write_origin_store` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/network.rs:440
`network.write_origin_store` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::write`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/network.rs:445
`update.sweep_stale_installers_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_dir`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:254
`update.sweep_stale_installers_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:263
`update.write_staged_installer_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:284
`update.write_staged_installer_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::symlink_metadata`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:286
`update.write_staged_installer_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:303
`update.launch_installer` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `thread::sleep`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:331
`update.install_update` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/update.rs:506
`window.write_panel_placement` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/window.rs:437
`window.write_panel_placement` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::write`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`. — windows/src-tauri/src/window.rs:440
What to do
Use the awaited twin of each blocking call, or move the work off the loop with `tokio::task::spawn_blocking` — a synchronous handler cannot simply `.await` in place.
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 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.5 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `windows/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 (a /health route on your Vapor/Hummingbird router) 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.
No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:6
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, `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:3
What to do
Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
Dependabot is configured but does not watch `npm`, `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.
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.
`fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — windows/scripts/verify-flyout-layout.mjs:202
What to do
Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.
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.
`downloadGo2RTCBinary` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:921
`fs.rmSync` in `terminateChrome` 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. — windows/scripts/verify-flyout-layout.mjs:483
`fs.mkdtempSync` in `runLaunchChromeStartupSelfTest` 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. — windows/scripts/verify-flyout-layout.mjs:499
`fs.rmSync` in `runLaunchChromeStartupSelfTest` 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. — windows/scripts/verify-flyout-layout.mjs:574
`fs.mkdtempSync` in `main` 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. — windows/scripts/verify-flyout-layout.mjs:598
`fs.mkdirSync` in `main` 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. — windows/scripts/verify-flyout-layout.mjs:605
`fs.writeFileSync` in `main` 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) — windows/scripts/verify-flyout-layout.mjs:657, windows/scripts/verify-flyout-layout.mjs:661
What to do
Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
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 Safety9.8 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
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.
16 duplicated blocks under windows/src/ have copies in at least two of the sibling directories core, ui — 13 of them are reported below, and 3 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 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 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 16 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. — windows/src/core/optimisticLock.ts:364
windows/src/ui/demo.ts:52 · windows/src/ui/demo.ts:143 — the two spans are one implementation copied and then locally edited — 400 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. — windows/src/ui/demo.ts:52
windows/src/core/models.ts:540 · windows/src/core/models.ts:618 — the two spans are one implementation copied and then locally edited — 232 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. — windows/src/core/models.ts:540
windows/src/core/miCloudCrypto.ts:114 · windows/src/core/miCloudCrypto.ts:185 — the two spans are one implementation copied and then locally edited — 435 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. — windows/src/core/miCloudCrypto.ts:114
windows/src/core/optimisticLock.ts:364 · windows/src/ui/intentExecution.ts:180 — the two spans are one implementation copied and then locally edited — 273 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. — windows/src/core/optimisticLock.ts:364
raycast/src/search-devices.tsx:8 · raycast/src/search-scenes.tsx:6 — 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. — raycast/src/search-devices.tsx:8
windows/src/ui/onboardingGuide.ts:286 · REDACTED:1112 — the 2 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. — windows/src/ui/onboardingGuide.ts:286
windows/src/core/assistant/chineseIntentTables.ts:219 · windows/src/core/assistant/intent.ts:1064 — the two spans are one implementation copied and then locally edited — 283 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. — windows/src/core/assistant/chineseIntentTables.ts:219
raycast/src/search-scenes.tsx:44 · raycast/src/search-scenes.tsx:71 — the two spans are one implementation copied and then locally edited — 182 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. — raycast/src/search-scenes.tsx:44
windows/src/ui/onboardingGuide.ts:225 · REDACTED:153 — 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. — windows/src/ui/onboardingGuide.ts:225
windows/src/core/miAccountsStore.ts:935 · REDACTED:60 — 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. — windows/src/core/miAccountsStore.ts:935
REDACTED:343 · REDACTED:951 — 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:343
windows/src/ui/onboardingGuide.ts:719 · REDACTED:814 — the 2 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. — windows/src/ui/onboardingGuide.ts:719
windows/src/core/assistant/intent.ts:1280 · windows/src/core/assistant/intent.ts:1585 — 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. — windows/src/core/assistant/intent.ts:1280
windows/src/ui/activityStackView.ts:150 · windows/src/ui/sensorHistoryView.ts:251 — the two spans are one implementation copied and then locally edited — 109 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. — windows/src/ui/activityStackView.ts:150
windows/src/core/optimisticLock.ts:812 · windows/src/ui/commandDispatch.ts:557 — 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. — windows/src/core/optimisticLock.ts:812
REDACTED:5 · windows/src/core/sensorHistory.ts:98 — the two spans are one implementation copied and then locally edited — 151 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. — REDACTED:5
windows/src/core/assistant/intent.ts:1262 · windows/src/core/assistant/intent.ts:1566 — 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. — windows/src/core/assistant/intent.ts:1262
REDACTED:843 · REDACTED:1107 — 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:843
windows/src/ui/deviceViews.ts:496 · windows/src/ui/deviceViews.ts:564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — windows/src/ui/deviceViews.ts:496
windows/src/ui/naturalCommand.ts:121 · windows/src/ui/naturalCommand.ts:243 — the two spans are one implementation copied and then locally edited — 103 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. — windows/src/ui/naturalCommand.ts:121
windows/src/ui/sensorHistoryView.ts:972 · windows/src/ui/sensorHistoryView.ts:991 — 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. — windows/src/ui/sensorHistoryView.ts:972
windows/src/core/haDomains.ts:1231 · windows/src/core/homeAssistant.ts:95 — 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. — windows/src/core/haDomains.ts:1231
windows/src/core/optimisticLock.ts:834 · windows/src/ui/commandDispatch.ts:719 — 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. — windows/src/core/optimisticLock.ts:834
windows/src/core/miCloud/command.ts:313 · windows/src/core/miCloud/command.ts:521 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — windows/src/core/miCloud/command.ts:313
windows/src/ui/automationSettingsView.ts:166 · windows/src/ui/commandDispatch.ts:109 · windows/src/ui/detailDrawers.ts:1008 — 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. — windows/src/ui/automationSettingsView.ts:166
windows/src/ui/bindEvents.ts:566 · windows/src/ui/energySettingsView.ts:681 — the two spans are one implementation copied and then locally edited — 106 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. — windows/src/ui/bindEvents.ts:566
windows/src/ui/commandDispatch.ts:109 · windows/src/ui/detailDrawers.ts:1008 — the 2 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. — windows/src/ui/commandDispatch.ts:109
windows/src/ui/deviceViews.ts:1359 · windows/src/ui/deviceViews.ts:1480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — windows/src/ui/deviceViews.ts:1359
REDACTED:27 · windows/src/core/miAccountsStore.ts:58 — the 2 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. — REDACTED:27
windows/src/core/energyHistory.ts:209 · windows/src/core/energyHistory.ts:225 — 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. — windows/src/core/energyHistory.ts:209
windows/src/core/miCloud/speakerActions.ts:56 · windows/src/core/miCloud/speakerActions.ts:104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — windows/src/core/miCloud/speakerActions.ts:56
windows/src/core/models.ts:518 · windows/src/ui/automationSettingsView.ts:396 — 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. — windows/src/core/models.ts:518
REDACTED:36 · windows/src/ui/undoTracker.ts:32 — 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:36
REDACTED:274 · REDACTED:803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:274
windows/src/ui/intentExecution.ts:621 · windows/src/ui/intentExecution.ts:644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — windows/src/ui/intentExecution.ts:621
REDACTED:581 · REDACTED:597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:581
raycast/src/snapshot-validation.ts:40 · raycast/src/snapshot-validation.ts:57 · raycast/src/snapshot-validation.ts:71 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — raycast/src/snapshot-validation.ts:40
windows/src/core/haDomains.ts:320 · windows/src/core/haDomains.ts:370 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — windows/src/core/haDomains.ts:320
windows/src/core/miCloud/speakerActions.ts:224 · windows/src/core/miCloud/speakerActions.ts:240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — windows/src/core/miCloud/speakerActions.ts:224
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
buildDeviceKind has cyclomatic complexity 370 and cognitive complexity 540; 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. — windows/src/core/miCloud/synthesis.ts:1130
deviceSvgIcon has cyclomatic complexity 140 and cognitive complexity 99; 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. — windows/src/ui/deviceViews.ts:852
applyCommandToDevices has cyclomatic complexity 138 and cognitive complexity 227; 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. — windows/src/core/commandEffects.ts:23
commitRender has cyclomatic complexity 137 and cognitive complexity 172; 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. — windows/src/ui/reconciler.ts:1294
classifyRawError has cyclomatic complexity 135 and cognitive complexity 65; 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. — windows/src/core/controlFailure.ts:136
handlePanelKey has cyclomatic complexity 124 and cognitive complexity 133; 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. — windows/src/ui/panelKeyboard.ts:260
map has cyclomatic complexity 122 and cognitive complexity 194; 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. — windows/src/core/miCloud/command.ts:95
renderPrimaryDrawer has cyclomatic complexity 122 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. — windows/src/ui/deviceViews.ts:235
merge has cyclomatic complexity 121 and cognitive complexity 179; 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. — windows/src/core/dualSourceProvider.ts:590
inverseCommands has cyclomatic complexity 117 and cognitive complexity 198; 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. — windows/src/core/commandEffects.ts:268
dispatchEvent has cyclomatic complexity 112 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. — windows/src/core/automationEngine.ts:1045
renderDeviceTile has cyclomatic complexity 112 and cognitive complexity 131; 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. — windows/src/ui/deviceViews.ts:1252
buildKind has cyclomatic complexity 107 and cognitive complexity 161; 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. — windows/src/core/homeAssistant.ts:413
applianceOrGenericIcon has cyclomatic complexity 106 and cognitive complexity 43; 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. — windows/src/ui/deviceViews.ts:706
deviceStatusSummary has cyclomatic complexity 104 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. — windows/src/core/models.ts:1129
onOpenURL has cyclomatic complexity 90 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:1064
normalize has cyclomatic complexity 90 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. — windows/src/core/assistant/intent.ts:340
capabilityScore has cyclomatic complexity 86 and cognitive complexity 132; 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. — windows/src/core/dualSourceProvider.ts:533
resolveCloudCameraStream has cyclomatic complexity 84 and cognitive complexity 201; 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. — windows/src/ui/cameraLive.ts:924
refreshDevices has cyclomatic complexity 79 and cognitive complexity 102; 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:84
evaluateSnapshot has cyclomatic complexity 76 and cognitive complexity 108; 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. — windows/scripts/verify-flyout-layout.mjs:42
haServiceCall has cyclomatic complexity 73 and cognitive complexity 82; 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. — windows/src/core/homeAssistant.ts:1130
parseEnglish has cyclomatic complexity 72 and cognitive complexity 104; 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. — windows/src/core/assistant/intent.ts:1361
hasDetailDrawer has cyclomatic complexity 72 and cognitive complexity 46; 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. — windows/src/core/models.ts:632
renderCameraLiveModalView has cyclomatic complexity 69 and cognitive complexity 77; 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. — windows/src/ui/cameraLiveModalView.ts:36
executeDirectAskPreset has cyclomatic complexity 66 and cognitive complexity 104; 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:824
(anonymous) has cyclomatic complexity 66 and cognitive complexity 81; 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. — windows/src/ui/automationSettingsView.ts:1211
loadSettings has cyclomatic complexity 65 and cognitive complexity 93; 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. — windows/src/ui/settings.ts:59
renderAutomationAndSafetySettingsSections has cyclomatic complexity 65 and cognitive complexity 64; 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. — windows/src/ui/automationSettingsView.ts:813
catalogStateSummary has cyclomatic complexity 64 and cognitive complexity 94; 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. — windows/src/core/assistant/promptContext.ts:89
applyCommand has cyclomatic complexity 64 and cognitive complexity 84; 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. — windows/src/ui/commandDispatch.ts:839
commandsForIntent has cyclomatic complexity 62 and cognitive complexity 104; 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. — windows/src/core/assistant/intent.ts:490
resolveLiveCameraTarget has cyclomatic complexity 62 and cognitive complexity 89; 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. — windows/src/core/miCloud/cameraHubs.ts:390
parseEnvelope has cyclomatic complexity 62 and cognitive complexity 66; 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:171
parseChineseDeviceCommand has cyclomatic complexity 61 and cognitive complexity 99; 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. — windows/src/core/assistant/intent.ts:1154
handleNaturalCommand has cyclomatic complexity 60 and cognitive complexity 86; 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. — windows/src/ui/naturalCommand.ts:45
extractControlIdentityKey has cyclomatic complexity 60 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 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. — windows/src/ui/reconciler.ts:128
applianceActivity has cyclomatic complexity 60 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — windows/src/core/miCloud/synthesis.ts:383
performUndo has cyclomatic complexity 57 and cognitive complexity 89; 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. — windows/src/ui/app.ts:857
executeIntents has cyclomatic complexity 55 and cognitive complexity 87; 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. — windows/src/ui/intentExecution.ts:390
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
windows/src/core/miCloud/synthesis.ts has 1965 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/miCloud/synthesis.ts:1
windows/src/ui/app.ts has 1679 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/app.ts:1
windows/src/ui/activityStackView.ts has 1664 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/activityStackView.ts:1
windows/src/ui/reconciler.ts has 1619 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/reconciler.ts:1
windows/src/ui/deviceViews.ts has 1551 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/deviceViews.ts:1
windows/src/core/automationEngine.ts has 1497 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/automationEngine.ts:1
windows/src/core/assistant/intent.ts has 1491 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/assistant/intent.ts:1
windows/src/core/models.ts has 1483 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/models.ts:1
windows/src/core/homeAssistant.ts has 1472 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/homeAssistant.ts:1
windows/src/ui/automationSettingsView.ts has 1459 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/automationSettingsView.ts:1
windows/src/ui/bindEvents.ts has 1452 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/bindEvents.ts:1
windows/src/ui/cameraLive.ts has 1407 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/cameraLive.ts:1
REDACTED has 1372 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
REDACTED has 1364 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
windows/src/ui/connectionsAndDiagView.ts has 1361 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/connectionsAndDiagView.ts:1
windows/src/core/haDomains.ts has 1355 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/haDomains.ts:1
REDACTED has 1349 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
windows/src/core/miAccountsStore.ts has 1325 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/miAccountsStore.ts:1
windows/src/core/sensorHistory.ts has 1325 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/sensorHistory.ts:1
windows/src/ui/detailDrawers.ts has 1242 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/detailDrawers.ts:1
windows/src/ui/speechGuard.ts has 1226 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/speechGuard.ts:1
REDACTED has 1209 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
REDACTED has 1156 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
windows/src/ui/commandDispatch.ts has 1123 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/commandDispatch.ts:1
windows/src/core/assistant/habits.ts has 1091 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/assistant/habits.ts:1
windows/src/core/dualSourceProvider.ts has 1076 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/dualSourceProvider.ts:1
windows/src/ui/appLifecycle.ts has 1043 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/appLifecycle.ts:1
windows/src/ui/settingsViews.ts 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. — windows/src/ui/settingsViews.ts:1
windows/src/core/optimisticLock.ts has 989 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/optimisticLock.ts:1
windows/src/ui/sensorHistoryView.ts has 970 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/sensorHistoryView.ts:1
windows/src/core/i18n.ts has 927 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/i18n.ts:1
windows/src/ui/intentExecution.ts has 915 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/intentExecution.ts:1
windows/src/ui/onboardingGuide.ts has 849 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/onboardingGuide.ts:1
windows/src/ui/settingsSearch.ts has 842 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/settingsSearch.ts:1
windows/src/core/assistant/modelIntentResolver.ts has 750 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/assistant/modelIntentResolver.ts:1
windows/src/core/miCloud/client.ts has 687 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/miCloud/client.ts:1
windows/src/core/raycastSnapshot.ts has 681 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/raycastSnapshot.ts:1
windows/src/ui/panelPrefs.ts has 674 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/panelPrefs.ts:1
windows/src/ui/energySettingsView.ts has 667 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/ui/energySettingsView.ts:1
windows/src/core/energyHistory.ts has 662 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — windows/src/core/energyHistory.ts: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.4 / 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. (×6) — raycast/src/search-devices.tsx:1, raycast/src/snapshot.ts:1, raycast/src/search-scenes.tsx: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.
Do you agree with this assessment?
R7 · Dead Code9.7 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 39 application, 3 tooling and 64 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 (39 application, 3 tooling, 64 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 (×3) — raycast/src/search-devices.tsx, raycast/src/search-scenes.tsx, raycast/src/ask.tsx
no import path from any entry point (39 application, 3 tooling, 64 test roots considered), but 3 in-repo import(s) from 3 other file(s) do name it (raycast/src/ask.tsx, raycast/src/search-devices.tsx, raycast/src/search-scenes.tsx) — 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 — raycast/src/url.ts
Nothing ultimately consumes this binding: its only referrer is the re-export in windows/src/core/assistant.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in windows/src/core/assistant.ts in the same commit, or the barrel will import a name that no longer exists. — windows/src/core/assistant/habits.ts:56
Nothing imports this binding — it is safe to review for removal. (×2) — windows/src/ui/activityStackView.ts:897, windows/src/ui/activityStackView.ts:1539
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.
Do you agree with this assessment?
R9 · Circular Imports3.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.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×29) — windows/src/ui/activityStackView.ts:415, windows/src/ui/activityStackView.ts:593, windows/src/ui/activityStackView.ts:1624, …
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×6) — windows/src/ui/appLifecycle.ts:242, windows/src/ui/appLifecycle.ts:245, windows/src/ui/cameraLive.ts:441, …
`catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included. (×5) — REDACTED:1020, windows/src/ui/onboardingGuide.ts:75, windows/src/ui/settings.ts:278, …
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.
~2.7 `!` null assertions per 1k TypeScript source lines — 180 assertion(s) across the 67843 source line(s) of the 101 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: windows/src/core/assistant/habits.ts (25), windows/src/core/dualSourceProvider.ts (16), windows/src/ui/sensorHistoryView.ts (14). 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.
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 `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 27 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 59 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.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AX1 Captive dependencies — Not applicable: this repository's Ruby imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's Swift imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
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 raycast/) kept running but served no page within 2 minutes. Likely cause (not identified): the dev server kept running but no port it opened served a page in the time allowed. Last output: "> dev / > ray develop / warn - Raycast is not running / warn - Raycast is not running / info - entry points ["src/search-devices.tsx","src/search-scenes.tsx","src/ask.tsx"] / info - compiled entry points / info - generated extension's TypeScript definitions / ready - built extension successfully / warn - Raycast is not running" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D20 ADR Quality — 21 ADR(s) are written in a language our ADR lexicon does not cover, or are too short to tell (undetermined); their sections and statuses were not judged.
D22 Internal API Consistency — API consistency is measured on C#, TypeScript, Go only; the exposed Swift surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
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) — 44 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.
D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
D8 Code Coverage — Coverage not measured — Swift suite
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (22 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
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
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 — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
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.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — X1 reached only 48% of this repository's production lines — swift (84,094 lines), cpp (6 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 48% of this repository's production lines — swift (84,094 lines), cpp (6 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 48% of this repository's production lines — swift (84,094 lines), cpp (6 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 45% of this repository's production lines — swift (84,094 lines), python (4,808 lines), cpp (6 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 45% of this repository's production lines — swift (84,094 lines), python (4,808 lines), cpp (6 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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — X2 reached only 48% of this repository's production lines — swift (84,094 lines), cpp (6 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X21 Side-effecting pattern guard — X21 reached only 48% of this repository's production lines — swift (84,094 lines), cpp (6 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 48% of this repository's production lines — swift (84,094 lines), cpp (6 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
X24 Document value interpolated into markup unescaped — X24 reached only 43% of this repository's production lines — swift (84,094 lines), rust (9,309 lines), cpp (6 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X25 Inert configuration knob — X25 reached only 48% of this repository's production lines — swift (84,094 lines), cpp (6 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — X29 reached only 45% of this repository's production lines — swift (84,094 lines), python (4,808 lines), cpp (6 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 48% of this repository's production lines — swift (84,094 lines), cpp (6 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 — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
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 Ruby was read, and it logs through none: the standard library's Logger, which Rails.logger is, takes one finished message and no template arguments or fields (as log4net does in C#), so an interpolated message there loses nothing the API could have kept. The console gem (`Console.info`), SemanticLogger, Ougai and dry-logger 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.
Critical — 45 finding(s)
ED1 · Handler temporal coupling· Blocking call on the event loop · ×36
Blocking call on the event loop: camera.scrub_persisted_streams_in_file calls `std::fs::read_to_string` windows/src-tauri/src/camera.rs:224— `camera.scrub_persisted_streams_in_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_to_string`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.file_sha256_hex calls `File::open` windows/src-tauri/src/camera.rs:399— `camera.file_sha256_hex` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `File::open`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.component_is_usable calls `std::fs::metadata` windows/src-tauri/src/camera.rs:426— `camera.component_is_usable` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::metadata`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.download_go2rtc_once calls `std::fs::create_dir_all` windows/src-tauri/src/camera.rs:600— `camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.download_go2rtc_once calls `std::fs::remove_dir_all` windows/src-tauri/src/camera.rs:625— `camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.download_go2rtc_once calls `std::fs::remove_file` windows/src-tauri/src/camera.rs:628— `camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.download_go2rtc_once calls `std::fs::rename` windows/src-tauri/src/camera.rs:629— `camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::rename`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.download_go2rtc_once calls `std::fs::remove_dir_all` windows/src-tauri/src/camera.rs:635— `camera.download_go2rtc_once` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.stage_go2rtc_exe calls `std::fs::create_dir_all` windows/src-tauri/src/camera.rs:645— `camera.stage_go2rtc_exe` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.stage_go2rtc_exe calls `std::fs::write` windows/src-tauri/src/camera.rs:647— `camera.stage_go2rtc_exe` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::write`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.write_secret_file calls `std::fs::create_dir_all` windows/src-tauri/src/camera.rs:711— `camera.write_secret_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.write_secret_file calls `std::fs::write` windows/src-tauri/src/camera.rs:713— `camera.write_secret_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::write`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.reserve_loopback_ports calls `TcpListener::bind` windows/src-tauri/src/camera.rs:855— `camera.reserve_loopback_ports` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `TcpListener::bind`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.read_owner calls `std::fs::read_to_string` windows/src-tauri/src/camera.rs:924— `camera.read_owner` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_to_string`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.ensure_go2rtc_running calls `std::fs::create_dir_all` windows/src-tauri/src/camera.rs:1160— `camera.ensure_go2rtc_running` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.ensure_go2rtc_running calls `std::fs::read_to_string` windows/src-tauri/src/camera.rs:1178— `camera.ensure_go2rtc_running` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::read_to_string`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.spawn_cs2_udp_relay calls `UdpSocket::bind` windows/src-tauri/src/camera.rs:1990— `camera.spawn_cs2_udp_relay` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `UdpSocket::bind`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.spawn_cs2_udp_relay calls `UdpSocket::bind` windows/src-tauri/src/camera.rs:2003— `camera.spawn_cs2_udp_relay` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `UdpSocket::bind`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: camera.spawn_cs2_udp_relay calls `UdpSocket::bind` windows/src-tauri/src/camera.rs:2010— `camera.spawn_cs2_udp_relay` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `UdpSocket::bind`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: companion.write_atomic_file calls `std::fs::create_dir_all` windows/src-tauri/src/companion.rs:89— `companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::create_dir_all`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: companion.write_atomic_file calls `File::create` windows/src-tauri/src/companion.rs:94— `companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `File::create`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: companion.write_atomic_file calls `std::fs::remove_file` windows/src-tauri/src/companion.rs:99— `companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: companion.write_atomic_file calls `std::fs::rename` windows/src-tauri/src/companion.rs:102— `companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::rename`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: companion.write_atomic_file calls `std::fs::remove_file` windows/src-tauri/src/companion.rs:103— `companion.write_atomic_file` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
Blocking call on the event loop: companion.remove_snapshot_in_dir calls `std::fs::remove_file` windows/src-tauri/src/companion.rs:122— `companion.remove_snapshot_in_dir` runs on the async event loop (it is async, an actor or framework handler, a hand-written `poll`, or called from one) and makes the blocking call `std::fs::remove_file`: while it blocks, the loop's worker thread serves nothing else, so every task, message and request scheduled on it waits — and a blocking wait on a future that needs that worker can deadlock. Use the awaited twin (`tokio::time::sleep(..).await`, `tokio::fs`, an async channel/client), or move the work off the loop with `tokio::task::spawn_blocking`.
+ 11 more in this group — see findings.md.
AC2 · Forms & labels· <label> that labels no control · ×2
<label> that labels no control windows/src/ui/onboardingGuide.ts:477— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control windows/src/ui/onboardingGuide.ts:522— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
Import cycle (2 files) windows/src/ui/activityStackView.ts:44— windows/src/ui/activityStackView.ts → windows/src/ui/automationSettingsView.ts → windows/src/ui/activityStackView.ts (one verified cycle inside a mutually-dependent group of 12 files)
AC2 · Forms & labels· <input> without a programmatic label · ×1
<input> without a programmatic label windows/src/ui/onboardingGuide.ts:570— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
Hotspot: windows/src/ui/bindEvents.ts windows/src/ui/bindEvents.ts:144— windows/src/ui/bindEvents.ts changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 260 in bindEvents.bindEvents at line 144. 11 of those changes were fix/bug commits, and the other 23 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/ui/bindEvents.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: windows/src/ui/app.ts windows/src/ui/app.ts:857— windows/src/ui/app.ts changed 104 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in MenuMijiaWindowsApp.performUndo at line 857. 47 of those changes were fix/bug commits, and the other 57 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/ui/app.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: Sources/MijiaCore/DeviceSynthesizer.swift Sources/MijiaCore/DeviceSynthesizer.swift:871— Sources/MijiaCore/DeviceSynthesizer.swift changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 169 in DeviceSynthesizer.buildSmartDevice at line 871. 15 of those changes were fix/bug commits, and the other 18 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/DeviceSynthesizer.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: Sources/MijiaCore/HomeStore+Backend.swift Sources/MijiaCore/HomeStore+Backend.swift:225— Sources/MijiaCore/HomeStore+Backend.swift changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in HomeStore.handleProviderEvent at line 225. 23 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/HomeStore+Backend.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: Sources/MijiaCore/HomeStore+Controls.swift Sources/MijiaCore/HomeStore+Controls.swift:60— Sources/MijiaCore/HomeStore+Controls.swift changed 47 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in HomeStore.togglePrimary at line 60. 19 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/HomeStore+Controls.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: windows/src/core/models.ts windows/src/core/models.ts:1129— windows/src/core/models.ts changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in models.deviceStatusSummary at line 1129. 17 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/core/models.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: Sources/MijiaCore/HomeStore.swift Sources/MijiaCore/HomeStore.swift:869— Sources/MijiaCore/HomeStore.swift changed 102 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in HomeStore.init at line 869. 38 of those changes were fix/bug commits, and the other 64 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/HomeStore.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: windows/src/ui/deviceViews.ts windows/src/ui/deviceViews.ts:852— windows/src/ui/deviceViews.ts changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 138 in deviceViews.deviceSvgIcon at line 852. 10 of those changes were fix/bug commits, and the other 14 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/ui/deviceViews.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: Sources/MijiaCore/HomeStore+Assistant.swift Sources/MijiaCore/HomeStore+Assistant.swift:1147— Sources/MijiaCore/HomeStore+Assistant.swift changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in HomeStore.assistantEffect at line 1147. 22 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/HomeStore+Assistant.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: Sources/MijiaCore/HomeProvider.swift Sources/MijiaCore/HomeProvider.swift:817— Sources/MijiaCore/HomeProvider.swift changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in HAWebSocketProvider.mapCommandToService at line 817. 13 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/HomeProvider.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: Sources/MijiaCore/Models.swift Sources/MijiaCore/Models.swift:1476— Sources/MijiaCore/Models.swift changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in SmartDevice.hasDetailDrawer at line 1476. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/Models.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: Sources/MenuBarMijiaApp/ControlCenterPanel.swift Sources/MenuBarMijiaApp/ControlCenterPanel.swift:826— Sources/MenuBarMijiaApp/ControlCenterPanel.swift changed 95 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in PanelSearchKeyboard.handle at line 826. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/ControlCenterPanel.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: windows/src/core/homeAssistant.ts windows/src/core/homeAssistant.ts:413— windows/src/core/homeAssistant.ts changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 139 in homeAssistant.buildKind at line 413. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/core/homeAssistant.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: Sources/MijiaCore/CommandIntent.swift Sources/MijiaCore/CommandIntent.swift:345— Sources/MijiaCore/CommandIntent.swift changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in IntentValidator.normalize at line 345. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/CommandIntent.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: REDACTED REDACTED:714— REDACTED changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in settingsEvents.bindSettingsEvents at line 714. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +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: Sources/MijiaCore/MiCloud/MiCloudProvider.swift Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1132— Sources/MijiaCore/MiCloud/MiCloudProvider.swift changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in MiCloudProvider.resolveCameraStream at line 1132. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/MiCloud/MiCloudProvider.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: windows/src/ui/cameraLive.ts windows/src/ui/cameraLive.ts:924— windows/src/ui/cameraLive.ts changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in CameraLiveController.resolveCloudCameraStream at line 924. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/ui/cameraLive.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: Sources/MijiaCore/DeviceDeduplicator.swift Sources/MijiaCore/DeviceDeduplicator.swift:400— Sources/MijiaCore/DeviceDeduplicator.swift changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in DeviceDeduplicator.capabilityScore at line 400. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/DeviceDeduplicator.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: Sources/MenuBarMijiaApp/DeviceCardView.swift Sources/MenuBarMijiaApp/DeviceCardView.swift:538— Sources/MenuBarMijiaApp/DeviceCardView.swift changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in DeviceCardView.headerRow at line 538. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/DeviceCardView.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: Sources/MijiaCore/HomeStore+Undo.swift Sources/MijiaCore/HomeStore+Undo.swift:115— Sources/MijiaCore/HomeStore+Undo.swift changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in HomeStore.executeQuickAction 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/HomeStore+Undo.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: REDACTED REDACTED:84— REDACTED changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 77 in cloudRefresh.refreshDevices at line 84. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +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: windows/src/ui/panelKeyboard.ts windows/src/ui/panelKeyboard.ts:260— windows/src/ui/panelKeyboard.ts changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 124 in panelKeyboard.handlePanelKey at line 260. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src/ui/panelKeyboard.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: Sources/MijiaCore/MiCloud/MiotCommandMapper.swift Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:32— Sources/MijiaCore/MiCloud/MiotCommandMapper.swift changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in MiotCommandMapper.map at line 32. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/MiCloud/MiotCommandMapper.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: Sources/MijiaCore/DemoHomeProvider.swift Sources/MijiaCore/DemoHomeProvider.swift:486— Sources/MijiaCore/DemoHomeProvider.swift changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in DemoHomeProvider.applying at line 486. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/DemoHomeProvider.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: Sources/MijiaCore/UserHabitMemory.swift Sources/MijiaCore/UserHabitMemory.swift:704— Sources/MijiaCore/UserHabitMemory.swift changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in UserHabitMemory.topSuggestions at line 704. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/UserHabitMemory.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.
FileTooLong: MenuBarMijiaApp/GrokBallData.swift Sources/MenuBarMijiaApp/GrokBallData.swift— FileTooLong — 3034 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: GrokBallData (25-3475). The bar is 500 significant lines; this is 2534 over it, 6.07× 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: miCloud/synthesis.ts windows/src/core/miCloud/synthesis.ts— FileTooLong — 1613 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: MiotSynthesizer (813-2058). The bar is 500 significant lines; this is 1113 over it, 3.23× 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: MenuBarMijiaApp/CameraLivePanelController.swift Sources/MenuBarMijiaApp/CameraLivePanelController.swift— FileTooLong — 1572 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1072 over it, 3.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: src/camera.rs windows/src-tauri/src/camera.rs— FileTooLong — 1448 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 70 free functions. The bar is 500 significant lines; this is 948 over it, 2.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: MijiaCore/DeviceSynthesizer.swift Sources/MijiaCore/DeviceSynthesizer.swift— FileTooLong — 1436 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: DeviceSynthesizer (266-1902). The bar is 500 significant lines; this is 936 over it, 2.87× 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: ui/activityStackView.ts windows/src/ui/activityStackView.ts— FileTooLong — 1405 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 905 over it, 2.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ui/deviceViews.ts windows/src/ui/deviceViews.ts— FileTooLong — 1385 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 885 over it, 2.77× 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: ui/app.ts windows/src/ui/app.ts— FileTooLong — 1347 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: MenuMijiaWindowsApp (178-1823). The bar is 500 significant lines; this is 847 over it, 2.69× 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: MijiaCore/Models.swift Sources/MijiaCore/Models.swift— FileTooLong — 1332 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 832 over it, 2.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ui/reconciler.ts windows/src/ui/reconciler.ts— FileTooLong — 1325 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 825 over it, 2.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: MenuBarMijiaApp/SettingsWindowView.swift Sources/MenuBarMijiaApp/SettingsWindowView.swift— FileTooLong — 1290 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 790 over it, 2.58× 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: ui/automationSettingsView.ts windows/src/ui/automationSettingsView.ts— FileTooLong — 1284 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 784 over it, 2.57× 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: core/automationEngine.ts windows/src/core/automationEngine.ts— FileTooLong — 1279 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 779 over it, 2.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: core/models.ts windows/src/core/models.ts— FileTooLong — 1220 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 720 over it, 2.44× 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: assistant/intent.ts windows/src/core/assistant/intent.ts— FileTooLong — 1214 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 714 over it, 2.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/homeAssistant.ts windows/src/core/homeAssistant.ts— FileTooLong — 1212 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 712 over it, 2.42× 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: MiCloud/MiotSynthesizer.swift Sources/MijiaCore/MiCloud/MiotSynthesizer.swift— FileTooLong — 1177 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: MiotSynthesizer (31-1565). The bar is 500 significant lines; this is 677 over it, 2.35× 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: ui/connectionsAndDiagView.ts windows/src/ui/connectionsAndDiagView.ts— FileTooLong — 1177 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 677 over it, 2.35× 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: MijiaCore/UpdateChecker.swift Sources/MijiaCore/UpdateChecker.swift— FileTooLong — 1174 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 674 over it, 2.35× 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: core/haDomains.ts windows/src/core/haDomains.ts— FileTooLong — 1153 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 653 over it, 2.31× 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: ui/bindEvents.ts windows/src/ui/bindEvents.ts— FileTooLong — 1149 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: bindEvents (144-1431). The bar is 500 significant lines; this is 649 over it, 2.30× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: MiCloud/XiaomiCameraBridge.swift Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift— FileTooLong — 1147 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 647 over it, 2.29× 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: ui/cameraLive.ts windows/src/ui/cameraLive.ts— FileTooLong — 1141 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: CameraLiveController (90-1430). The bar is 500 significant lines; this is 641 over it, 2.28× 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 — 1138 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 638 over it, 2.28× 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: MijiaCore/HomeStore+Controls.swift Sources/MijiaCore/HomeStore+Controls.swift— FileTooLong — 1125 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 625 over it, 2.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
MethodTooLong: DeviceSynthesizer.buildSmartDevice Sources/MijiaCore/DeviceSynthesizer.swift:871— MethodTooLong — buildSmartDevice runs 633 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 533 over it, 6.33× 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: GeneralSettingsTab.body Sources/MenuBarMijiaApp/SettingsWindowView.swift:444— MethodTooLong — body runs 285 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 185 over it, 2.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DeviceDeduplicator.merge Sources/MijiaCore/DeviceDeduplicator.swift:43— MethodTooLong — merge runs 267 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 167 over it, 2.67× 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: CameraLiveController.resolveCloudCameraStream windows/src/ui/cameraLive.ts:924— MethodTooLong — resolveCloudCameraStream runs 231 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 131 over it, 2.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: DemoHomeProvider.defaultHome Sources/MijiaCore/DemoHomeProvider.swift:232— MethodTooLong — defaultHome runs 211 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× 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: HomeAssistantSynthesizer.synthesize windows/src/core/homeAssistant.ts:857— MethodTooLong — synthesize runs 204 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 104 over it, 2.04× 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: DeviceSynthesizer.synthesize Sources/MijiaCore/DeviceSynthesizer.swift:267— MethodTooLong — synthesize runs 202 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 102 over it, 2.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HomeStore.togglePrimary Sources/MijiaCore/HomeStore+Controls.swift:60— MethodTooLong — togglePrimary runs 198 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× 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: SmartDevice.statusSubtitle Sources/MijiaCore/SmartDevice+Presentation.swift:97— MethodTooLong — statusSubtitle runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: LocalIntentParser.parseEnglishCommand Sources/MijiaCore/LocalIntentParser.swift:784— MethodTooLong — parseEnglishCommand runs 169 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HomeStore.assistantEffect Sources/MijiaCore/HomeStore+Assistant.swift:1147— MethodTooLong — assistantEffect runs 161 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HomeStore.handleProviderEvent Sources/MijiaCore/HomeStore+Backend.swift:225— MethodTooLong — handleProviderEvent runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: URLCommandHandler.execute Sources/MenuBarMijiaApp/URLCommandHandler.swift:292— MethodTooLong — execute runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.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.
MethodTooLong: OnboardingGuideView.step1ConnectionCard Sources/MenuBarMijiaApp/OnboardingGuideView.swift:225— MethodTooLong — step1ConnectionCard runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× 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: SettingsSearch.entries Sources/MenuBarMijiaApp/SettingsSearch.swift:252— MethodTooLong — entries runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× 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: MiotCommandMapper.map Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:32— MethodTooLong — map runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× 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: HomeStore.executeQuickAction Sources/MijiaCore/HomeStore+Undo.swift:115— MethodTooLong — executeQuickAction runs 147 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 47 over it, 1.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.
MethodTooLong: HomeStore.init Sources/MijiaCore/HomeStore.swift:869— MethodTooLong — init 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: MiCloudProvider.resolveCameraStream Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1132— MethodTooLong — resolveCameraStream runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: XiaomiCameraBridge.spawnCS2UDPRelay Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1335— MethodTooLong — spawnCS2UDPRelay runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DemoHomeProvider.applying Sources/MijiaCore/DemoHomeProvider.swift:486— MethodTooLong — applying runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: UserHabitMemory.record Sources/MijiaCore/UserHabitMemory.swift:325— MethodTooLong — record runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HAWebSocketProvider.mapCommandToService Sources/MijiaCore/HomeProvider.swift:817— MethodTooLong — mapCommandToService runs 135 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× 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: SafetyMonitor.evaluate REDACTED:536— MethodTooLong — evaluate runs 135 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× 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: UserHabitMemory.record windows/src/core/assistant/habits.ts:308— MethodTooLong — record runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.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: bindEvents.bindEvents windows/src/ui/bindEvents.ts:144— FunctionTooLong — bindEvents runs 945 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 845 over it, 9.45× 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: settingsEvents.bindSettingsEvents REDACTED:714— FunctionTooLong — bindSettingsEvents runs 540 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 440 over it, 5.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: homeAssistant.buildKind windows/src/core/homeAssistant.ts:413— FunctionTooLong — buildKind 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: appUrlCommand.onOpenURL REDACTED:1064— FunctionTooLong — onOpenURL runs 303 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: automationSettingsView.renderAutomationAndSafetySettingsSections windows/src/ui/automationSettingsView.ts:813— FunctionTooLong — renderAutomationAndSafetySettingsSections runs 272 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 172 over it, 2.72× 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: layoutGestures.bindLayoutGestures windows/src/ui/layoutGestures.ts:63— FunctionTooLong — bindLayoutGestures runs 246 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 146 over it, 2.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: panelView.renderPanel windows/src/ui/panelView.ts:19— FunctionTooLong — renderPanel runs 245 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 145 over it, 2.45× 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: cloudRefresh.refreshDevices REDACTED:84— FunctionTooLong — refreshDevices runs 227 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 127 over it, 2.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.
FunctionTooLong: cameraLiveModalView.renderCameraLiveModalView windows/src/ui/cameraLiveModalView.ts:36— FunctionTooLong — renderCameraLiveModalView runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× 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: naturalCommand.handleNaturalCommand windows/src/ui/naturalCommand.ts:45— FunctionTooLong — handleNaturalCommand runs 223 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 123 over it, 2.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: detailDrawers.bindDetailDrawerEvents windows/src/ui/detailDrawers.ts:592— FunctionTooLong — bindDetailDrawerEvents runs 216 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 116 over it, 2.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: MiIOCryptoAndPacket.swift.cleanMalformedFirmwareJSON Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:513— FunctionTooLong — cleanMalformedFirmwareJSON runs 207 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: connectionsAndDiagView.renderConnectionsAndDiagSection windows/src/ui/connectionsAndDiagView.ts:1078— FunctionTooLong — renderConnectionsAndDiagSection runs 189 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 89 over it, 1.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: panelKeyboard.handlePanelKey windows/src/ui/panelKeyboard.ts:260— FunctionTooLong — handlePanelKey runs 187 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 87 over it, 1.87× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: appUrlCommand.executeDirectAskPreset REDACTED:824— FunctionTooLong — executeDirectAskPreset runs 185 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 85 over it, 1.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: controlFailure.classifyRawError windows/src/core/controlFailure.ts:136— FunctionTooLong — classifyRawError runs 176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: commandDispatch.scheduleEchoReadBack windows/src/ui/commandDispatch.ts:531— FunctionTooLong — scheduleEchoReadBack runs 169 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: roomOrderEditor.bindRoomOrderEditorEvents windows/src/ui/roomOrderEditor.ts:458— FunctionTooLong — bindRoomOrderEditorEvents runs 166 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× 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: commandEffects.inverseCommands windows/src/core/commandEffects.ts:268— FunctionTooLong — inverseCommands runs 165 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 65 over it, 1.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: speechGuard.createUrlCommandHostAdapter windows/src/ui/speechGuard.ts:965— FunctionTooLong — createUrlCommandHostAdapter runs 159 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× 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: models.deviceStatusSummary windows/src/core/models.ts:1129— FunctionTooLong — deviceStatusSummary runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: commandDispatch.applyCommand windows/src/ui/commandDispatch.ts:839— FunctionTooLong — applyCommand runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: detailDrawers.bindSpeakerCommandBars windows/src/ui/detailDrawers.ts:1131— FunctionTooLong — bindSpeakerCommandBars runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× 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: cloudRefresh.refreshDualSourceDevices REDACTED:1079— FunctionTooLong — refreshDualSourceDevices runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: menuViews.renderContextMenu windows/src/ui/menuViews.ts:88— FunctionTooLong — renderContextMenu runs 145 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 45 over it, 1.45× 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.
Swallowed exception (empty catch) windows/src/ui/activityStackView.ts:415— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/activityStackView.ts:593— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/activityStackView.ts:1624— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/activityStackView.ts:1660— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/appLifecycle.ts:107— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/appLifecycle.ts:231— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/appLifecycle.ts:242— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) windows/src/ui/appLifecycle.ts:245— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) windows/src/ui/appLifecycle.ts:366— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/automationSettingsView.ts:332— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/automationSettingsView.ts:504— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/bindEvents.ts:563— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/cameraLive.ts:441— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) windows/src/ui/cameraLive.ts:442— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/cameraLive.ts:1363— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) windows/src/ui/cameraLive.ts:1448— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/commandDispatch.ts:735— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) windows/src/ui/connectionsAndDiagView.ts:332— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/connectionsAndDiagView.ts:346— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/connectionsAndDiagView.ts:958— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/connectionsAndDiagView.ts:972— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/detailDrawers.ts:248— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/intentExecution.ts:133— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/intentExecution.ts:972— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) windows/src/ui/reconciler.ts:693— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:1323— Sources/MenuBarMijiaApp/AssistantCommandBar.swift:1323-1330 | Sources/MenuBarMijiaApp/OnboardingGuideView.swift:734-741 — 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 `Sources/MenuBarMijiaApp/AssistantCommandBar.swift:1323` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:359— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:359-366 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:239-246 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:356` calls `padding` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:237` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1228— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1228-1235 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1195-1202 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1228` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1331— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1331-1338 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1298-1305 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1331` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:20— Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:20-27 | Sources/MenuBarMijiaApp/DeviceLayout.swift:665-672 — 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 `Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:20` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:141— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:141-148 | Sources/MenuBarMijiaApp/SensorCardView.swift:171-178 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:291— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:291-298 | Sources/MenuBarMijiaApp/SensorCardView.swift:324-331 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:774— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:774-781 | Sources/MenuBarMijiaApp/SensorCardView.swift:804-811 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/MiAccountSection.swift:254— Sources/MenuBarMijiaApp/MiAccountSection.swift:254-261 | Sources/MenuBarMijiaApp/MiAccountSection.swift:335-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/MiAccountSection.swift:254` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:329— Sources/MenuBarMijiaApp/OnboardingGuideView.swift:329-336 | Sources/MenuBarMijiaApp/SettingsWindowView.swift:1122-1129 — 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 `Sources/MenuBarMijiaApp/OnboardingGuideView.swift:329` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) Sources/MijiaCore/FragmentedMP4Demuxer.swift:253— Sources/MijiaCore/FragmentedMP4Demuxer.swift:253-260 | Sources/MijiaCore/FragmentedMP4Demuxer.swift:264-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) Sources/MijiaCore/HADiscovery.swift:528— Sources/MijiaCore/HADiscovery.swift:528-535 | Sources/MijiaCore/LGWebOSClient.swift:913-921 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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 (8 lines × 2) Sources/MijiaCore/HomeStore+ControlWrite.swift:979— Sources/MijiaCore/HomeStore+ControlWrite.swift:979-986 | Sources/MijiaCore/HomeStore+ControlWrite.swift:1013-1020 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/HomeStore+ControlWrite.swift:979` 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) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1514— Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1514-1521 | Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1543-1550 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1514` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Sources/MijiaCore/ModelIntentResolver.swift:368— Sources/MijiaCore/ModelIntentResolver.swift:368-375 | Sources/MijiaCore/ModelIntentResolver.swift:406-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/ModelIntentResolver.swift:368` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) Sources/MijiaCore/RaycastControls.swift:353— Sources/MijiaCore/RaycastControls.swift:353-360 | Sources/MijiaCore/RaycastControls.swift:586-593 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/RaycastControls.swift:353` 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) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1057— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1057-1064 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1024-1031 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MijiaCore/DeviceSynthesizer.swift:1719— Sources/MijiaCore/DeviceSynthesizer.swift:1719-1726 | Sources/MijiaCore/DeviceSynthesizer.swift:1743-1750 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/DeviceSynthesizer.swift:1719` 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) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:446— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:446-453 | Sources/MenuBarMijiaApp/DeviceCardView.swift:504-511 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:446` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/MenuBarMijiaApp/DeviceCardView.swift:514` calls `padding` and `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:456` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:666— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:666-673 | Sources/MenuBarMijiaApp/SensorCardView.swift:699-706 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:254— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:254-261 | Sources/MenuBarMijiaApp/SensorCardView.swift:287-294 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:293— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:293-300 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:664-671 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:255— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:255-262 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:245-252 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1224— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1224-1231 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:751-758 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:657— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:657-664 | Sources/MenuBarMijiaApp/SensorCardView.swift:690-697 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
ClassTooLong: GrokBallData Sources/MenuBarMijiaApp/GrokBallData.swift:25— ClassTooLong — 3033 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 2633 over it, 7.58× 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: DeviceSynthesizer Sources/MijiaCore/DeviceSynthesizer.swift:266— ClassTooLong — 1249 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 849 over it, 3.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MenuMijiaWindowsApp windows/src/ui/app.ts:178— ClassTooLong — 1177 significant lines (blank, comment-only and punctuation-only lines excluded), 93 methods. The bar is 400 significant lines; this is 777 over it, 2.94× 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: MiotSynthesizer Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:31— ClassTooLong — 1118 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 718 over it, 2.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MenuBarPanelController Sources/MenuBarMijiaApp/MenuBarPanelController.swift:37— ClassTooLong — 1034 significant lines (blank, comment-only and punctuation-only lines excluded), 85 methods. The bar is 400 significant lines; this is 634 over it, 2.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CameraLiveController windows/src/ui/cameraLive.ts:90— ClassTooLong — 1028 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods. The bar is 400 significant lines; this is 628 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DeviceCardView Sources/MenuBarMijiaApp/DeviceCardView.swift:4— ClassTooLong — 1026 significant lines (blank, comment-only and punctuation-only lines excluded), 16 methods. The bar is 400 significant lines; this is 626 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ClassicDeviceCardView Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:4— ClassTooLong — 1004 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 604 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: bindEvents windows/src/ui/bindEvents.ts:1— ClassTooLong — 945 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 545 over it, 2.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CameraLivePanelController Sources/MenuBarMijiaApp/CameraLivePanelController.swift:58— ClassTooLong — 929 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods. The bar is 400 significant lines; this is 529 over it, 2.32× 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: LocalIntentParser Sources/MijiaCore/LocalIntentParser.swift:6— ClassTooLong — 779 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 379 over it, 1.95× 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: HomeStore Sources/MijiaCore/HomeStore.swift:83— ClassTooLong — 734 significant lines (blank, comment-only and punctuation-only lines excluded), 356 methods. The bar is 400 significant lines; this is 334 over it, 1.84× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: UserHabitMemory Sources/MijiaCore/UserHabitMemory.swift:42— ClassTooLong — 722 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 322 over it, 1.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: MiSessionWriteBlocked Sources/MijiaCore/HomeStore+ControlWrite.swift:70— ClassTooLong — 696 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 296 over it, 1.74× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: OnboardingGuideView Sources/MenuBarMijiaApp/OnboardingGuideView.swift:8— ClassTooLong — 673 significant lines (blank, comment-only and punctuation-only lines excluded), 8 methods. The bar is 400 significant lines; this is 273 over it, 1.68× 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: DeviceDeduplicator Sources/MijiaCore/DeviceDeduplicator.swift:42— ClassTooLong — 662 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 262 over it, 1.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SensorCardView Sources/MenuBarMijiaApp/SensorCardView.swift:7— ClassTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded), 19 methods. The bar is 400 significant lines; this is 178 over it, 1.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: ClassicSensorCardView Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:7— ClassTooLong — 556 significant lines (blank, comment-only and punctuation-only lines excluded), 19 methods. The bar is 400 significant lines; this is 156 over it, 1.39× 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: HotkeyAndNotificationManager Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:8— ClassTooLong — 506 significant lines (blank, comment-only and punctuation-only lines excluded), 37 methods. The bar is 400 significant lines; this is 106 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.
ClassTooLong: ClassicControlCenterPanel Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:6— ClassTooLong — 487 significant lines (blank, comment-only and punctuation-only lines excluded), 65 methods. The bar is 400 significant lines; this is 87 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AutomationSettingsSection Sources/MenuBarMijiaApp/AutomationSettingsSection.swift:9— ClassTooLong — 486 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 86 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ControlCenterPanel Sources/MenuBarMijiaApp/ControlCenterPanel.swift:6— ClassTooLong — 461 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 61 over it, 1.15× 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: CameraLivePanelView Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1541— ClassTooLong — 437 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 37 over it, 1.09× 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: MiCloudClient windows/src/core/miCloud/client.ts:150— ClassTooLong — 426 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 26 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: HADiscovery Sources/MijiaCore/HADiscovery.swift:96— ClassTooLong — 413 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 13 over it, 1.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.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:123— Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:123-132 | Sources/MenuBarMijiaApp/DeviceFacetViews.swift:144-153 — 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 `Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:296— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:296-305 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:306-315 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:473— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:473-482 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:437-446 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:473` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:488— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:488-497 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:453-462 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:488` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/ControlCenterPanel.swift:451` calls `scrollDisabled`, `softTopScrollEdge` and `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:487` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:208— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:208-217 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:275-284 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:204` calls `tracking` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:271` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:524— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:524-533 | Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:732-741 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:524` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:731` calls `lineLimit` and `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:523` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:841— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:841-850 | Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:869-878 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:841` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:443— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:443-452 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:323-332 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:443` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:182— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:182-191 | Sources/MenuBarMijiaApp/SensorCardView.swift:215-224 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:182` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:473— Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:473-482 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:501-510 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:473` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MijiaCore/AssistantConfig.swift:482— Sources/MijiaCore/AssistantConfig.swift:482-491 | Sources/MijiaCore/AssistantConfig.swift:498-507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) Sources/MijiaCore/FragmentedMP4Demuxer.swift:157— Sources/MijiaCore/FragmentedMP4Demuxer.swift:157-166 | Sources/MijiaCore/FragmentedMP4Demuxer.swift:168-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/FragmentedMP4Demuxer.swift:157` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:864— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:864-873 | Sources/MenuBarMijiaApp/DeviceCardView.swift:831-840 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:864` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:90— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:90-99 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:84-93 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:75— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:75-84 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:85-94 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:832— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:832-841 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:743-752 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:832` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/MiAccountSection.swift:243— Sources/MenuBarMijiaApp/MiAccountSection.swift:243-252 | Sources/MenuBarMijiaApp/MiAccountSection.swift:322-331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:177— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:177-186 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:187-196 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:207— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:207-216 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:202-211 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:529— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:529-538 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:484-493 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1175— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1175-1184 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:702-711 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicApplianceDetailDrawer.swift:11— Sources/MenuBarMijiaApp/Classic/ClassicApplianceDetailDrawer.swift:11-20 | Sources/MenuBarMijiaApp/Classic/ClassicCoverDetailDrawer.swift:11-20 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) scripts/generate_app_icon.swift:88— scripts/generate_app_icon.swift:88-97 | scripts/generate_app_icon.swift:134-143 — both copies are in the same file, so extract the 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 `scripts/generate_app_icon.swift:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:458— Sources/MenuBarMijiaApp/AssistantCommandBar.swift:458-462 | Sources/MenuBarMijiaApp/AssistantCommandBar.swift:489-493 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/AssistantCommandBar.swift:458` 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 (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:13— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:13-17 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:14-18 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:769— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:769-773 | Sources/MenuBarMijiaApp/CoverDetailDrawer.swift:253-257 — 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 `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:769` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1238— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1238-1242 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1205-1209 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1245— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1245-1249 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1212-1216 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:216— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:216-220 | Sources/MenuBarMijiaApp/DeviceLayout.swift:469-473 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift` and `Sources/MenuBarMijiaApp/DeviceLayout.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:216` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/SettingsIconTiles.swift:102— Sources/MenuBarMijiaApp/SettingsIconTiles.swift:102-106 | Sources/MenuBarMijiaApp/SettingsIconTiles.swift:123-128 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/SettingsIconTiles.swift:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/UpdateSection.swift:348— Sources/MenuBarMijiaApp/UpdateSection.swift:348-352 | Sources/MenuBarMijiaApp/UpdateSection.swift:394-398 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/UpdateSection.swift:348` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/MenuBarMijiaApp/UpdateSection.swift:353` calls `toggle` and `Sources/MenuBarMijiaApp/UpdateSection.swift:399` 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 (5 lines × 2) Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:347— Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:347-353 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:820-824 — 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 `Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:347` 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 (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:80— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:80-84 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:74-78 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:406— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:406-410 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:400-404 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:804— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:804-808 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:436-440 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:559— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:559-563 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:437-441 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1356— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1356-1360 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1323-1327 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:59— Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:59-63 | Sources/MenuBarMijiaApp/DeviceLayout.swift:696-700 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:15— Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:15-19 | Sources/MenuBarMijiaApp/PanelDesign.swift:133-137 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift` and `Sources/MenuBarMijiaApp/PanelDesign.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicStackedCardGeometry.swift:18— Sources/MenuBarMijiaApp/Classic/ClassicStackedCardGeometry.swift:18-22 | Sources/MenuBarMijiaApp/StackedCardGeometry.swift:27-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:845— Sources/MijiaCore/MiCloud/MiCloudProvider.swift:845-849 | Sources/MijiaCore/RaycastSnapshot.swift:915-919 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:282— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:282-286 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:292-296 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:282` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:684— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:684-688 | Sources/MenuBarMijiaApp/SensorCardView.swift:717-721 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:684` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/MenuBarMijiaApp/SensorCardView.swift:722` calls `lineLimit` and `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:689` 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 (5 lines × 2) Sources/MijiaCore/RaycastControls.swift:455— Sources/MijiaCore/RaycastControls.swift:455-459 | Sources/MijiaCore/RaycastControls.swift:490-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) windows/src-tauri/src/window.rs:504— windows/src-tauri/src/window.rs:504-508 | windows/src-tauri/src/window.rs:533-537 — both copies are in the same file, so extract the block into 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) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:784— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:784-789 | Sources/MenuBarMijiaApp/DeviceCardView.swift:751-756 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:784` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1311— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1311-1316 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1278-1283 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1311` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1428— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1428-1433 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1395-1400 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1428` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Sources/MijiaCore/MiCloud/MiCloudClient.swift:508— Sources/MijiaCore/MiCloud/MiCloudClient.swift:508-513 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:535-540 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/MiCloudClient.swift:508` 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 (6 lines × 2) Sources/MijiaCore/MiCloud/MiCloudClient.swift:1052— Sources/MijiaCore/MiCloud/MiCloudClient.swift:1052-1057 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:1264-1269 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/MiCloudClient.swift:1052` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Sources/MijiaCore/UpdateManifest.swift:91— Sources/MijiaCore/UpdateManifest.swift:91-96 | scripts/sign_update.swift:93-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:99— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:99-104 | Sources/MenuBarMijiaApp/RoomOrderEditor.swift:638-643 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:288— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:288-293 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:219-224 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:675— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:675-680 | Sources/MenuBarMijiaApp/SensorCardView.swift:708-713 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) Sources/MijiaCore/DeviceSynthesizer.swift:1046— Sources/MijiaCore/DeviceSynthesizer.swift:1046-1051 | Sources/MijiaCore/DeviceSynthesizer.swift:1092-1097 — both copies are in the same file, so extract the block into 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) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:219— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:219-224 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:286-291 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1168— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1168-1173 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:695-700 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:32— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:32-37 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:42-47 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:61— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:61-66 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:71-76 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:368— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:368-373 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:248-253 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:251— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:251-256 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:622-627 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:286— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:286-291 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:657-662 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1271— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1271-1276 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1238-1243 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1271` 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) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:209— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:209-214 | Sources/MenuBarMijiaApp/DeviceLayout.swift:462-467 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift` and `Sources/MenuBarMijiaApp/DeviceLayout.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:224— Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:224-229 | Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:243-248 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:224` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:669— Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:669-674 | Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:712-717 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:669` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:549— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:549-557 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:416-424 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:537— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:537-545 | Sources/MenuBarMijiaApp/DeviceCardView.swift:558-566 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:537` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:870— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:870-878 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:901-909 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:870` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:76— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:76-84 | Sources/MenuBarMijiaApp/SensorCardView.swift:89-97 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:354— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:354-362 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:711-719 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:354` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/DeviceCardView.swift:208— Sources/MenuBarMijiaApp/DeviceCardView.swift:208-216 | Sources/MenuBarMijiaApp/SensorCardView.swift:227-235 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/DeviceCardView.swift:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/DeviceCardView.swift:206` calls `hasDetailDrawer` and `Sources/MenuBarMijiaApp/SensorCardView.swift:224` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/DeviceCardView.swift:837— Sources/MenuBarMijiaApp/DeviceCardView.swift:837-845 | Sources/MenuBarMijiaApp/DeviceCardView.swift:868-876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/DeviceCardView.swift:837` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MijiaCore/MiCloud/MiCloudClient.swift:1157— Sources/MijiaCore/MiCloud/MiCloudClient.swift:1157-1165 | Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:104-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:125— Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:125-133 | Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:153-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:125` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MijiaCore/ModelIntentResolver.swift:243— Sources/MijiaCore/ModelIntentResolver.swift:243-251 | Sources/MijiaCore/ModelIntentResolver.swift:270-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/ModelIntentResolver.swift:243` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) Sources/MijiaCore/SensorHistory.swift:372— Sources/MijiaCore/SensorHistory.swift:372-380 | Sources/MijiaCore/SensorHistory.swift:385-393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/SensorHistory.swift:372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:171— Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:171-179 | Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:202-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:584— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:584-592 | Sources/MenuBarMijiaApp/SensorCardView.swift:617-625 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) Sources/MijiaCore/DeviceSynthesizer.swift:1490— Sources/MijiaCore/DeviceSynthesizer.swift:1490-1498 | Sources/MijiaCore/DeviceSynthesizer.swift:1505-1513 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/DeviceSynthesizer.swift:1490` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:653— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:653-661 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:609-617 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:789— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:789-797 | Sources/MenuBarMijiaApp/SensorCardView.swift:819-827 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:764— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:764-772 | Sources/MenuBarMijiaApp/SensorCardView.swift:794-802 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) windows/src-tauri/src/camera.rs:1577— windows/src-tauri/src/camera.rs:1577-1585 | windows/src-tauri/src/camera.rs:1654-1662 — both copies are in the same file, so extract the 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 `windows/src-tauri/src/camera.rs:1577` 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.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×17
Edited copy of a member (4 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:649— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:649-652 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:527-530 — 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) Sources/MijiaCore/HAHomeSnapshot.swift:103— Sources/MijiaCore/HAHomeSnapshot.swift:103-110 | Sources/MenuBarMijiaApp/UnsupportedDeviceScanner.swift:323-326 — 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) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:663— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:663-666 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:619-622 — 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) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:138— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:138-141 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:148-151 — 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) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:184— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:184-187 | Sources/MenuBarMijiaApp/DeviceLayout.swift:437-440 — 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) Sources/MijiaCore/HomeStore+Security.swift:28— Sources/MijiaCore/HomeStore+Security.swift:28-31 | Sources/MijiaCore/ManualControlPolicy.swift:34-37 — 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) Sources/MenuBarMijiaApp/Classic/ClassicStackedCardGeometry.swift:23— Sources/MenuBarMijiaApp/Classic/ClassicStackedCardGeometry.swift:23-26 | Sources/MenuBarMijiaApp/StackedCardGeometry.swift:32-35 — 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) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:683— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:683-686 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:639-642 — 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) Sources/MenuBarMijiaApp/RoomOrderDraft.swift:128— Sources/MenuBarMijiaApp/RoomOrderDraft.swift:128-131 | Sources/MijiaCore/MiCloud/MiAccountLogin.swift:512-515 — 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) Sources/MijiaCore/EnergyHistory.swift:317— Sources/MijiaCore/EnergyHistory.swift:317-320 | Sources/MijiaCore/SensorHistory.swift:702-705 — 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) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:753— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:753-756 | Sources/MenuBarMijiaApp/SensorCardView.swift:777-780 — 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) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:223— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:223-226 | Sources/MenuBarMijiaApp/SensorCardView.swift:256-259 — 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) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:218— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:218-221 | Sources/MenuBarMijiaApp/SensorCardView.swift:251-254 — 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) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:43— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:43-46 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:43-46 — 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) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:226— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:226-231 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:221-224 — 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) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:648— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:648-651 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:604-607 — 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) Sources/MenuBarMijiaApp/AutomationSettingsSection.swift:434— Sources/MenuBarMijiaApp/AutomationSettingsSection.swift:434-439 | Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:599-602 — 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 (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:744— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:744-755 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:939-950 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:191— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:191-202 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:259-270 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:191` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1012— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1012-1023 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:646-657 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1012` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:21— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:21-32 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1434-1445 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:21` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:734— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:734-745 | Sources/MenuBarMijiaApp/CoverDetailDrawer.swift:218-229 — 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 `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:734` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:55— Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:55-66 | Sources/MenuBarMijiaApp/PanelDesign.swift:280-291 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift` and `Sources/MenuBarMijiaApp/PanelDesign.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Sources/MijiaCore/AssistantEndpoint.swift:21— Sources/MijiaCore/AssistantEndpoint.swift:21-32 | Sources/MijiaCore/HAPlaintextConsent.swift:42-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) Sources/MijiaCore/HomeStore+Undo.swift:785— Sources/MijiaCore/HomeStore+Undo.swift:785-796 | Sources/MijiaCore/HomeStore+Undo.swift:829-840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/HomeStore+Undo.swift:785` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1464— Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1464-1475 | Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1489-1500 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1464` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:261— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:261-272 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:271-282 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:261` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:296— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:296-307 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:227-238 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:381— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:381-392 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:261-272 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:381` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) Sources/MijiaCore/HomeProvider.swift:268— Sources/MijiaCore/HomeProvider.swift:268-279 | Sources/MijiaCore/LGWebOSClient.swift:487-498 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) windows/src-tauri/src/camera.rs:1302— windows/src-tauri/src/camera.rs:1302-1313 | windows/src-tauri/src/camera.rs:1317-1328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:205— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:205-215 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:215-225 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:226— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:226-236 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:293-303 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:226` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:388— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:388-398 | Sources/MenuBarMijiaApp/SensorCardView.swift:421-431 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:617— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:617-627 | Sources/MenuBarMijiaApp/SensorCardView.swift:650-660 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:629— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:629-639 | Sources/MenuBarMijiaApp/SensorCardView.swift:662-672 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:194— Sources/MenuBarMijiaApp/OnboardingGuideView.swift:194-204 | Sources/MenuBarMijiaApp/OnboardingGuideView.swift:391-401 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/OnboardingGuideView.swift:194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:368— Sources/MenuBarMijiaApp/ThemeAndMotion.swift:368-378 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:455-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) Sources/MijiaCore/HomeStore+Undo.swift:286— Sources/MijiaCore/HomeStore+Undo.swift:286-297 | Sources/MijiaCore/HomeStore+Undo.swift:503-513 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/HomeStore+Undo.swift:286` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) Sources/MijiaCore/HomeStore+Undo.swift:299— Sources/MijiaCore/HomeStore+Undo.swift:299-309 | Sources/MijiaCore/HomeStore+Undo.swift:515-525 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/HomeStore+Undo.swift:299` 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 (11 lines × 2) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1354— Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1354-1364 | Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1385-1395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1258— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1258-1268 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1225-1235 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1258` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:109— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:109-119 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:103-113 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:109` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:303— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:303-313 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:674-684 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:659— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:659-669 | Sources/MenuBarMijiaApp/DeviceCardView.swift:678-688 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
TooManyMethods: HomeStore Sources/MijiaCore/HomeStore.swift:83— TooManyMethods — 356 methods, declared across 22 files: MijiaCore/HomeStore+Controls.swift (66), MijiaCore/HomeStore+Backend.swift (50), MijiaCore/HomeStore+Assistant.swift (47), MijiaCore/HomeStore+ControlWrite.swift (44), +18 more file(s). The bar is 30 methods; this is 326 over it, 11.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: MenuMijiaWindowsApp windows/src/ui/app.ts:178— TooManyMethods — 93 methods. The bar is 30 methods; this is 63 over it, 3.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MenuBarPanelController Sources/MenuBarMijiaApp/MenuBarPanelController.swift:37— TooManyMethods — 85 methods, declared across 2 files: MenuBarMijiaApp/MenuBarPanelController.swift (70), MenuBarMijiaApp/MenuBarPanelController+Presentation.swift (15). The bar is 30 methods; this is 55 over it, 2.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: CameraLivePanelController Sources/MenuBarMijiaApp/CameraLivePanelController.swift:58— TooManyMethods — 79 methods, declared across 2 files: MenuBarMijiaApp/CameraLivePanelController.swift (54), MenuBarMijiaApp/CameraLivePanelPTZ.swift (25). The bar is 30 methods; this is 49 over it, 2.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: XiaomiCameraBridge Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:151— TooManyMethods — 77 methods. The bar is 30 methods; this is 47 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ControlCenterPanel Sources/MenuBarMijiaApp/ControlCenterPanel.swift:6— TooManyMethods — 72 methods, declared across 4 files: MenuBarMijiaApp/ControlCenterPanelLayout.swift (33), MenuBarMijiaApp/ControlCenterPanel.swift (18), MenuBarMijiaApp/ControlCenterPanelStacks.swift (11), MenuBarMijiaApp/ControlCenterPanelChrome.swift (10). The bar is 30 methods; this is 42 over it, 2.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: ClassicControlCenterPanel Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:6— TooManyMethods — 65 methods, declared across 3 files: Classic/ClassicControlCenterPanelLayout.swift (30), Classic/ClassicControlCenterPanel.swift (18), Classic/ClassicControlCenterPanelChrome.swift (17). The bar is 30 methods; this is 35 over it, 2.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: MiCloudProvider Sources/MijiaCore/MiCloud/MiCloudProvider.swift:6— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CameraLiveController windows/src/ui/cameraLive.ts:90— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MiCloudClient Sources/MijiaCore/MiCloud/MiCloudClient.swift:217— TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HAWebSocketProvider Sources/MijiaCore/HomeProvider.swift:162— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HotkeyAndNotificationManager Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:8— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ModelIntentResolver Sources/MijiaCore/ModelIntentResolver.swift:93— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1323— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1323-1329 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1290-1296 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1383— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1383-1389 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1350-1356 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1383` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/SettingsWindowView.swift:811— Sources/MenuBarMijiaApp/SettingsWindowView.swift:811-817 | Sources/MenuBarMijiaApp/SettingsWindowView.swift:1566-1572 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/SettingsWindowView.swift:811` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Sources/MijiaCore/HADiscovery.swift:640— Sources/MijiaCore/HADiscovery.swift:640-646 | Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:418-424 — 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 `Sources/MijiaCore/HADiscovery.swift:640` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:316— Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:316-322 | Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:344-350 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:396— Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:396-402 | Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:412-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:396` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:222— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:222-228 | Sources/MenuBarMijiaApp/DeviceLayout.swift:475-481 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift` and `Sources/MenuBarMijiaApp/DeviceLayout.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:222` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:218— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:218-224 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:213-219 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:269— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:269-275 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:259-265 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:292— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:292-298 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:282-288 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:300` calls `syncMenuBarWindowSize`, `updatePanelSize` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift:294` 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 (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:44— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:44-50 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:54-60 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) Sources/MijiaCore/EnergyHistory.swift:322— Sources/MijiaCore/EnergyHistory.swift:322-328 | Sources/MijiaCore/SensorHistory.swift:707-713 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:609— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:609-615 | Sources/MenuBarMijiaApp/DeviceCardView.swift:660-666 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:609` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×10
Edited copy of a member (12 corresponding lines) Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:393— Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:393-405 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:805-816 — 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) Sources/MijiaCore/MiCloud/CameraLensCatalog.swift:47— Sources/MijiaCore/MiCloud/CameraLensCatalog.swift:47-60 | Sources/MijiaCore/MiCloud/MiotFacets.swift:718-729 — 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) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:621— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:621-632 | Sources/MenuBarMijiaApp/SmallDeviceTile.swift:47-58 — 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) Sources/MenuBarMijiaApp/MenuBarPanelController.swift:1212— Sources/MenuBarMijiaApp/MenuBarPanelController.swift:1212-1228 | Sources/MenuBarMijiaApp/MenuBarPanelController.swift:1230-1241 — 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) Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:664— Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:664-675 | Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:682-694 — 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) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1323— Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1323-1334 | Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:211-223 — 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) Sources/MijiaCore/LGWebOSClient.swift:452— Sources/MijiaCore/LGWebOSClient.swift:452-463 | Sources/MijiaCore/LGWebOSClient.swift:465-477 — 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) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:307— Sources/MenuBarMijiaApp/ThemeAndMotion.swift:307-318 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:323-334 — 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) Sources/MijiaCore/CommandIntent.swift:963— Sources/MijiaCore/CommandIntent.swift:963-974 | Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1056-1072 — 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) scripts/probe_lan_gateway.py:387— scripts/probe_lan_gateway.py:387-398 | scripts/probe_lan_gateway.py:402-414 — 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.
menubarmijia_windows::camera::drain_complete_jpeg_frames (cognitive 76) windows/src-tauri/src/camera.rs:1254— menubarmijia_windows::camera::drain_complete_jpeg_frames has cognitive complexity 76 (threshold 15). Drivers by points: if/else 18 (60 pts), match/switch 2 (8 pts), loops 3 (7 pts), boolean chains 1 (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.
menubarmijia_windows::camera::is_likely_concealed_gray_jpeg (cognitive 45) windows/src-tauri/src/camera.rs:1391— menubarmijia_windows::camera::is_likely_concealed_gray_jpeg has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 6, loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menubarmijia_windows::camera::spawn_cs2_udp_relay (cognitive 38) windows/src-tauri/src/camera.rs:1983— menubarmijia_windows::camera::spawn_cs2_udp_relay has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (25 pts), match/switch 3 (7 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menubarmijia_windows::companion::handle_ipc_client (cognitive 35) windows/src-tauri/src/companion.rs:508— menubarmijia_windows::companion::handle_ipc_client has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menubarmijia_windows::network::native_http (cognitive 25) windows/src-tauri/src/network.rs:136— menubarmijia_windows::network::native_http has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 3 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menubarmijia_windows::main (cognitive 19) windows/src-tauri/src/main.rs:216— menubarmijia_windows::main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
menubarmijia_windows::camera::ensure_go2rtc_running (cognitive 19) windows/src-tauri/src/camera.rs:1158— menubarmijia_windows::camera::ensure_go2rtc_running has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
menubarmijia_windows::network::parse_ha_endpoint_parts (cognitive 18) windows/src-tauri/src/network.rs:263— menubarmijia_windows::network::parse_ha_endpoint_parts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
menubarmijia_windows::update::install_update (cognitive 16) windows/src-tauri/src/update.rs:367— menubarmijia_windows::update::install_update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1954— Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1954-1968 | Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1970-1984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1952` calls `frame` and `Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1968` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1152— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1152-1166 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:679-693 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:552— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:552-566 | Sources/MenuBarMijiaApp/DeviceCardView.swift:630-644 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1364— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1364-1378 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1331-1345 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:51— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:51-65 | Sources/MenuBarMijiaApp/SensorCardView.swift:51-65 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Sources/MijiaCore/HomeProvider.swift:281— Sources/MijiaCore/HomeProvider.swift:281-295 | Sources/MijiaCore/LGWebOSClient.swift:500-514 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) Sources/MijiaCore/MiCloud/MiCloudClient.swift:933— Sources/MijiaCore/MiCloud/MiCloudClient.swift:933-947 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:954-968 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/MiCloud/MiCloudClient.swift:933` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:641— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:641-655 | Sources/MenuBarMijiaApp/SensorCardView.swift:674-688 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:410— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:410-424 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:764-778 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
No assertions: counterResetNeverGoesNegative Tests/MijiaCoreTests/EnergyHistoryTests.swift:131— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: outOfOrderSamplesIgnored Tests/MijiaCoreTests/EnergyHistoryTests.swift:172— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: restartKeepsHistoryAndBaseline Tests/MijiaCoreTests/EnergyHistoryTests.swift:388— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: mutatedStreamsNeverTrap Tests/MijiaCoreTests/FragmentedMP4DemuxerTests.swift:199— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: arbitraryBytesNeverTrap Tests/MijiaCoreTests/FragmentedMP4DemuxerTests.swift:217— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: randomFramesNeverTrap Tests/MijiaCoreTests/HAHomeSnapshotTests.swift:238— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: cleanMalformedFirmwareJSONFuzz Tests/MijiaCoreTests/LocalMiIOAndHybridTests.swift:419— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: coverageGolden Tests/MijiaCoreTests/MiotFacetsTests.swift:189— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
Repeated repair: Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:133— Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is CameraLivePanelController.run at line 133), 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(camera): keep a release stop tracked when quitting retries a failed PTZ stop (#195)”; “fix(camera): harden macOS and Windows camera lifecycle, PTZ stop, go2rtc reaping, and topology cache (#157)”; “fix: close pre-1.2.5 cross-platform security, concurrency, synthesis, and release-gate findings (#107)”; “fix: close doorbell, read-only control, and URL temperature gaps (#79)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/CameraLivePanelPTZ.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: Sources/MijiaCore/AssistantSchedule.swift Sources/MijiaCore/AssistantSchedule.swift:138— Sources/MijiaCore/AssistantSchedule.swift changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is DelayPhrase.spokenNumber at line 138), 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: close pre-1.2.5 cross-platform security, concurrency, synthesis, and release-gate findings (#107)”; “fix(macos): consume timers before running and keep them across source changes (#52)”; “fix(macos): guard safety notifications and bind timers to their source (#43)”; “fix: protect NAS deployments and complete assistant localization (#72)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/AssistantSchedule.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: windows/src-tauri/src/window.rs windows/src-tauri/src/window.rs:760— windows/src-tauri/src/window.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is menubarmijia_windows::window::toggle_main_window at line 760), 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): harden Tauri IPC bounds, camera stream allowlist, and dead stubs (#135)”; “fix(windows,scripts): add flyout geometry, layout, and worktree gates (#127)”; “fix(windows): harden Win11 flyout footer, sub-flyout stack, and spatial tray toggle (#122)”; “fix(windows): refine Win11 hybrid capsule pills, camera deck, sub-flyout, and tray reopen (#121)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- windows/src-tauri/src/window.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: Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:542— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.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 ClassicControlCenterPanel.omnibar at line 542), 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: “refactor(macos): deduplicate Classic/Glass views and fix UI/idle regressions (#41, #32a, #32b, #39, U2-U4, U7-U8) (#142)”; “fix: close pre-1.2.5 cross-platform security, concurrency, synthesis, and release-gate findings (#107)”; “fix: resolve remaining Codex review findings from PRs #70 and #103 (#109)”; “fix: harden untrusted-number handling and close cross-platform gaps found in the 1.2.5 read (#103)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.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: Sources/MijiaCore/MiCloud/LocalMiIOClient.swift Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:416— Sources/MijiaCore/MiCloud/LocalMiIOClient.swift changed 3 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 15 (its worst body is LocalMiIOClient.isPrivateRFC1918IPv4 at line 416), 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(swift): prune dead non-seam symbols and complete zh-Hant localization (#162)”; “fix(security): close network, redirect, LAN, handshake, and rate-limit boundaries (#139)”; “fix: project audit fixes for assistant, automation, facet safety, Windows, and CI (#129)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MijiaCore/MiCloud/LocalMiIOClient.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: Sources/MenuBarMijiaApp/Classic/ClassicApplianceDetailDrawer.swift Sources/MenuBarMijiaApp/Classic/ClassicApplianceDetailDrawer.swift:11— Sources/MenuBarMijiaApp/Classic/ClassicApplianceDetailDrawer.swift changed 3 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 1 (its worst body is ClassicApplianceDetailDrawer.body at line 11), 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: “refactor(macos): deduplicate Classic/Glass views and fix UI/idle regressions (#41, #32a, #32b, #39, U2-U4, U7-U8) (#142)”; “fix: close pre-1.2.5 cross-platform security, concurrency, synthesis, and release-gate findings (#107)”; “fix: resolve remaining Codex review findings from PRs #70 and #103 (#109)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/Classic/ClassicApplianceDetailDrawer.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: Sources/MenuBarMijiaApp/Classic/ClassicDeviceFacetViews.swift Sources/MenuBarMijiaApp/Classic/ClassicDeviceFacetViews.swift:12— Sources/MenuBarMijiaApp/Classic/ClassicDeviceFacetViews.swift changed 3 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 1 (its worst body is ClassicDetailPillButton.body at line 12), 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: “refactor(macos): deduplicate Classic/Glass views and fix UI/idle regressions (#41, #32a, #32b, #39, U2-U4, U7-U8) (#142)”; “fix: close pre-1.2.5 cross-platform security, concurrency, synthesis, and release-gate findings (#107)”; “fix: harden untrusted-number handling and close cross-platform gaps found in the 1.2.5 read (#103)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/Classic/ClassicDeviceFacetViews.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: Sources/MenuBarMijiaApp/ControlCenterPanelStacks.swift Sources/MenuBarMijiaApp/ControlCenterPanelStacks.swift:180— Sources/MenuBarMijiaApp/ControlCenterPanelStacks.swift changed 3 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 ControlCenterPanel.deviceStacks at line 180), 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: close pre-1.2.5 cross-platform security, concurrency, synthesis, and release-gate findings (#107)”; “fix: resolve remaining Codex review findings from PRs #70 and #103 (#109)”; “fix(macos): omit redundant single-item headers and duplicate room badges in Liquid Glass (#89)”. 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-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 19:53:40 +08:00' --until='2026-11-17 19:53:40 +08:00' --full-history --no-merges -- Sources/MenuBarMijiaApp/ControlCenterPanelStacks.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.
Change coupling: main.rs ↔ app.ts windows/src-tauri/src/main.rs:1— `windows/src-tauri/src/main.rs` and `windows/src/ui/app.ts` change together 65% of the time (20 of the 31 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 20 shared commits counted here, the most recent 3 are `04536add` feat(windows): add PanelTheme profile, Settings switcher, and dynamic…; `71c0ced0` fix(windows): harden Win11 flyout footer, sub-flyout stack, and spati…; `20f84443` fix(windows): refine Win11 hybrid capsule pills, camera deck, sub-fly… — run `git show` on any of them.
Change coupling: MiotSynthesizer.swift ↔ ModelActionPolicy.swift Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1— `Sources/MijiaCore/MiCloud/MiotSynthesizer.swift` and `Sources/MijiaCore/ModelActionPolicy.swift` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `eda82dee` 洗衣机、烘干机、洗碗机:状态、程序、剩余时间与起停 (#3); `47396e2e` 浴霸、油烟机:多服务聚合成一张家电卡 (#4); `22f3a422` [设备][macOS] 家电卡片第一刀:热水器(电源、目标温度、模式、状态、故障) (#300) (#347) — run `git show` on any of them.
Change coupling: miCloudClient.ts ↔ models.ts windows/src/core/miCloudClient.ts:1— `windows/src/core/miCloudClient.ts` and `windows/src/core/models.ts` 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `64912684` feat(mi): show the sanmei.valve.s1 mains breaker as a read-only meter…; `82156866` fix(ai): require a tap for shared and wide model actions (#194); `2e577e5d` fix(miot): keep unverified fallback specs read-only (#154) (#159) — run `git show` on any of them.
Change coupling: HomeStore.swift ↔ MiCloudClient.swift Sources/MijiaCore/HomeStore.swift:1— `Sources/MijiaCore/HomeStore.swift` and `Sources/MijiaCore/MiCloud/MiCloudClient.swift` 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these 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 `0a325983` fix(micloud): reject code-less responses, complete shared-home discov…; `f7b1d488` feat(controls): explain why a control write failed (#289); `5fd791a3` feat(mi): fold Mi light-group members into the group card on macOS (#… — run `git show` on any of them.
Change coupling: bindEvents.ts ↔ deviceViews.ts windows/src/ui/bindEvents.ts:1— `windows/src/ui/bindEvents.ts` and `windows/src/ui/deviceViews.ts` 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) 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 `8198a83b` feat(windows): add 28px LiquidGlassSlider and unified peek/swipe uppe…; `433dff8d` feat(windows): add Classic single-card glass shell, 4-size Bento grid…; `20f84443` fix(windows): refine Win11 hybrid capsule pills, camera deck, sub-fly… — run `git show` on any of them.
Change coupling: HomeStore.swift ↔ LocalIntentParser.swift Sources/MijiaCore/HomeStore.swift:1— `Sources/MijiaCore/HomeStore.swift` and `Sources/MijiaCore/LocalIntentParser.swift` change together 50% of the time (6 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `7c336c04` feat(raycast): companion snapshot and trusted bridge token for menumi…; `53d8a5d7` feat: persist scheduled timers, lower macOS target to 14.0, and share…; `fff32d65` fix(windows): system tray popover, real Xiaomi device sync, and Apple… — run `git show` on any of them.
Change coupling: HomeStore+Backend.swift ↔ HomeStore+Metrics.swift Sources/MijiaCore/HomeStore+Backend.swift:1— `Sources/MijiaCore/HomeStore+Backend.swift` and `Sources/MijiaCore/HomeStore+Metrics.swift` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `b22c4838` fix(mi): keep working sources usable when one Mi account expires or H…; `5fd791a3` feat(mi): fold Mi light-group members into the group card on macOS (#…; `ac374545` feat(core): remember the Mi session's server-declared end — run `git show` on any of them.
Change coupling: synthesis.ts ↔ deviceViews.ts windows/src/core/miCloud/synthesis.ts:1— `windows/src/core/miCloud/synthesis.ts` and `windows/src/ui/deviceViews.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `e2c4662c` fix: align HA/MIoT synthesis, command coercion, and presentation pari…; `853f4c40` fix: resolve remaining Codex review findings from PRs #70 and #103 (#…; `daabad30` fix(windows): 补齐通用设备告警与优先读数 — run `git show` on any of them.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:270— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:270-292 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:326-348 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:294— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:294-316 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:350-372 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:580— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:580-602 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:458-480 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:672— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:672-694 | Sources/MenuBarMijiaApp/DeviceCardView.swift:691-713 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:672` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:792— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:792-814 | Sources/MenuBarMijiaApp/DeviceCardView.swift:759-781 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:792` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1285— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1285-1307 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1252-1274 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1285` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:263— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:263-285 | Sources/MenuBarMijiaApp/SensorCardView.swift:296-318 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:263` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1403— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1403-1425 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1370-1392 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1403` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:443— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:443-456 | Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:577-590 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:443` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:441` calls `init`, `opacity` and `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:575` 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 (14 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:565— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:565-578 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:443-456 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) Sources/MijiaCore/AssistantSchedule.swift:143— Sources/MijiaCore/AssistantSchedule.swift:143-156 | Sources/MijiaCore/LocalIntentParser.swift:659-672 — 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 `Sources/MijiaCore/AssistantSchedule.swift:143` 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 (14 lines × 2) Sources/MijiaCore/HomeStore+ControlWrite.swift:124— Sources/MijiaCore/HomeStore+ControlWrite.swift:124-137 | Sources/MijiaCore/HomeStore.swift:800-813 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1041— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1041-1054 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1008-1021 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:24— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:24-37 | Sources/MenuBarMijiaApp/SensorCardView.swift:24-37 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:462— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:462-475 | Sources/MenuBarMijiaApp/DeviceCardView.swift:521-534 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:548— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:548-561 | Sources/MenuBarMijiaApp/SensorCardView.swift:581-594 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:669— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:669-681 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:625-637 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:321— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:321-333 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:377-389 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:34— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:34-46 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1447-1459 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:34` 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) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:52— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:52-64 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1465-1477 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:52` 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) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:195— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:195-207 | Sources/MenuBarMijiaApp/DeviceLayout.swift:448-460 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift` and `Sources/MenuBarMijiaApp/DeviceLayout.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:195` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:206— Sources/MenuBarMijiaApp/ThemeAndMotion.swift:206-218 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:223-235 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/ThemeAndMotion.swift:206` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:427— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:427-439 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:307-319 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:427` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:21— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:21-33 | Sources/MenuBarMijiaApp/DeviceCardView.swift:21-33 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Sync-over-async blocking Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:921— `downloadGo2RTCBinary` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking windows/scripts/verify-flyout-layout.mjs:483— `fs.rmSync` in `terminateChrome` 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 windows/scripts/verify-flyout-layout.mjs:499— `fs.mkdtempSync` in `runLaunchChromeStartupSelfTest` 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 windows/scripts/verify-flyout-layout.mjs:574— `fs.rmSync` in `runLaunchChromeStartupSelfTest` 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 windows/scripts/verify-flyout-layout.mjs:598— `fs.mkdtempSync` in `main` 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 windows/scripts/verify-flyout-layout.mjs:605— `fs.mkdirSync` in `main` 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 windows/scripts/verify-flyout-layout.mjs:657— `fs.writeFileSync` in `main` 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 windows/scripts/verify-flyout-layout.mjs:661— `fs.writeFileSync` in `main` 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.
Duplicated block (14 lines × 2 locations) REDACTED:27— REDACTED:27 · windows/src/core/miAccountsStore.ts:58 — the 2 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.
Duplicated block (14 lines × 2 locations) windows/src/core/energyHistory.ts:209— windows/src/core/energyHistory.ts:209 · windows/src/core/energyHistory.ts:225 — 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 (14 lines × 2 locations) windows/src/core/miCloud/speakerActions.ts:56— windows/src/core/miCloud/speakerActions.ts:56 · windows/src/core/miCloud/speakerActions.ts:104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) windows/src/core/models.ts:518— windows/src/core/models.ts:518 · windows/src/ui/automationSettingsView.ts:396 — 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 (14 lines × 2 locations) REDACTED:36— REDACTED:36 · windows/src/ui/undoTracker.ts:32 — 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.
Duplicated block (14 lines × 2 locations) REDACTED:274— REDACTED:274 · REDACTED:803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) windows/src/ui/intentExecution.ts:621— windows/src/ui/intentExecution.ts:621 · windows/src/ui/intentExecution.ts:644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) REDACTED:581— REDACTED:581 · REDACTED:597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
menubarmijia_windows::camera::drain_complete_jpeg_frames (cyclomatic 29) windows/src-tauri/src/camera.rs:1254— menubarmijia_windows::camera::drain_complete_jpeg_frames 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.
menubarmijia_windows::camera::is_likely_concealed_gray_jpeg (cyclomatic 28) windows/src-tauri/src/camera.rs:1391— menubarmijia_windows::camera::is_likely_concealed_gray_jpeg 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.
menubarmijia_windows::main (cyclomatic 20) windows/src-tauri/src/main.rs:216— menubarmijia_windows::main 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.
menubarmijia_windows::network::native_http (cyclomatic 20) windows/src-tauri/src/network.rs:136— menubarmijia_windows::network::native_http 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.
menubarmijia_windows::camera::spawn_cs2_udp_relay (cyclomatic 18) windows/src-tauri/src/camera.rs:1983— menubarmijia_windows::camera::spawn_cs2_udp_relay 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.
menubarmijia_windows::companion::handle_ipc_client (cyclomatic 18) windows/src-tauri/src/companion.rs:508— menubarmijia_windows::companion::handle_ipc_client 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.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×6
Edited copy of a member (13 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:282— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:282-294 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:292-304 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:216— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:216-228 | Sources/MenuBarMijiaApp/DeviceLayout.swift:469-481 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Sources/MijiaCore/LocalIntentParser.swift:209— Sources/MijiaCore/LocalIntentParser.swift:209-226 | Sources/MijiaCore/LocalIntentParser.swift:228-240 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Sources/MijiaCore/AutomationRule.swift:266— Sources/MijiaCore/AutomationRule.swift:266-280 | Sources/MijiaCore/AutomationRule.swift:519-531 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Sources/MijiaCore/PanelSearch.swift:21— Sources/MijiaCore/PanelSearch.swift:21-37 | Sources/MijiaCore/UserHabitMemory.swift:13-25 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Sources/MijiaCore/MiCloud/MiAccountLogin.swift:28— Sources/MijiaCore/MiCloud/MiAccountLogin.swift:28-42 | Sources/MijiaCore/ManualControlPolicy.swift:12-24 — 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 (8 corresponding lines) · ×6
Edited copy of a member (8 corresponding lines) Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:258— Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:258-265 | Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:267-276 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Sources/MijiaCore/HomeStore+ControlWrite.swift:723— Sources/MijiaCore/HomeStore+ControlWrite.swift:723-730 | Sources/MijiaCore/HomeStore+ControlWrite.swift:732-740 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Sources/MijiaCore/RaycastSnapshot.swift:708— Sources/MijiaCore/RaycastSnapshot.swift:708-715 | Sources/MijiaCore/RaycastSnapshot.swift:717-724 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:756— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:756-764 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:643-650 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:200— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:200-207 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:510-517 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:744— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:744-751 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:631-638 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (22 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:77— Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:77-98 | Sources/MenuBarMijiaApp/PanelDesign.swift:303-324 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift` and `Sources/MenuBarMijiaApp/PanelDesign.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:77` 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 (22 lines × 2) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:412— Sources/MenuBarMijiaApp/OnboardingGuideView.swift:412-433 | Sources/MenuBarMijiaApp/SettingsWindowView.swift:584-605 — 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 `Sources/MenuBarMijiaApp/OnboardingGuideView.swift:412` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:262— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:262-283 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:633-654 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1233— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1233-1254 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:760-781 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:688— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:688-709 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:644-665 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:688` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:594— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:594-615 | Sources/MenuBarMijiaApp/SensorCardView.swift:627-648 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:50— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:50-67 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:50-67 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.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.
Duplicated block (18 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:335— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:335-352 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:391-408 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:335` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:300— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:300-317 | Sources/MenuBarMijiaApp/SensorCardView.swift:333-350 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:300` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:565— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:565-582 | Sources/MenuBarMijiaApp/SensorCardView.swift:598-615 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) Sources/MijiaCore/LocalIntentParser.swift:381— Sources/MijiaCore/LocalIntentParser.swift:381-398 | Sources/MijiaCore/LocalIntentParser.swift:1005-1022 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/LocalIntentParser.swift:381` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MijiaCore/LocalIntentParser.swift:1004` calls `Dictionary` and `Sources/MijiaCore/LocalIntentParser.swift:379` 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 (18 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:164— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:164-181 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:174-191 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
R4 · Test Coverage· No test reaches this file · ×6
No test reaches this file raycast/src/search-devices.tsx: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 raycast/src/snapshot.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 raycast/src/search-scenes.tsx: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 raycast/src/url.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 raycast/src/ask.tsx: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 windows/scripts/test-file.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.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×5
Edited copy of a member (15 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:657— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:657-671 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:535-549 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:550— Sources/MenuBarMijiaApp/ThemeAndMotion.swift:550-564 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:568-582 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicStackedCardGeometry.swift:34— Sources/MenuBarMijiaApp/Classic/ClassicStackedCardGeometry.swift:34-48 | Sources/MenuBarMijiaApp/StackedCardGeometry.swift:48-64 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) windows/src-tauri/src/desktop_shell.rs:245— windows/src-tauri/src/desktop_shell.rs:245-260 | windows/src-tauri/src/update.rs:520-534 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Sources/MijiaCore/Models.swift:25— Sources/MijiaCore/Models.swift:25-39 | Sources/MijiaCore/RaycastSnapshot.swift:245-263 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×5
Edited copy of a member (14 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:684— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:684-697 | Sources/MenuBarMijiaApp/SensorCardView.swift:717-732 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:8— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:8-21 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:8-21 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1233— Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1233-1246 | Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1248-1262 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Sources/MijiaCore/AssistantConfig.swift:481— Sources/MijiaCore/AssistantConfig.swift:481-494 | Sources/MijiaCore/AssistantConfig.swift:497-513 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Sources/MijiaCore/HomeStore+ControlWrite.swift:270— Sources/MijiaCore/HomeStore+ControlWrite.swift:270-283 | Sources/MijiaCore/HomeStore+ControlWrite.swift:286-300 — 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 (9 corresponding lines) · ×5
Edited copy of a member (9 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:741— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:741-749 | Sources/MenuBarMijiaApp/SensorCardView.swift:763-773 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) windows/src-tauri/src/companion.rs:719— windows/src-tauri/src/companion.rs:719-727 | windows/src-tauri/src/desktop_shell.rs:45-53 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Sources/MijiaCore/AppLocalization.swift:378— Sources/MijiaCore/AppLocalization.swift:378-386 | Sources/MijiaCore/AppLocalization.swift:388-396 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Sources/MijiaCore/DualSourceHomeProvider.swift:327— Sources/MijiaCore/DualSourceHomeProvider.swift:327-335 | Sources/MijiaCore/DualSourceHomeProvider.swift:337-346 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Sources/MijiaCore/HomeStore+ControlWrite.swift:614— Sources/MijiaCore/HomeStore+ControlWrite.swift:614-622 | Sources/MijiaCore/HomeStore+ControlWrite.swift:624-633 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×5
Edited copy of a member (7 corresponding lines) windows/src-tauri/src/network.rs:438— windows/src-tauri/src/network.rs:438-446 | windows/src-tauri/src/window.rs:435-441 — 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) Sources/MijiaCore/UpdateManifest.swift:90— Sources/MijiaCore/UpdateManifest.swift:90-96 | scripts/sign_update.swift:92-98 — 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) Sources/MijiaCore/AutomationRule.swift:357— Sources/MijiaCore/AutomationRule.swift:357-363 | Sources/MijiaCore/AutomationRule.swift:586-593 — 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) Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:376— Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:376-382 | Sources/MijiaCore/FragmentedMP4Demuxer.swift:544-552 — 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) Sources/MijiaCore/HomeProvider.swift:250— Sources/MijiaCore/HomeProvider.swift:250-257 | Sources/MijiaCore/LGWebOSClient.swift:479-485 — 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.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×5
Edited copy of a member (3 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:61— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:61-63 | Sources/MenuBarMijiaApp/DeviceCardView.swift:59-61 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Sources/MijiaCore/LGCertificateTrust.swift:125— Sources/MijiaCore/LGCertificateTrust.swift:125-127 | Sources/MijiaCore/UpdateChecker.swift:61-64 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:39— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:39-41 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:49-51 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:57— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:57-59 | Sources/MenuBarMijiaApp/DeviceCardView.swift:55-57 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:66— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:66-68 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:245-247 — 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 (17 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:878— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:878-894 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:510-526 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:878` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:145— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:145-161 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:155-171 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:479— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:479-495 | Sources/MenuBarMijiaApp/DeviceCardView.swift:538-554 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:479` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:907— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:907-923 | Sources/MenuBarMijiaApp/DeviceCardView.swift:874-890 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:907` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:236— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:236-252 | Sources/MenuBarMijiaApp/SensorCardView.swift:269-285 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:188— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:188-203 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:198-213 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:120— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:120-135 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:130-145 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:201— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:201-216 | Sources/MenuBarMijiaApp/SensorCardView.swift:234-249 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:184— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:184-199 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:194-209 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:86— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:86-101 | Sources/MenuBarMijiaApp/SensorCardView.swift:99-114 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Swallowed exception (caught, then discarded) REDACTED:1020— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) windows/src/ui/onboardingGuide.ts:75— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) windows/src/ui/settings.ts:278— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) windows/src/ui/settings.ts:290— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
Swallowed exception (caught, then discarded) windows/src/ui/speechGuard.ts:879— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×4
Edited copy of a member (20 corresponding lines) Sources/MenuBarMijiaApp/ClimatePanelModule.swift:158— Sources/MenuBarMijiaApp/ClimatePanelModule.swift:158-177 | Sources/MenuBarMijiaApp/SmallDeviceTile.swift:20-39 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:261— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:261-280 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:271-290 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:134— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:134-153 | Sources/MenuBarMijiaApp/DeviceCardView.swift:156-184 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Sources/MijiaCore/HomeStore+Controls.swift:1309— Sources/MijiaCore/HomeStore+Controls.swift:1309-1331 | Sources/MijiaCore/HomeStore+Controls.swift:1333-1352 — 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 (18 corresponding lines) · ×4
Edited copy of a member (18 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:205— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:205-222 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:215-232 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:911— Sources/MenuBarMijiaApp/OnboardingGuideView.swift:911-928 | Sources/MenuBarMijiaApp/OnboardingGuideView.swift:930-960 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:86— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:86-110 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:99-116 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Sources/MijiaCore/HomeProvider.swift:307— Sources/MijiaCore/HomeProvider.swift:307-324 | Sources/MijiaCore/HomeProvider.swift:373-390 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×4
Edited copy of a member (11 corresponding lines) Sources/MijiaCore/RaycastControls.swift:631— Sources/MijiaCore/RaycastControls.swift:631-641 | Sources/MijiaCore/RaycastControls.swift:643-654 — 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) Sources/MenuBarMijiaApp/MacContextObserver.swift:165— Sources/MenuBarMijiaApp/MacContextObserver.swift:165-175 | Sources/MenuBarMijiaApp/MacContextObserver.swift:233-243 — 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) scripts/check_swift_harness_lints.py:363— scripts/check_swift_harness_lints.py:363-373 | scripts/check_swift_harness_lints.py:377-387 — 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) scripts/probe_lan_gateway.py:359— scripts/probe_lan_gateway.py:359-369 | scripts/probe_lan_gateway.py:373-383 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×4
Edited copy of a member (10 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:686— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:686-695 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:562-571 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Sources/MijiaCore/AssistantConfig.swift:337— Sources/MijiaCore/AssistantConfig.swift:337-346 | Sources/MijiaCore/AssistantConfig.swift:348-363 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:673— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:673-684 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:551-560 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:253— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:253-265 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:314-323 — 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.
Duplicated block (29 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:508— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:508-536 | Sources/MenuBarMijiaApp/DeviceCardView.swift:589-617 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:508` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1126— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1126-1154 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1093-1121 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1126` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:228— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:228-256 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:238-266 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:228` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:876— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:876-904 | Sources/MenuBarMijiaApp/DeviceCardView.swift:843-871 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:876` 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 (28 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:396— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:396-423 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:276-303 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:396` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (28 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:151— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:151-178 | Sources/MenuBarMijiaApp/SensorCardView.swift:184-211 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:151` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:712— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:712-739 | Sources/MenuBarMijiaApp/SensorCardView.swift:734-761 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:8— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:8-35 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:8-35 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:354— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:354-372 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:410-428 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:354` 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 (19 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:850— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:850-868 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:482-500 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:850` 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 (19 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:231— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:231-249 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:602-620 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:108— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:108-126 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:100-118 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2 locations) windows/src/core/assistant/intent.ts:1262— windows/src/core/assistant/intent.ts:1262 · windows/src/core/assistant/intent.ts:1566 — 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 (17 lines × 2 locations) REDACTED:843— REDACTED:843 · REDACTED:1107 — 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 (17 lines × 2 locations) windows/src/ui/deviceViews.ts:496— windows/src/ui/deviceViews.ts:496 · windows/src/ui/deviceViews.ts:564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2 locations) windows/src/ui/sensorHistoryView.ts:972— windows/src/ui/sensorHistoryView.ts:972 · windows/src/ui/sensorHistoryView.ts:991 — 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.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×3
Edited copy of a member (25 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:106— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:106-130 | Sources/MenuBarMijiaApp/DeviceCardView.swift:130-154 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:87— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:87-151 | Sources/MenuBarMijiaApp/DeviceLayout.swift:332-362 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Sources/MijiaCore/RaycastControls.swift:489— Sources/MijiaCore/RaycastControls.swift:489-513 | Sources/MijiaCore/RaycastControls.swift:517-542 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×3
Edited copy of a member (19 corresponding lines) Sources/MijiaCore/AssistantSchedule.swift:138— Sources/MijiaCore/AssistantSchedule.swift:138-156 | Sources/MijiaCore/LocalIntentParser.swift:654-672 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Sources/MijiaCore/ModelIntentResolver.swift:116— Sources/MijiaCore/ModelIntentResolver.swift:116-152 | Sources/MijiaCore/ModelIntentResolver.swift:157-175 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:189— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:189-207 | Sources/MenuBarMijiaApp/DeviceLayout.swift:442-460 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×3
Edited copy of a member (17 corresponding lines) Sources/MijiaCore/HomeStore+Controls.swift:518— Sources/MijiaCore/HomeStore+Controls.swift:518-539 | Sources/MijiaCore/HomeStore+Controls.swift:703-719 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelActivities.swift:5— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelActivities.swift:5-22 | Sources/MenuBarMijiaApp/ControlCenterPanelActivities.swift:72-88 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Sources/MijiaCore/SensorHistory.swift:37— Sources/MijiaCore/SensorHistory.swift:37-53 | Sources/MijiaCore/SensorHistory.swift:72-88 — 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 copies of one member (3 members, 9+ corresponding lines) · ×3
Edited copies of one member (3 members, 9+ corresponding lines) Sources/MenuBarMijiaApp/DeviceLayout.swift:159— Sources/MenuBarMijiaApp/DeviceLayout.swift:159-167 | Sources/MenuBarMijiaApp/DeviceLayout.swift:562-570 | Sources/MijiaCore/BareCategoryCommand.swift:59-69 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) Sources/MijiaCore/AutomationRule.swift:707— Sources/MijiaCore/AutomationRule.swift:707-716 | Sources/MijiaCore/CameraPTZClient.swift:246-254 | Sources/MijiaCore/UserHabitMemory.swift:142-150 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:731— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:731-740 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:588-596 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:619-628 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (11 lines × 3) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:363— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:363-373 | Sources/MenuBarMijiaApp/DeviceCardView.swift:427-437 | Sources/MenuBarMijiaApp/SmallDeviceTile.swift:145-155 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 3) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:426— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:426-436 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:523-533 | Sources/MenuBarMijiaApp/DeviceCardView.swift:604-614 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:426` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 3) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:107— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:107-117 | Sources/MenuBarMijiaApp/DeviceCardView.swift:131-141 | Sources/MenuBarMijiaApp/SmallDeviceTile.swift:112-122 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 4) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:831— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:831-837 | Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:861-866 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:463-469 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:493-498 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:831` 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 (6 lines × 4) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:466— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:466-471 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:510-515 | Sources/MenuBarMijiaApp/DeviceCardView.swift:525-530 | Sources/MenuBarMijiaApp/DeviceCardView.swift:591-596 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:466` 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 × 4) Sources/MijiaCore/ModelIntentResolver.swift:246— Sources/MijiaCore/ModelIntentResolver.swift:246-251 | Sources/MijiaCore/ModelIntentResolver.swift:273-278 | Sources/MijiaCore/ModelIntentResolver.swift:370-375 | Sources/MijiaCore/ModelIntentResolver.swift:408-413 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/ModelIntentResolver.swift:246` 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.
Low cohesion: HotkeyAndNotificationManager (LCOM4 4) Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:8— HotkeyAndNotificationManager's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MenuBarPanelController (LCOM4 4) Sources/MenuBarMijiaApp/MenuBarPanelController.swift:37— MenuBarPanelController's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MockHomeProvider (LCOM4 4) Sources/MijiaCore/DemoHomeProvider.swift:10— MockHomeProvider's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Duplicated block (23 lines × 2 locations) windows/src/core/miAccountsStore.ts:935— windows/src/core/miAccountsStore.ts:935 · REDACTED:60 — 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.
Duplicated block (23 lines × 2 locations) REDACTED:343— REDACTED:343 · REDACTED:951 — 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 (23 lines × 2 locations) windows/src/ui/onboardingGuide.ts:719— windows/src/ui/onboardingGuide.ts:719 · REDACTED:814 — the 2 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.
Duplicated block (15 lines × 2 locations) windows/src/core/miCloud/command.ts:313— windows/src/core/miCloud/command.ts:313 · windows/src/core/miCloud/command.ts:521 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (15 lines × 2 locations) windows/src/ui/commandDispatch.ts:109— windows/src/ui/commandDispatch.ts:109 · windows/src/ui/detailDrawers.ts:1008 — the 2 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.
Duplicated block (15 lines × 2 locations) windows/src/ui/deviceViews.ts:1359— windows/src/ui/deviceViews.ts:1359 · windows/src/ui/deviceViews.ts:1480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×2
Animation without a prefers-reduced-motion guard windows/src/ui/styles.css:3272— `.cc-all-off-pill.is-holding .cc-hold-fill` moves (`transition: transform 600ms var(--ease-linear)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard windows/src/ui/styles.css:5168— `#app[data-panel-theme="classic"] .cc-tab-indicator` moves (`transition: transform 220ms var(--spring-lens), width 220ms var(--spring-lens), opacity var(--dur-fast) var(--ease-standard)`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
MjpegStreamReader::spawn (cyclomatic 29) windows/src-tauri/src/camera.rs:1530— MjpegStreamReader::spawn 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.
MjpegStreamReader::next_frame_jpeg (cyclomatic 17) windows/src-tauri/src/camera.rs:1706— MjpegStreamReader::next_frame_jpeg 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.
MjpegStreamReader::spawn (cognitive 66) windows/src-tauri/src/camera.rs:1530— MjpegStreamReader::spawn has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (56 pts), loops 2 (5 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MjpegStreamReader::next_frame_jpeg (cognitive 51) windows/src-tauri/src/camera.rs:1706— MjpegStreamReader::next_frame_jpeg has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (49 pts), boolean chains 1, loops 1 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MiCloudClient.parseRooms::appendHomes (cognitive 45) windows/src/core/miCloud/client.ts:316— MiCloudClient.parseRooms::appendHomes has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (21 pts), ternaries 6 (16 pts), boolean chains 4, loops 2 (4 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.
MiCloudClient.parseRooms::appendHomes (cognitive 16) Sources/MijiaCore/MiCloud/MiCloudClient.swift:736— MiCloudClient.parseRooms::appendHomes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 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.
Change-coupling hub: ControlCenterPanel.swift → ClimatePanelModule.swift, DeviceCardView.swift, MenuBarMijiaApp.swift, HomeStore+Metrics.swift Sources/MenuBarMijiaApp/ControlCenterPanel.swift— `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` changes together with 4 other files — `Sources/MenuBarMijiaApp/ClimatePanelModule.swift`, `Sources/MenuBarMijiaApp/DeviceCardView.swift`, `Sources/MenuBarMijiaApp/MenuBarMijiaApp.swift`, `Sources/MijiaCore/HomeStore+Metrics.swift` — 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: HomeStore+Controls.swift → DemoHomeProvider.swift, DeviceDeduplicator.swift, HomeStore+Undo.swift, MiotCommandMapper.swift Sources/MijiaCore/HomeStore+Controls.swift— `Sources/MijiaCore/HomeStore+Controls.swift` changes together with 4 other files — `Sources/MijiaCore/DemoHomeProvider.swift`, `Sources/MijiaCore/DeviceDeduplicator.swift`, `Sources/MijiaCore/HomeStore+Undo.swift`, `Sources/MijiaCore/MiCloud/MiotCommandMapper.swift` — 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:263— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:263-289 | Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:300-321 | Sources/MenuBarMijiaApp/SensorCardView.swift:296-322 | Sources/MenuBarMijiaApp/SensorCardView.swift:333-354 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/MijiaCore/ModelIntentResolver.swift:242— Sources/MijiaCore/ModelIntentResolver.swift:242-267 | Sources/MijiaCore/ModelIntentResolver.swift:269-365 | Sources/MijiaCore/ModelIntentResolver.swift:367-403 | Sources/MijiaCore/ModelIntentResolver.swift:405-436 — 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 (26 corresponding lines) · ×2
Edited copy of a member (26 corresponding lines) windows/src-tauri/src/window.rs:500— windows/src-tauri/src/window.rs:500-525 | windows/src-tauri/src/window.rs:528-553 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:452— Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:452-477 | Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:479-504 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:85— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:85-124 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:79-118 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (40 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1126— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1126-1165 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1093-1132 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:42— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:42-77 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:42-77 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:50— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:50-85 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:50-86 — 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 copy of a member (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:20— Sources/MenuBarMijiaApp/Classic/ClassicGroupNamePrompt.swift:20-57 | Sources/MenuBarMijiaApp/DeviceLayout.swift:665-694 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:940— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:940-969 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:574-603 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:309— Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:309-336 | Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:338-364 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) Sources/MijiaCore/Models.swift:152— Sources/MijiaCore/Models.swift:152-182 | Sources/MijiaCore/Models.swift:990-1016 — 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 copies of one member (4 members, 17+ corresponding lines) · ×2
Edited copies of one member (4 members, 17+ corresponding lines) Sources/MijiaCore/HomeStore+Controls.swift:543— Sources/MijiaCore/HomeStore+Controls.swift:543-564 | Sources/MijiaCore/HomeStore+Controls.swift:646-662 | Sources/MijiaCore/HomeStore+Controls.swift:1143-1159 | Sources/MijiaCore/HomeStore+Controls.swift:1425-1441 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 17+ corresponding lines) Sources/MijiaCore/HomeStore+Controls.swift:595— Sources/MijiaCore/HomeStore+Controls.swift:595-613 | Sources/MijiaCore/HomeStore+Controls.swift:1125-1141 | Sources/MijiaCore/HomeStore+Controls.swift:1271-1288 | Sources/MijiaCore/HomeStore+Controls.swift:1407-1423 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:604— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:604-609 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:482-487 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) scripts/probe_lan_gateway.py:341— scripts/probe_lan_gateway.py:341-346 | scripts/probe_lan_gateway.py:350-355 — 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 (5 corresponding lines) · ×2
Edited copy of a member (5 corresponding lines) Sources/MijiaCore/AssistantConfig.swift:425— Sources/MijiaCore/AssistantConfig.swift:425-429 | Sources/MijiaCore/AssistantConfig.swift:432-439 — 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) Sources/MijiaCore/EnergyHistory.swift:30— Sources/MijiaCore/EnergyHistory.swift:30-34 | Sources/MijiaCore/WeeklyHealthReport.swift:98-103 — 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 (36 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1187— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1187-1222 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:714-749 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (36 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190-225 | Sources/MenuBarMijiaApp/DeviceCardView.swift:246-281 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:42— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:42-72 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:42-72 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810-840 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:442-472 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:159— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:159-185 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:228-254 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:90— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:90-116 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:100-126 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:904— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:904-928 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:536-560 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:904` 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 (25 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:104— Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:104-128 | Sources/MenuBarMijiaApp/DeviceLayout.swift:337-361 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift` and `Sources/MenuBarMijiaApp/DeviceLayout.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:129` calls `transition`, `scale`, `combined` and `Sources/MenuBarMijiaApp/DeviceLayout.swift:362` 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 (21 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:616— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:616-636 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:571-591 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:616` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:712— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:712-732 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:670-690 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:712` 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 × 3) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:412— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:412-424 | Sources/MenuBarMijiaApp/DeviceCardView.swift:470-482 | Sources/MenuBarMijiaApp/DeviceCardView.swift:574-586 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:412` 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 × 3) Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:188— Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:188-200 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:887-899 | Sources/MenuBarMijiaApp/DeviceCardView.swift:854-866 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:188` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10–11 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:780— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:780-790 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:687-696 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:780` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:631— Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:631-640 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:843-853 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8–9 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:326— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:326-334 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:691-698 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:326` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) windows/src-tauri/src/window.rs:589— windows/src-tauri/src/window.rs:589-597 | windows/src-tauri/src/window.rs:713-720 — both copies are in the same file, so extract the 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 `windows/src-tauri/src/window.rs:589` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 3) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:59— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:59-66 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:59-66 | Sources/MenuBarMijiaApp/RoomOrderEditor.swift:669-676 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:59` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 3) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1094— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1094-1101 | Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1108-1115 | Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1134-1141 — 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 `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:1094` 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–7 lines × 2) Sources/MenuBarMijiaApp/MiAccountSection.swift:232— Sources/MenuBarMijiaApp/MiAccountSection.swift:232-237 | Sources/MenuBarMijiaApp/MiAccountSection.swift:300-306 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/MiAccountSection.swift:232` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `6` in one and `3` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6–7 lines × 2) Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:123— Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:123-129 | Sources/MijiaCore/MiCloud/MiCloudProvider.swift:91-96 — 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 `Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:392— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:392-397 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:540-544 | Sources/MenuBarMijiaApp/DeviceCardView.swift:456-461 | Sources/MenuBarMijiaApp/DeviceCardView.swift:561-565 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 4) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1081— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1081-1085 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1093-1097 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1048-1052 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1060-1064 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1081` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) Sources/MenuBarMijiaApp/DeviceLayout.swift:163— Sources/MenuBarMijiaApp/DeviceLayout.swift:163-167 | Sources/MenuBarMijiaApp/DeviceLayout.swift:566-570 | Sources/MijiaCore/RaycastSnapshot.swift:741-745 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/DeviceLayout.swift:163` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:290— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:290-294 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:300-304 | Sources/MijiaCore/DeviceSynthesizer.swift:1707-1713 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
R10 · Code Duplication· Duplicated block with local edits (41 matched lines × 2 locations) · ×2
Duplicated block with local edits (41 matched lines × 2 locations) windows/src/core/miCloudCrypto.ts:114— windows/src/core/miCloudCrypto.ts:114 · windows/src/core/miCloudCrypto.ts:185 — the two spans are one implementation copied and then locally edited — 435 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 with local edits (41 matched lines × 2 locations) windows/src/core/optimisticLock.ts:364— windows/src/core/optimisticLock.ts:364 · windows/src/ui/intentExecution.ts:180 — the two spans are one implementation copied and then locally edited — 273 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 (16 lines × 2 locations) windows/src/core/haDomains.ts:1231— windows/src/core/haDomains.ts:1231 · windows/src/core/homeAssistant.ts:95 — 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 (16 lines × 2 locations) windows/src/core/optimisticLock.ts:834— windows/src/core/optimisticLock.ts:834 · windows/src/ui/commandDispatch.ts:719 — 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.
Duplicated block (13 lines × 2 locations) windows/src/core/haDomains.ts:320— windows/src/core/haDomains.ts:320 · windows/src/core/haDomains.ts:370 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (13 lines × 2 locations) windows/src/core/miCloud/speakerActions.ts:224— windows/src/core/miCloud/speakerActions.ts:224 · windows/src/core/miCloud/speakerActions.ts:240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark windows/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="app">, so there is no content here to wrap — render the <main> from the component mounted into it.
Low contrast colour pair in CSS (3.4:1) windows/src/ui/styles.css:5226— `#app[data-panel-theme="classic"] .cc-tile.is-active .cc-tile-orb` sets color: #ffffff on background-color: #ff453a — 3.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
DeviceSynthesizer.buildSmartDevice (cyclomatic 169) Sources/MijiaCore/DeviceSynthesizer.swift:871— DeviceSynthesizer.buildSmartDevice has cyclomatic complexity 169 (threshold 15). Of this number, 165 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.
PanelRenderPipeline.commitRender (cyclomatic 153) windows/src/ui/reconciler.ts:1294— PanelRenderPipeline.commitRender has cyclomatic complexity 153 (threshold 15). Of this number, 120 points are the body's own statements and 33 belong to 11 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.
automationSettingsView.bindAutomationSettingsEvents (cyclomatic 152) windows/src/ui/automationSettingsView.ts:1148— automationSettingsView.bindAutomationSettingsEvents has cyclomatic complexity 152 (threshold 15). Most of this is not in the body itself: 2 of the 152 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 1211, a function literal at line 1325, handleDraftInput, …). 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.
homeAssistant.buildKind (cyclomatic 139) windows/src/core/homeAssistant.ts:413— homeAssistant.buildKind has cyclomatic complexity 139 (threshold 15). Of this number, 90 points are the body's own statements and 49 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.
deviceViews.deviceSvgIcon (cyclomatic 138) windows/src/ui/deviceViews.ts:852— deviceViews.deviceSvgIcon has cyclomatic complexity 138 (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.
commandEffects.applyCommandToDevices (cyclomatic 137) windows/src/core/commandEffects.ts:23— commandEffects.applyCommandToDevices has cyclomatic complexity 137 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
controlFailure.classifyRawError (cyclomatic 133) windows/src/core/controlFailure.ts:136— controlFailure.classifyRawError has cyclomatic complexity 133 (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.
deviceViews.renderPrimaryDrawer (cyclomatic 128) windows/src/ui/deviceViews.ts:235— deviceViews.renderPrimaryDrawer has cyclomatic complexity 128 (threshold 15). Of this number, 117 points are the body's own statements and 11 belong to 11 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.
panelKeyboard.handlePanelKey (cyclomatic 124) windows/src/ui/panelKeyboard.ts:260— panelKeyboard.handlePanelKey has cyclomatic complexity 124 (threshold 15). Of this number, 123 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.
commandEffects.inverseCommands (cyclomatic 117) windows/src/core/commandEffects.ts:268— commandEffects.inverseCommands has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settingsEvents.bindSettingsEvents (cyclomatic 111) REDACTED:714— settingsEvents.bindSettingsEvents has cyclomatic complexity 111 (threshold 15). Most of this is not in the body itself: 14 of the 111 points are its own statements and the rest belongs to 27 function items inside it that branch (a function literal at line 1109, a function literal at line 1229, a function literal at line 1030, …). 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.
AutomationEngine.dispatchEvent (cyclomatic 108) windows/src/core/automationEngine.ts:1045— AutomationEngine.dispatchEvent has cyclomatic complexity 108 (threshold 15). Of this number, 101 points are the body's own statements and 7 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.
SmartDevice.statusSubtitle (cyclomatic 107) Sources/MijiaCore/SmartDevice+Presentation.swift:97— SmartDevice.statusSubtitle has cyclomatic complexity 107 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deviceViews.applianceOrGenericIcon (cyclomatic 105) windows/src/ui/deviceViews.ts:706— deviceViews.applianceOrGenericIcon has cyclomatic complexity 105 (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.
deviceViews.renderDeviceTile (cyclomatic 105) windows/src/ui/deviceViews.ts:1252— deviceViews.renderDeviceTile has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models.deviceStatusSummary (cyclomatic 100) windows/src/core/models.ts:1129— models.deviceStatusSummary has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
appUrlCommand.onOpenURL (cyclomatic 90) REDACTED:1064— appUrlCommand.onOpenURL has cyclomatic complexity 90 (threshold 15). Of this number, 89 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.
DeviceDeduplicator.capabilityScore (cyclomatic 87) Sources/MijiaCore/DeviceDeduplicator.swift:400— DeviceDeduplicator.capabilityScore 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.
MiIOCryptoAndPacket.swift.cleanMalformedFirmwareJSON (cyclomatic 82) Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:513— MiIOCryptoAndPacket.swift.cleanMalformedFirmwareJSON has cyclomatic complexity 82 (threshold 15). Of this number, 77 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.
CameraLiveController.resolveCloudCameraStream (cyclomatic 80) windows/src/ui/cameraLive.ts:924— CameraLiveController.resolveCloudCameraStream has cyclomatic complexity 80 (threshold 15). Of this number, 73 points are the body's own statements and 7 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.
DeviceDeduplicator.merge (cyclomatic 79) Sources/MijiaCore/DeviceDeduplicator.swift:43— DeviceDeduplicator.merge has cyclomatic complexity 79 (threshold 15). Of this number, 77 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.
HomeStore.togglePrimary (cyclomatic 78) Sources/MijiaCore/HomeStore+Controls.swift:60— HomeStore.togglePrimary has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cloudRefresh.refreshDevices (cyclomatic 77) REDACTED:84— cloudRefresh.refreshDevices has cyclomatic complexity 77 (threshold 15). Of this number, 73 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.
MiotCommandMapper.map (cyclomatic 74) Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:32— MiotCommandMapper.map 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.
HomeStore.handleProviderEvent (cyclomatic 73) Sources/MijiaCore/HomeStore+Backend.swift:225— HomeStore.handleProviderEvent has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SmartDevice.sfSymbolName (cyclomatic 73) Sources/MijiaCore/SmartDevice+Presentation.swift:9— SmartDevice.sfSymbolName has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UserHabitMemory.topSuggestions (cyclomatic 73) windows/src/core/assistant/habits.ts:608— UserHabitMemory.topSuggestions has cyclomatic complexity 73 (threshold 15). Of this number, 51 points are the body's own statements and 22 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.
layoutGestures.bindLayoutGestures (cyclomatic 73) windows/src/ui/layoutGestures.ts:63— layoutGestures.bindLayoutGestures has cyclomatic complexity 73 (threshold 15). Most of this is not in the body itself: 1 of the 73 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 174, a function literal at line 271, a function literal at line 137, …). 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.
homeAssistant.haServiceCall (cyclomatic 72) windows/src/core/homeAssistant.ts:1130— homeAssistant.haServiceCall has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
intent.parseChineseDeviceCommand (cyclomatic 71) windows/src/core/assistant/intent.ts:1154— intent.parseChineseDeviceCommand has cyclomatic complexity 71 (threshold 15). Of this number, 65 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.
cameraLiveModalView.renderCameraLiveModalView (cyclomatic 71) windows/src/ui/cameraLiveModalView.ts:36— cameraLiveModalView.renderCameraLiveModalView has cyclomatic complexity 71 (threshold 15). Of this number, 62 points are the body's own statements and 9 belong to 5 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.
verify-flyout-layout.evaluateSnapshot (cyclomatic 70) windows/scripts/verify-flyout-layout.mjs:42— verify-flyout-layout.evaluateSnapshot has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models.hasDetailDrawer (cyclomatic 70) windows/src/core/models.ts:632— models.hasDetailDrawer has cyclomatic complexity 70 (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.
detailDrawers.bindDetailDrawerEvents (cyclomatic 70) windows/src/ui/detailDrawers.ts:592— detailDrawers.bindDetailDrawerEvents has cyclomatic complexity 70 (threshold 15). Most of this is not in the body itself: 1 of the 70 points is its own statement and the rest belongs to 19 function items inside it that branch (a function literal at line 654, a function literal at line 773, a function literal at line 688, …). 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.
LocalIntentParser.parseEnglishCommand (cyclomatic 68) Sources/MijiaCore/LocalIntentParser.swift:784— LocalIntentParser.parseEnglishCommand has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
activityStackView.buildUpperCardFactories (cyclomatic 67) windows/src/ui/activityStackView.ts:1408— activityStackView.buildUpperCardFactories has cyclomatic complexity 67 (threshold 15). Of this number, 51 points are the body's own statements and 16 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.
SmartDevice.mergingOptimisticFields (cyclomatic 66) Sources/MijiaCore/OptimisticField.swift:190— SmartDevice.mergingOptimisticFields has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
automationSettingsView.renderAutomationAndSafetySettingsSections (cyclomatic 65) windows/src/ui/automationSettingsView.ts:813— automationSettingsView.renderAutomationAndSafetySettingsSections has cyclomatic complexity 65 (threshold 15). Of this number, 53 points are the body's own statements and 12 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.
promptContext.catalogStateSummary (cyclomatic 64) windows/src/core/assistant/promptContext.ts:89— promptContext.catalogStateSummary has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MacContextAutomation.events (cyclomatic 63) Sources/MijiaCore/MacContextAutomation.swift:92— MacContextAutomation.events has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OptimisticField.changedFields (cyclomatic 63) Sources/MijiaCore/OptimisticField.swift:108— OptimisticField.changedFields has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
appUrlCommand.executeDirectAskPreset (cyclomatic 63) REDACTED:824— appUrlCommand.executeDirectAskPreset has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (appUrlCommand.executeDirectAskPreset::runDirectCover) 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.
connectionsAndDiagView.renderConnectionsAndDiagSection (cyclomatic 63) windows/src/ui/connectionsAndDiagView.ts:1078— connectionsAndDiagView.renderConnectionsAndDiagSection has cyclomatic complexity 63 (threshold 15). Of this number, 48 points are the body's own statements and 15 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.
LocalIntentParser.parseDeviceCommand (cyclomatic 61) Sources/MijiaCore/LocalIntentParser.swift:244— LocalIntentParser.parseDeviceCommand has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DemoHomeProvider.applying (cyclomatic 60) Sources/MijiaCore/DemoHomeProvider.swift:486— DemoHomeProvider.applying has cyclomatic complexity 60 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
synthesis.applianceActivity (cyclomatic 60) windows/src/core/miCloud/synthesis.ts:383— synthesis.applianceActivity has cyclomatic complexity 60 (threshold 15). Of this number, 59 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
naturalCommand.handleNaturalCommand (cyclomatic 60) windows/src/ui/naturalCommand.ts:45— naturalCommand.handleNaturalCommand has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reconciler.extractControlIdentityKey (cyclomatic 59) windows/src/ui/reconciler.ts:128— reconciler.extractControlIdentityKey has cyclomatic complexity 59 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
commandDispatch.applyCommand (cyclomatic 58) windows/src/ui/commandDispatch.ts:839— commandDispatch.applyCommand has cyclomatic complexity 58 (threshold 15). Of this number, 56 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.
DeviceSynthesizer.synthesize (cyclomatic 57) Sources/MijiaCore/DeviceSynthesizer.swift:267— DeviceSynthesizer.synthesize 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.
UserHabitMemory.topSuggestions (cyclomatic 57) Sources/MijiaCore/UserHabitMemory.swift:704— UserHabitMemory.topSuggestions has cyclomatic complexity 57 (threshold 15). Of this number, 56 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.
onboardingGuide.mountOnboardingGuide (cyclomatic 57) windows/src/ui/onboardingGuide.ts:343— onboardingGuide.mountOnboardingGuide has cyclomatic complexity 57 (threshold 15). Of this number, 16 points are the body's own statements and 41 belong to 12 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.
AppURLParser.parseEnvelope (cyclomatic 56) Sources/MijiaCore/AppURLCommand.swift:131— AppURLParser.parseEnvelope 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.
MenuMijiaWindowsApp.performUndo (cyclomatic 56) windows/src/ui/app.ts:857— MenuMijiaWindowsApp.performUndo has cyclomatic complexity 56 (threshold 15). Of this number, 52 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.
energyHistory.sanitizeStored (cyclomatic 54) windows/src/core/energyHistory.ts:192— energyHistory.sanitizeStored 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.
settings.loadSettings (cyclomatic 54) windows/src/ui/settings.ts:59— settings.loadSettings has cyclomatic complexity 54 (threshold 15). Of this number, 50 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.
HAWebSocketProvider.mapCommandToService (cyclomatic 53) Sources/MijiaCore/HomeProvider.swift:817— HAWebSocketProvider.mapCommandToService has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reconciler.syncElementAttributesAndProps (cyclomatic 53) windows/src/ui/reconciler.ts:266— reconciler.syncElementAttributesAndProps has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SmartDevice.hasDetailDrawer (cyclomatic 51) Sources/MijiaCore/Models.swift:1476— SmartDevice.hasDetailDrawer has cyclomatic complexity 51 (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.
models.deviceAcceptsControlWrites (cyclomatic 51) windows/src/core/models.ts:549— models.deviceAcceptsControlWrites has cyclomatic complexity 51 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: models.localizeApplianceMode (cyclomatic 59) 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.
cameraHubs.resolveLiveCameraTarget (cyclomatic 51) windows/src/core/miCloud/cameraHubs.ts:390— cameraHubs.resolveLiveCameraTarget has cyclomatic complexity 51 (threshold 15). Of this number, 49 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.
intentExecution.executeIntents (cyclomatic 51) windows/src/ui/intentExecution.ts:390— intentExecution.executeIntents 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. This shape REPEATS in the file: one other method here (intentExecution.executeIntents::runTargetBatch) 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.
IntentValidator.normalize (cyclomatic 50) Sources/MijiaCore/CommandIntent.swift:345— IntentValidator.normalize 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.
ApplianceActivity.init (cyclomatic 50) Sources/MijiaCore/Models.swift:829— ApplianceActivity.init has cyclomatic complexity 50 (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.
cloudRefresh.refreshMultiAccountXiaomiDevices (cyclomatic 50) REDACTED:821— cloudRefresh.refreshMultiAccountXiaomiDevices 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.
cloudRefresh.refreshDualSourceDevices (cyclomatic 49) REDACTED:1079— cloudRefresh.refreshDualSourceDevices has cyclomatic complexity 49 (threshold 15). Of this number, 45 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.
haDomains.buildSingleHAFacet (cyclomatic 48) windows/src/core/haDomains.ts:1004— haDomains.buildSingleHAFacet has cyclomatic complexity 48 (threshold 15). Of this number, 47 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.
HomeStore.assistantEffect (cyclomatic 47) Sources/MijiaCore/HomeStore+Assistant.swift:1147— HomeStore.assistantEffect 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.
deviceViews.renderClimateStrip (cyclomatic 47) windows/src/ui/deviceViews.ts:120— deviceViews.renderClimateStrip has cyclomatic complexity 47 (threshold 15). Of this number, 42 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.
miAccountsStore.mergeMiAccountSnapshots (cyclomatic 46) windows/src/core/miAccountsStore.ts:778— miAccountsStore.mergeMiAccountSnapshots 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.
cloudRefresh.patchCloudPresentation (cyclomatic 46) REDACTED:589— cloudRefresh.patchCloudPresentation has cyclomatic complexity 46 (threshold 15). Of this number, 45 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.
PanelKeyRouter.afterSearch (cyclomatic 45) Sources/MenuBarMijiaApp/PanelKeyRouter.swift:86— PanelKeyRouter.afterSearch 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.
IntentCatalog.stateSummary (cyclomatic 45) Sources/MijiaCore/CommandIntent.swift:882— IntentCatalog.stateSummary 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.
panelView.renderPanel (cyclomatic 45) windows/src/ui/panelView.ts:19— panelView.renderPanel has cyclomatic complexity 45 (threshold 15). Of this number, 39 points are the body's own statements and 6 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.
reconciler.reconcileElementTree (cyclomatic 45) windows/src/ui/reconciler.ts:385— reconciler.reconcileElementTree has cyclomatic complexity 45 (threshold 15). Of this number, 39 points are the body's own statements and 6 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.
HomeStore.executeIntentPlan (cyclomatic 44) Sources/MijiaCore/HomeStore+Assistant.swift:886— HomeStore.executeIntentPlan 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.
ManualControlPolicy.facetRequiresConfirmation (cyclomatic 44) Sources/MijiaCore/ManualControlPolicy.swift:176— ManualControlPolicy.facetRequiresConfirmation has cyclomatic complexity 44 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
demo.demoSensorHistorySamples (cyclomatic 44) windows/src/ui/demo.ts:26— demo.demoSensorHistorySamples 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.
MenuBarPanelController.handleMouseDown (cyclomatic 43) Sources/MenuBarMijiaApp/MenuBarPanelController.swift:1361— MenuBarPanelController.handleMouseDown 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.
HomeStore.executeQuickAction (cyclomatic 43) Sources/MijiaCore/HomeStore+Undo.swift:115— HomeStore.executeQuickAction 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.
HAHomeSnapshot.receive (cyclomatic 43) windows/src/core/homeAssistant.ts:1328— HAHomeSnapshot.receive 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.
PanelSearch.action (cyclomatic 42) Sources/MijiaCore/PanelSearch.swift:355— PanelSearch.action 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.
MiCloudProvider.resolveCameraStream (cyclomatic 42) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1132— MiCloudProvider.resolveCameraStream 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.
command.coercePropValue (cyclomatic 42) windows/src/core/miCloud/command.ts:25— command.coercePropValue 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.
DoorbellDetector.ingestHASnapshot (cyclomatic 42) windows/src/core/automationEngine.ts:1400— DoorbellDetector.ingestHASnapshot has cyclomatic complexity 42 (threshold 15). Of this number, 38 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.
automationEngine.parseStoredRule (cyclomatic 42) windows/src/core/automationEngine.ts:417— automationEngine.parseStoredRule has cyclomatic complexity 42 (threshold 15). Of this number, 40 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.
URLCommandHandler.execute (cyclomatic 41) Sources/MenuBarMijiaApp/URLCommandHandler.swift:292— URLCommandHandler.execute 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.
IntentDeviceCategory.init (cyclomatic 41) Sources/MijiaCore/CommandIntent.swift:261— IntentDeviceCategory.init has cyclomatic complexity 41 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
DeviceKind.acceptsControlWrites (cyclomatic 41) Sources/MijiaCore/Models.swift:1268— DeviceKind.acceptsControlWrites has cyclomatic complexity 41 (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.
SafetyMonitor.evaluate (cyclomatic 41) REDACTED:536— SafetyMonitor.evaluate 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.
HomeAssistantSynthesizer.synthesize (cyclomatic 41) windows/src/core/homeAssistant.ts:857— HomeAssistantSynthesizer.synthesize has cyclomatic complexity 41 (threshold 15). Of this number, 23 points are the body's own statements and 18 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.
habits.habitActionable (cyclomatic 40) windows/src/core/assistant/habits.ts:227— habits.habitActionable has cyclomatic complexity 40 (threshold 15). Of this number, 39 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.
sensorHistory.parseHomeAssistantHistoryResponse (cyclomatic 40) windows/src/core/sensorHistory.ts:1308— sensorHistory.parseHomeAssistantHistoryResponse has cyclomatic complexity 40 (threshold 15). Of this number, 38 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.
dualSourceProvider.extractHADeviceIdentities (cyclomatic 40) windows/src/core/dualSourceProvider.ts:149— dualSourceProvider.extractHADeviceIdentities 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.
UserHabitMemory.isActionable (cyclomatic 39) Sources/MijiaCore/UserHabitMemory.swift:949— UserHabitMemory.isActionable has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
optimisticLock.syncDirectCommandToFacets (cyclomatic 39) windows/src/core/optimisticLock.ts:910— optimisticLock.syncDirectCommandToFacets 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.
roomOrderEditor.bindRoomOrderEditorEvents (cyclomatic 39) windows/src/ui/roomOrderEditor.ts:458— roomOrderEditor.bindRoomOrderEditorEvents has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 519, 472, 597, …). 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.
panelView.renderNotificationStack (cyclomatic 39) windows/src/ui/panelView.ts:279— panelView.renderNotificationStack has cyclomatic complexity 39 (threshold 15). Of this number, 37 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.
FragmentedMP4Demuxer.parseFragment (cyclomatic 38) Sources/MijiaCore/FragmentedMP4Demuxer.swift:301— FragmentedMP4Demuxer.parseFragment has cyclomatic complexity 38 (threshold 15). Of this number, 37 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.
Context.coerce (cyclomatic 38) Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:374— Context.coerce 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.
haDomains.buildMediaPlayerKind (cyclomatic 38) windows/src/core/haDomains.ts:515— haDomains.buildMediaPlayerKind 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.
UnsupportedDeviceScanner.scan (cyclomatic 38) REDACTED:601— UnsupportedDeviceScanner.scan 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.
cloudRefresh.refreshHADevices (cyclomatic 38) REDACTED:369— cloudRefresh.refreshHADevices has cyclomatic complexity 38 (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.
haDomains.mapHAFacetCommand (cyclomatic 37) windows/src/core/haDomains.ts:1142— haDomains.mapHAFacetCommand has cyclomatic complexity 37 (threshold 15). Of this number, 29 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.
UserHabitMemory.record (cyclomatic 37) windows/src/core/assistant/habits.ts:308— UserHabitMemory.record has cyclomatic complexity 37 (threshold 15). Of this number, 29 points are the body's own statements and 8 belong 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.
ModelIntentResolver.decodeChatOp (cyclomatic 37) windows/src/core/assistant/modelIntentResolver.ts:498— ModelIntentResolver.decodeChatOp 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.
facets.facetControls (cyclomatic 36) windows/src/core/miCloud/facets.ts:484— facets.facetControls 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.
sensorHistoryView.renderSensorHistorySection (cyclomatic 36) windows/src/ui/sensorHistoryView.ts:699— sensorHistoryView.renderSensorHistorySection has cyclomatic complexity 36 (threshold 15). Of this number, 26 points are the body's own statements and 10 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.
activityStackView.bindUnifiedUpperStack (cyclomatic 36) windows/src/ui/activityStackView.ts:1603— activityStackView.bindUnifiedUpperStack has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 6 of the 36 points are its own statements and the rest belongs to 3 function items inside it that branch (finishPointer, a function literal at line 1627, a function literal at line 1616). 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.
HomeStore.init (cyclomatic 35) Sources/MijiaCore/HomeStore.swift:869— HomeStore.init 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.
HomeStore.commitManualWrite (cyclomatic 35) Sources/MijiaCore/HomeStore+ControlWrite.swift:868— HomeStore.commitManualWrite has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelIntentResolver.planFromSystemOne (cyclomatic 35) windows/src/core/assistant/modelIntentResolver.ts:205— ModelIntentResolver.planFromSystemOne has cyclomatic 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
commandDispatch.scheduleEchoReadBack.executeSingleDeviceReadBack (cyclomatic 35) windows/src/ui/commandDispatch.ts:577— commandDispatch.scheduleEchoReadBack.executeSingleDeviceReadBack has cyclomatic 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
connectionsAndDiagView.performSignOutSingleMiAccountOnHost (cyclomatic 35) windows/src/ui/connectionsAndDiagView.ts:478— connectionsAndDiagView.performSignOutSingleMiAccountOnHost has cyclomatic 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
intentExecution.executeSingleCommand (cyclomatic 35) windows/src/ui/intentExecution.ts:773— intentExecution.executeSingleCommand has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deviceViews.renderCollapsedInlineSlider (cyclomatic 35) windows/src/ui/deviceViews.ts:1092— deviceViews.renderCollapsedInlineSlider has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
menuViews.renderContextMenu (cyclomatic 35) windows/src/ui/menuViews.ts:88— menuViews.renderContextMenu has cyclomatic complexity 35 (threshold 15). Of this number, 33 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.
ClassicDeviceCardView.headerRow (cyclomatic 34) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:479— ClassicDeviceCardView.headerRow 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.
HAFacetEngine.control (cyclomatic 34) Sources/MijiaCore/HAFacets.swift:36— HAFacetEngine.control has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HomeStore.runAssistantCommand (cyclomatic 34) Sources/MijiaCore/HomeStore+Assistant.swift:357— HomeStore.runAssistantCommand 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.
safetyAndHealth.evaluateSafetyFacetValue (cyclomatic 34) REDACTED:260— safetyAndHealth.evaluateSafetyFacetValue 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.
dom.morphMatchingDom (cyclomatic 34) windows/src/ui/dom.ts:21— dom.morphMatchingDom 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.
HomeStore.rebuildLiveProvider (cyclomatic 33) Sources/MijiaCore/HomeStore+Backend.swift:666— HomeStore.rebuildLiveProvider 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.
verify-flyout-layout.main (cyclomatic 33) windows/scripts/verify-flyout-layout.mjs:578— verify-flyout-layout.main has cyclomatic complexity 33 (threshold 15). Of this number, 32 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.
safetyAndHealth.buildWeeklyHealthReport (cyclomatic 33) REDACTED:1141— safetyAndHealth.buildWeeklyHealthReport has cyclomatic complexity 33 (threshold 15). Of this number, 29 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.
safetyAndHealth.renderWeeklyHealthMarkdown (cyclomatic 33) REDACTED:1319— safetyAndHealth.renderWeeklyHealthMarkdown 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.
automationEngine.commandsForPowerIntent (cyclomatic 33) windows/src/core/automationEngine.ts:804— automationEngine.commandsForPowerIntent 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.
automationEngine.executeAutomationRule (cyclomatic 33) windows/src/core/automationEngine.ts:863— automationEngine.executeAutomationRule has cyclomatic complexity 33 (threshold 15). Of this number, 32 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.
EnergyHistory.record (cyclomatic 33) windows/src/core/energyHistory.ts:454— EnergyHistory.record 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.
activityStackView.executeAutomationCardUndo (cyclomatic 33) windows/src/ui/activityStackView.ts:772— activityStackView.executeAutomationCardUndo has cyclomatic complexity 33 (threshold 15). Of this number, 27 points are the body's own statements and 6 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.
UserHabitMemory.record (cyclomatic 32) Sources/MijiaCore/UserHabitMemory.swift:325— UserHabitMemory.record 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.
haDomains.auxiliaryEntitiesForCover (cyclomatic 32) windows/src/core/haDomains.ts:675— haDomains.auxiliaryEntitiesForCover has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 3 function items inside it that branch (matches, labelOf, isBatterySensor). 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.
optimisticLock.applyHAExtendedCommandEffect (cyclomatic 32) windows/src/core/optimisticLock.ts:1007— optimisticLock.applyHAExtendedCommandEffect 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.
sensorHistoryView.bindSensorHistoryEvents (cyclomatic 32) windows/src/ui/sensorHistoryView.ts:936— sensorHistoryView.bindSensorHistoryEvents has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 12 function literals inside it that branch (lines 956, 1002, 1030, …). 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.
DeviceCardView.headerRow (cyclomatic 31) Sources/MenuBarMijiaApp/DeviceCardView.swift:538— DeviceCardView.headerRow 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.
GrokBallAnimator.sample (cyclomatic 31) Sources/MenuBarMijiaApp/GrokBallView.swift:207— GrokBallAnimator.sample 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.
MiotSynthesizer.genericApplianceStatusText (cyclomatic 31) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1531— MiotSynthesizer.genericApplianceStatusText has cyclomatic complexity 31 (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.
habits.shareHabitSentence (cyclomatic 31) windows/src/core/assistant/habits.ts:792— habits.shareHabitSentence 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.
synthesis.genericApplianceStatusDescription (cyclomatic 31) windows/src/core/miCloud/synthesis.ts:523— synthesis.genericApplianceStatusDescription has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: synthesis.coverStatusWord (cyclomatic 52) 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.
commandDispatch.captureReversibleFacetBeforeWrite (cyclomatic 31) windows/src/ui/commandDispatch.ts:277— commandDispatch.captureReversibleFacetBeforeWrite has cyclomatic complexity 31 (threshold 15). Of this number, 29 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.
CameraLiveController.commitCameraStreamUrl (cyclomatic 31) windows/src/ui/cameraLive.ts:1220— CameraLiveController.commitCameraStreamUrl 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.
IntentReply.describe (cyclomatic 30) Sources/MijiaCore/CommandIntent.swift:470— IntentReply.describe 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.
HomeStore.undoTurnAllOff (cyclomatic 30) Sources/MijiaCore/HomeStore+Undo.swift:725— HomeStore.undoTurnAllOff 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.
optimisticLock.runTrackedDevicePresetCommands (cyclomatic 30) windows/src/core/optimisticLock.ts:442— optimisticLock.runTrackedDevicePresetCommands has cyclomatic complexity 30 (threshold 15). Of this number, 19 points are the body's own statements and 11 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.
MiAccountsStore.loadUnlocked (cyclomatic 30) windows/src/core/miAccountsStore.ts:385— MiAccountsStore.loadUnlocked 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.
appLifecycle.hydrateCredentials (cyclomatic 30) windows/src/ui/appLifecycle.ts:92— appLifecycle.hydrateCredentials 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.
MenuMijiaWindowsApp.bindOpenAnimation (cyclomatic 30) windows/src/ui/app.ts:1561— MenuMijiaWindowsApp.bindOpenAnimation has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 1678, a function literal at line 1708, normalizeEdge, …). 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.
activityStackView.buildActivityFeed (cyclomatic 30) windows/src/ui/activityStackView.ts:1106— activityStackView.buildActivityFeed 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.
ClassicDeviceCardView.compactHeaderRow (cyclomatic 29) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360— ClassicDeviceCardView.compactHeaderRow 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.
HAHomeSnapshot.receive (cyclomatic 29) Sources/MijiaCore/HAHomeSnapshot.swift:38— HAHomeSnapshot.receive 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.
WeeklyHealthReport.markdown (cyclomatic 29) Sources/MijiaCore/WeeklyHealthReport.swift:253— WeeklyHealthReport.markdown 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.
HabitShare.swift.shareHabitSentence (cyclomatic 29) Sources/MijiaCore/HabitShare.swift:37— HabitShare.swift.shareHabitSentence 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.
homeAssistant.haEnergyKwh (cyclomatic 29) windows/src/core/homeAssistant.ts:244— homeAssistant.haEnergyKwh 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.
sensorHistoryView.triggerRemoteHistoryFetchIfNeeded (cyclomatic 29) windows/src/ui/sensorHistoryView.ts:423— sensorHistoryView.triggerRemoteHistoryFetchIfNeeded has cyclomatic complexity 29 (threshold 15). Of this number, 23 points are the body's own statements and 6 belong 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.
deviceViews.renderSensorCard (cyclomatic 29) windows/src/ui/deviceViews.ts:21— deviceViews.renderSensorCard 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.
cameraHubs.resolveCameraHub (cyclomatic 28) windows/src/core/miCloud/cameraHubs.ts:117— cameraHubs.resolveCameraHub has cyclomatic complexity 28 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
optimisticLock.mergeHomeSnapshotRespectingLocks (cyclomatic 28) windows/src/core/optimisticLock.ts:659— optimisticLock.mergeHomeSnapshotRespectingLocks has cyclomatic complexity 28 (threshold 15). Of this number, 24 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.
panelView.renderSliderDeck (cyclomatic 28) windows/src/ui/panelView.ts:443— panelView.renderSliderDeck has cyclomatic complexity 28 (threshold 15). Of this number, 24 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.
ResumeRecoveryController.flush (cyclomatic 28) windows/src/ui/appLifecycle.ts:721— ResumeRecoveryController.flush 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.
MenuMijiaWindowsApp.renderDeviceGrid (cyclomatic 28) windows/src/ui/app.ts:1275— MenuMijiaWindowsApp.renderDeviceGrid has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 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.
ApplianceDetailDrawer.body (cyclomatic 27) Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:15— ApplianceDetailDrawer.body 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.
SpeechInputController.start (cyclomatic 27) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:150— SpeechInputController.start 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.
CameraLiveVideoPlayer.enqueue (cyclomatic 27) Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:261— CameraLiveVideoPlayer.enqueue 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.
HADiscovery.isAllowedLANDiscoveryHost (cyclomatic 27) Sources/MijiaCore/HADiscovery.swift:575— HADiscovery.isAllowedLANDiscoveryHost 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.
HomeStore.confirmUndoTargets (cyclomatic 27) Sources/MijiaCore/HomeStore+Undo.swift:889— HomeStore.confirmUndoTargets 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.
HomeStore.applyUndoCommands (cyclomatic 27) Sources/MijiaCore/HomeStore+Undo.swift:1036— HomeStore.applyUndoCommands 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.
HomeStore.executeRaycastPower (cyclomatic 27) Sources/MijiaCore/RaycastControls.swift:393— HomeStore.executeRaycastPower 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.
MiAccountsProvider.updateAccounts (cyclomatic 27) Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:216— MiAccountsProvider.updateAccounts 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.
MiCloudClient.parsePropValues (cyclomatic 27) windows/src/core/miCloud/client.ts:632— MiCloudClient.parsePropValues 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.
haDomains.buildSyntheticPrimaryHAFacets (cyclomatic 27) windows/src/core/haDomains.ts:802— haDomains.buildSyntheticPrimaryHAFacets 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.
quickActions.planQuickAction (cyclomatic 27) windows/src/core/quickActions.ts:134— quickActions.planQuickAction has cyclomatic complexity 27 (threshold 15). Of this number, 25 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.
raycastSnapshot.normalizeLightGroupOwners (cyclomatic 27) windows/src/core/raycastSnapshot.ts:468— raycastSnapshot.normalizeLightGroupOwners has cyclomatic complexity 27 (threshold 15). Of this number, 16 points are the body's own statements and 11 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.
sensorHistory.extractMiHistoryRawNumbers (cyclomatic 27) windows/src/core/sensorHistory.ts:1002— sensorHistory.extractMiHistoryRawNumbers 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.
dualSourceProvider.reconcilePairedHALightGroups (cyclomatic 27) windows/src/core/dualSourceProvider.ts:485— dualSourceProvider.reconcilePairedHALightGroups 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.
DeviceSynthesizer.auxiliaryEntities (cyclomatic 26) Sources/MijiaCore/DeviceSynthesizer.swift:701— DeviceSynthesizer.auxiliaryEntities has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to one function item inside it that branches (matches). 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.
HomeStore.executeRaycastDirectCommand (cyclomatic 26) Sources/MijiaCore/RaycastControls.swift:15— HomeStore.executeRaycastDirectCommand 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.
MiotFacetEngine.alertCondition (cyclomatic 26) Sources/MijiaCore/MiCloud/MiotFacets.swift:667— MiotFacetEngine.alertCondition has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
XiaomiCameraBridge.spawnCS2UDPRelay (cyclomatic 26) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1335— XiaomiCameraBridge.spawnCS2UDPRelay 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.
verify-flyout-layout.runLaunchChromeStartupSelfTest (cyclomatic 26) windows/scripts/verify-flyout-layout.mjs:496— verify-flyout-layout.runLaunchChromeStartupSelfTest 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.
haDomains.haBinarySensorKind (cyclomatic 26) windows/src/core/haDomains.ts:258— haDomains.haBinarySensorKind has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
haDomains.buildValveKind (cyclomatic 26) windows/src/core/haDomains.ts:439— haDomains.buildValveKind 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
percentScale.rawFromPercent (cyclomatic 26) windows/src/core/miCloud/percentScale.ts:55— percentScale.rawFromPercent 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.
speakerActions.coerceSilentExecutionArg (cyclomatic 26) windows/src/core/miCloud/speakerActions.ts:165— speakerActions.coerceSilentExecutionArg has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 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.
appUrlCommand.resolveTarget (cyclomatic 26) REDACTED:468— appUrlCommand.resolveTarget has cyclomatic complexity 26 (threshold 15). Of this number, 21 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.
facetViews.row (cyclomatic 26) windows/src/ui/facetViews.ts:223— facetViews.row has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 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.
detailDrawers.renderApplianceDrawer (cyclomatic 26) windows/src/ui/detailDrawers.ts:126— detailDrawers.renderApplianceDrawer has cyclomatic complexity 26 (threshold 15). Of this number, 23 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.
detailDrawers.bindCollapsedInlineSliders (cyclomatic 26) windows/src/ui/detailDrawers.ts:885— detailDrawers.bindCollapsedInlineSliders has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 925, 905, 927). 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.
settingsEvents.commitSettingsSave (cyclomatic 26) REDACTED:567— settingsEvents.commitSettingsSave 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.
activityStackView.doesUndoStepActivateHighRiskDevice (cyclomatic 26) windows/src/ui/activityStackView.ts:671— activityStackView.doesUndoStepActivateHighRiskDevice has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 6 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 682). 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.
activityStackView.dismissActivityById (cyclomatic 26) windows/src/ui/activityStackView.ts:1541— activityStackView.dismissActivityById 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.
AssistantResponseArea.body (cyclomatic 25) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:334— AssistantResponseArea.body 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.
CameraLivePanelController.present (cyclomatic 25) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:314— CameraLivePanelController.present 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.
LocalIntentParser.bareCategoryOutcome (cyclomatic 25) Sources/MijiaCore/LocalIntentParser.swift:411— LocalIntentParser.bareCategoryOutcome has cyclomatic complexity 25 (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.
ModelIntentResolver.planFromSystemOne (cyclomatic 25) Sources/MijiaCore/ModelIntentResolver.swift:686— ModelIntentResolver.planFromSystemOne 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. This is NOT this file's highest cyclomatic complexity: ModelIntentResolver.systemOneOperation (cyclomatic 27) 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.
MiotSynthesizer.interpretedLockStatus (cyclomatic 25) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1379— MiotSynthesizer.interpretedLockStatus 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.
models.airQualityFromRaw (cyclomatic 25) windows/src/core/models.ts:1057— models.airQualityFromRaw has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: models.localizeApplianceMode (cyclomatic 59) 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.
haDomains.haCoverSubtype (cyclomatic 25) windows/src/core/haDomains.ts:90— haDomains.haCoverSubtype has cyclomatic complexity 25 (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.
UserHabitMemory.unrecord (cyclomatic 25) windows/src/core/assistant/habits.ts:470— UserHabitMemory.unrecord has cyclomatic complexity 25 (threshold 15). Of this number, 20 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.
habits.mentionedHabitTargets (cyclomatic 25) windows/src/core/assistant/habits.ts:898— habits.mentionedHabitTargets has cyclomatic complexity 25 (threshold 15). Of this number, 18 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.
synthesis.interpretLockStatus (cyclomatic 25) windows/src/core/miCloud/synthesis.ts:656— synthesis.interpretLockStatus 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. This is NOT this file's highest cyclomatic complexity: synthesis.coverStatusWord (cyclomatic 52) 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.
sensorHistory.inferHAMetricFromMeta (cyclomatic 25) windows/src/core/sensorHistory.ts:1263— sensorHistory.inferHAMetricFromMeta 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.
appLifecycle.bindGlobalKeys::onKeyDown (cyclomatic 25) windows/src/ui/appLifecycle.ts:964— appLifecycle.bindGlobalKeys::onKeyDown 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.
PanelRenderPipeline.patchPopover (cyclomatic 25) windows/src/ui/reconciler.ts:1088— PanelRenderPipeline.patchPopover 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.
activityStackView.bindActivityStackAfterRender (cyclomatic 25) windows/src/ui/activityStackView.ts:1674— activityStackView.bindActivityStackAfterRender has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 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.
CameraLivePlayback.start (cyclomatic 24) Sources/MenuBarMijiaApp/CameraLivePlayback.swift:70— CameraLivePlayback.start 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.
DeviceCardView.compactHeaderRow (cyclomatic 24) Sources/MenuBarMijiaApp/DeviceCardView.swift:424— DeviceCardView.compactHeaderRow 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.
SensorCardView.chartPlot (cyclomatic 24) Sources/MenuBarMijiaApp/SensorCardView.swift:435— SensorCardView.chartPlot 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.
SystemActivityMonitor.apply (cyclomatic 24) Sources/MenuBarMijiaApp/SystemActivityMonitor.swift:121— SystemActivityMonitor.apply has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
URLCommandHandler.resolve (cyclomatic 24) Sources/MenuBarMijiaApp/URLCommandHandler.swift:154— URLCommandHandler.resolve has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClassicSensorCardView.chartPlot (cyclomatic 24) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:402— ClassicSensorCardView.chartPlot 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.
MiCloudProvider.fetchPropsHybrid (cyclomatic 24) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:613— MiCloudProvider.fetchPropsHybrid 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.
CdpSession.constructor (cyclomatic 24) windows/scripts/verify-flyout-layout.mjs:215— CdpSession.constructor 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 items inside it that branch (a function literal at line 238, failAll, a function literal at line 237). 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.
miotFacetText.facetValue (cyclomatic 24) windows/src/core/miotFacetText.ts:205— miotFacetText.facetValue has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: miotFacetText.genericSymbolName (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
haDomains.resolveHACameraMotionFallback (cyclomatic 24) windows/src/core/haDomains.ts:920— haDomains.resolveHACameraMotionFallback 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.
safetyAndHealth.extractSensorObservations (cyclomatic 24) REDACTED:303— safetyAndHealth.extractSensorObservations has cyclomatic complexity 24 (threshold 15). Of this number, 23 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.
sensorHistory.extractSensorLiveMetrics (cyclomatic 24) windows/src/core/sensorHistory.ts:431— sensorHistory.extractSensorLiveMetrics 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.
sensorHistory.resolveHomeAssistantSensorEntityIds (cyclomatic 24) windows/src/core/sensorHistory.ts:1371— sensorHistory.resolveHomeAssistantSensorEntityIds 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.
settingsViews.renderGeneralPanel (cyclomatic 24) windows/src/ui/settingsViews.ts:324— settingsViews.renderGeneralPanel has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 5 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.
bindEvents.toggleDeviceForHost (cyclomatic 24) windows/src/ui/bindEvents.ts:86— bindEvents.toggleDeviceForHost has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs 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.
SensorCardView.body (cyclomatic 23) Sources/MenuBarMijiaApp/SensorCardView.swift:51— SensorCardView.body 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.
LGWebOSClient.handleIncomingMessage (cyclomatic 23) Sources/MijiaCore/LGWebOSClient.swift:743— LGWebOSClient.handleIncomingMessage 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.
MiCloudClient.extractRawNumbers (cyclomatic 23) Sources/MijiaCore/MiCloud/MiCloudClient.swift:1110— MiCloudClient.extractRawNumbers 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.
MiCloudProvider.execute (cyclomatic 23) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:983— MiCloudProvider.execute has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
models.deviceEnvironmentReading (cyclomatic 23) windows/src/core/models.ts:893— models.deviceEnvironmentReading 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. This is NOT this file's highest cyclomatic complexity: models.localizeApplianceMode (cyclomatic 59) 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.
MiCloudClient.mergeRoomPage (cyclomatic 23) windows/src/core/miCloud/client.ts:503— MiCloudClient.mergeRoomPage has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 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.
intent.bareCategoryOutcome (cyclomatic 23) windows/src/core/assistant/intent.ts:912— intent.bareCategoryOutcome 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.
homeAssistant.cachedKind (cyclomatic 23) windows/src/core/homeAssistant.ts:302— homeAssistant.cachedKind 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.
homeAssistant.homeAssistantIdentity (cyclomatic 23) windows/src/core/homeAssistant.ts:338— homeAssistant.homeAssistantIdentity 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.
scheduledCommands.parseOperation (cyclomatic 23) windows/src/core/scheduledCommands.ts:45— scheduledCommands.parseOperation 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.
automationSettingsView.renderTriggerOptionsEditor (cyclomatic 23) windows/src/ui/automationSettingsView.ts:702— automationSettingsView.renderTriggerOptionsEditor has cyclomatic complexity 23 (threshold 15). Of this number, 14 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.
detailDrawers.updateLiveSliderReadout (cyclomatic 23) windows/src/ui/detailDrawers.ts:469— detailDrawers.updateLiveSliderReadout has cyclomatic complexity 23 (threshold 15). Of this number, 22 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.
settingsEvents.probeAssistantConnection (cyclomatic 23) REDACTED:258— settingsEvents.probeAssistantConnection 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.
activityStackView.tickSafetyHealthAndAutomation (cyclomatic 23) windows/src/ui/activityStackView.ts:1008— activityStackView.tickSafetyHealthAndAutomation has cyclomatic complexity 23 (threshold 15). Of this number, 19 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.
DeviceCardView.contextMenuItems (cyclomatic 22) Sources/MenuBarMijiaApp/DeviceCardView.swift:246— DeviceCardView.contextMenuItems 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.
DeviceCardView.fanDrawer (cyclomatic 22) Sources/MenuBarMijiaApp/DeviceCardView.swift:905— DeviceCardView.fanDrawer 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.
GrokBallRenderer.drawRibbons (cyclomatic 22) Sources/MenuBarMijiaApp/GrokBallRenderer.swift:92— GrokBallRenderer.drawRibbons 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.
ClassicDeviceCardView.fanDrawer (cyclomatic 22) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938— ClassicDeviceCardView.fanDrawer 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.
DeviceDeduplicator.reconcilePairedHALightGroups (cyclomatic 22) Sources/MijiaCore/DeviceDeduplicator.swift:525— DeviceDeduplicator.reconcilePairedHALightGroups 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.
EnergyHistory.record (cyclomatic 22) Sources/MijiaCore/EnergyHistory.swift:117— EnergyHistory.record 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.
HomeStore.buildQuickActionItems (cyclomatic 22) Sources/MijiaCore/RaycastSnapshot.swift:766— HomeStore.buildQuickActionItems 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.
UpdateManifest.parse (cyclomatic 22) Sources/MijiaCore/UpdateManifest.swift:110— UpdateManifest.parse 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.
MiCloudClient.parseRooms::appendHomes (cyclomatic 22) windows/src/core/miCloud/client.ts:316— MiCloudClient.parseRooms::appendHomes 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.
haDomains.cachedExtendedKind (cyclomatic 22) windows/src/core/haDomains.ts:1338— haDomains.cachedExtendedKind 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.
habits.decodeHabitOperation (cyclomatic 22) windows/src/core/assistant/habits.ts:207— habits.decodeHabitOperation 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.
automationEngine.readSensorMetricValue (cyclomatic 22) windows/src/core/automationEngine.ts:775— automationEngine.readSensorMetricValue 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.
homeAssistant.haPowerWatts (cyclomatic 22) windows/src/core/homeAssistant.ts:201— homeAssistant.haPowerWatts has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
speechGuard.bindCompanionAndUpdaterEvents (cyclomatic 22) windows/src/ui/speechGuard.ts:1258— speechGuard.bindCompanionAndUpdaterEvents has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1268, 1305, 1260). 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. This is NOT this file's highest cyclomatic complexity: speechGuard.toggleVoiceInput (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
sensorHistoryView.computePlotGeometry (cyclomatic 22) windows/src/ui/sensorHistoryView.ts:598— sensorHistoryView.computePlotGeometry 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
detailDrawers.coverActionTitle (cyclomatic 22) windows/src/ui/detailDrawers.ts:62— detailDrawers.coverActionTitle has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PanelSearchKeyboard.handle (cyclomatic 21) Sources/MenuBarMijiaApp/ControlCenterPanel.swift:826— PanelSearchKeyboard.handle 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.
GrokBallSidecarController.handlePointer (cyclomatic 21) Sources/MenuBarMijiaApp/GrokBallSidecarController.swift:266— GrokBallSidecarController.handlePointer 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.
StatusItemEventDecision.decide (cyclomatic 21) Sources/MenuBarMijiaApp/StatusItemEventDecision.swift:42— StatusItemEventDecision.decide 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.
ClassicDeviceCardView.contextMenuItems (cyclomatic 21) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190— ClassicDeviceCardView.contextMenuItems 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.
FragmentedMP4Demuxer.parseTrak (cyclomatic 21) Sources/MijiaCore/FragmentedMP4Demuxer.swift:150— FragmentedMP4Demuxer.parseTrak 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.
PanelHealthResolver.resolve (cyclomatic 21) Sources/MijiaCore/HomeStore+Backend.swift:1375— PanelHealthResolver.resolve 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.
HomeStore.revert (cyclomatic 21) Sources/MijiaCore/HomeStore+ControlWrite.swift:774— HomeStore.revert 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.
HomeStore.menuBarText (cyclomatic 21) Sources/MijiaCore/HomeStore+Metrics.swift:161— HomeStore.menuBarText 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.
HomeStore.turnAllOff (cyclomatic 21) Sources/MijiaCore/HomeStore+Undo.swift:423— HomeStore.turnAllOff 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.
HomeStore.executeCoverPosition (cyclomatic 21) Sources/MijiaCore/RaycastControls.swift:267— HomeStore.executeCoverPosition 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.
LGWebOSProtocol.friendlySourceName (cyclomatic 21) Sources/MijiaCore/LGWebOSClient.swift:240— LGWebOSProtocol.friendlySourceName 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.
CoverSubtype.init (cyclomatic 21) Sources/MijiaCore/Models.swift:580— CoverSubtype.init 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.
SmartDevice.environmentReading (cyclomatic 21) Sources/MijiaCore/Models.swift:1523— SmartDevice.environmentReading 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.
SensorHistory.mergeCloudSamples (cyclomatic 21) Sources/MijiaCore/SensorHistory.swift:405— SensorHistory.mergeCloudSamples 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.
MiCloudClient.parseDeviceRecord (cyclomatic 21) windows/src/core/miCloud/client.ts:269— MiCloudClient.parseDeviceRecord 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.
haDomains.buildCoverKind (cyclomatic 21) windows/src/core/haDomains.ts:208— haDomains.buildCoverKind 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.
haDomains.buildHumidifierKind (cyclomatic 21) windows/src/core/haDomains.ts:320— haDomains.buildHumidifierKind 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CredentialVault.deleteMiSession (cyclomatic 21) windows/src/core/secureStore.ts:470— CredentialVault.deleteMiSession has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 471). 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.
miAccountsStore.refreshMiAccountsConcurrently::refreshOne (cyclomatic 21) windows/src/core/miAccountsStore.ts:1098— miAccountsStore.refreshMiAccountsConcurrently::refreshOne 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.
energySettingsView.renderEnergySettingsSection (cyclomatic 21) windows/src/ui/energySettingsView.ts:425— energySettingsView.renderEnergySettingsSection 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.
proactive.maybeRefreshProactiveInBackground (cyclomatic 21) windows/src/ui/proactive.ts:202— proactive.maybeRefreshProactiveInBackground has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 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.
CameraLiveController.bindEvents (cyclomatic 21) windows/src/ui/cameraLive.ts:1268— CameraLiveController.bindEvents has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 1312, 1270, 1290, …). 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.
deviceViews.renderSmallDeviceTile (cyclomatic 21) windows/src/ui/deviceViews.ts:1200— deviceViews.renderSmallDeviceTile 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.
bindEvents.bindDeckEvents (cyclomatic 21) windows/src/ui/bindEvents.ts:1452— bindEvents.bindDeckEvents has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1517, 1478, 1494, …). 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.
activityStackView.pruneOrphanedDeviceActivities (cyclomatic 21) windows/src/ui/activityStackView.ts:325— activityStackView.pruneOrphanedDeviceActivities 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.
ControlCenterPanel.deviceCollectionView (cyclomatic 20) Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:675— ControlCenterPanel.deviceCollectionView 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.
MenuBarPanelController.showPanel (cyclomatic 20) Sources/MenuBarMijiaApp/MenuBarPanelController+Presentation.swift:32— MenuBarPanelController.showPanel 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.
HomeStore.confirmToggleReadBack (cyclomatic 20) Sources/MijiaCore/HomeStore+Controls.swift:339— HomeStore.confirmToggleReadBack 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.
LocalIntentParser.parse (cyclomatic 20) Sources/MijiaCore/LocalIntentParser.swift:126— LocalIntentParser.parse has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LocalIntentParser.extractEnglishNumericOperations (cyclomatic 20) Sources/MijiaCore/LocalIntentParser.swift:1037— LocalIntentParser.extractEnglishNumericOperations 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.
ModelActionPolicy.decide (cyclomatic 20) Sources/MijiaCore/ModelActionPolicy.swift:124— ModelActionPolicy.decide 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.
UserHabitMemory.unrecord (cyclomatic 20) Sources/MijiaCore/UserHabitMemory.swift:510— UserHabitMemory.unrecord 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.
deviceCategory.deviceCategory (cyclomatic 20) windows/src/core/assistant/deviceCategory.ts:246— deviceCategory.deviceCategory 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.
haDomains.haLightCapabilityFlags (cyclomatic 20) windows/src/core/haDomains.ts:152— haDomains.haLightCapabilityFlags 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.
MiAccountLogin.parseServiceTokenCookie (cyclomatic 20) windows/src/core/miCloud/accountLogin.ts:132— MiAccountLogin.parseServiceTokenCookie 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.
OfflineHistory.load (cyclomatic 20) REDACTED:954— OfflineHistory.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.
appUrlCommand.findUniqueAskDevice (cyclomatic 20) REDACTED:750— appUrlCommand.findUniqueAskDevice has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 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.
appUrlCommand.executeDirectAskPreset::runDirectCover (cyclomatic 20) REDACTED:886— appUrlCommand.executeDirectAskPreset::runDirectCover has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (appUrlCommand.executeDirectAskPreset) 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.
sensorHistory.classifyFacetMetric (cyclomatic 20) windows/src/core/sensorHistory.ts:406— sensorHistory.classifyFacetMetric 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.
sensorHistory.resolveMiotSensorPropertyKeys (cyclomatic 20) windows/src/core/sensorHistory.ts:951— sensorHistory.resolveMiotSensorPropertyKeys 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.
DiagnosticsLog.loadFromStorage (cyclomatic 20) REDACTED:840— DiagnosticsLog.loadFromStorage 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.
EnergyHistory.deviceTotals (cyclomatic 20) windows/src/core/energyHistory.ts:667— EnergyHistory.deviceTotals 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.
automationSettingsView.triggerIconSvg (cyclomatic 20) windows/src/ui/automationSettingsView.ts:520— automationSettingsView.triggerIconSvg 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.
automationSettingsView.summarizeRuleDetails (cyclomatic 20) windows/src/ui/automationSettingsView.ts:598— automationSettingsView.summarizeRuleDetails 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.
energySettingsView.recordHostSnapshotIfLive (cyclomatic 20) windows/src/ui/energySettingsView.ts:171— energySettingsView.recordHostSnapshotIfLive 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.
sensorHistoryView.syncSensorHistoryHost (cyclomatic 20) windows/src/ui/sensorHistoryView.ts:525— sensorHistoryView.syncSensorHistoryHost 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.
detailDrawers.bindSpeakerCommandBars::submitSpeakerInput (cyclomatic 20) windows/src/ui/detailDrawers.ts:1207— detailDrawers.bindSpeakerCommandBars::submitSpeakerInput 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.
MenuBarStatusSummary.text (cyclomatic 19) Sources/MenuBarMijiaApp/MenuBarMijiaApp.swift:107— MenuBarStatusSummary.text 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.
ClassicControlCenterPanel.pageSections (cyclomatic 19) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:223— ClassicControlCenterPanel.pageSections 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.
CameraPTZDragPlanner.direction (cyclomatic 19) Sources/MijiaCore/CameraPTZ.swift:286— CameraPTZDragPlanner.direction 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.
DualSourceHomeProvider.handle (cyclomatic 19) Sources/MijiaCore/DualSourceHomeProvider.swift:156— DualSourceHomeProvider.handle 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.
HADiscovery.parseMDNSZoneOutput (cyclomatic 19) Sources/MijiaCore/HADiscovery.swift:237— HADiscovery.parseMDNSZoneOutput 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.
HomeStore.showToast (cyclomatic 19) Sources/MijiaCore/HomeStore.swift:1086— HomeStore.showToast 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.
HomeStore.startUpdateInstallation (cyclomatic 19) Sources/MijiaCore/HomeStore+Update.swift:88— HomeStore.startUpdateInstallation 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.
HomeStore.exportRaycastSnapshotIfNeeded (cyclomatic 19) Sources/MijiaCore/RaycastSnapshot.swift:666— HomeStore.exportRaycastSnapshotIfNeeded 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.
MiCloudClient.decodeResponse (cyclomatic 19) Sources/MijiaCore/MiCloud/MiCloudClient.swift:316— MiCloudClient.decodeResponse 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.
MiCloudProvider.runLoop (cyclomatic 19) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:208— MiCloudProvider.runLoop 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.
MiotSynthesizer.buildKitchenAppliance (cyclomatic 19) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1049— MiotSynthesizer.buildKitchenAppliance 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 is NOT this file's highest cyclomatic complexity: MiotSynthesizer.genericSymbolName (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.
habits.forgetHabitItem (cyclomatic 19) windows/src/core/assistant/habits.ts:1114— habits.forgetHabitItem has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
synthesis.primaryMiotService (cyclomatic 19) windows/src/core/miCloud/synthesis.ts:710— synthesis.primaryMiotService 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, separate the cases: extract each independent 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: synthesis.coverStatusWord (cyclomatic 52) 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.
safetyAndHealth.evaluateSensorAlerts (cyclomatic 19) REDACTED:396— safetyAndHealth.evaluateSensorAlerts 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.
raycastSnapshot.buildQuickActionItems (cyclomatic 19) windows/src/core/raycastSnapshot.ts:355— raycastSnapshot.buildQuickActionItems has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 370, 361, 364). 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.
appUrlCommand.describeResolvedTarget (cyclomatic 19) REDACTED:527— appUrlCommand.describeResolvedTarget 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.
sensorHistory.sanitizeStoredBucket (cyclomatic 19) windows/src/core/sensorHistory.ts:323— sensorHistory.sanitizeStoredBucket 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.
sensorHistory.parseMiCloudHistoryPoints (cyclomatic 19) windows/src/core/sensorHistory.ts:1067— sensorHistory.parseMiCloudHistoryPoints 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.
scheduledCommands.parseQueues (cyclomatic 19) windows/src/core/scheduledCommands.ts:82— scheduledCommands.parseQueues has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
cloudRefresh.cloudPanelStructureFingerprint (cyclomatic 19) REDACTED:475— cloudRefresh.cloudPanelStructureFingerprint has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 498, 553). 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.
detailDrawers.renderCoverDrawer (cyclomatic 19) windows/src/ui/detailDrawers.ts:267— detailDrawers.renderCoverDrawer 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.
settingsEvents.hasUnsavedSettingsChanges (cyclomatic 19) REDACTED:204— settingsEvents.hasUnsavedSettingsChanges has cyclomatic complexity 19 (threshold 15). Of this number, 17 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.
bindEvents.bindEvents::writeFacet (cyclomatic 19) windows/src/ui/bindEvents.ts:1329— bindEvents.bindEvents::writeFacet 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.
CameraLivePanelController.startMJPEGStream (cyclomatic 18) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:991— CameraLivePanelController.startMJPEGStream 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.
CameraLivePanelView.viewportContent (cyclomatic 18) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1899— CameraLivePanelView.viewportContent 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.
RoomOrderRowView.body (cyclomatic 18) Sources/MenuBarMijiaApp/RoomOrderEditor.swift:549— RoomOrderRowView.body 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.
IntentCatalog.init (cyclomatic 18) Sources/MijiaCore/CommandIntent.swift:607— IntentCatalog.init 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.
DeviceSynthesizer.haEnergyKwh (cyclomatic 18) Sources/MijiaCore/DeviceSynthesizer.swift:1742— DeviceSynthesizer.haEnergyKwh has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
VideoNALUnits.annexBToLengthPrefixed (cyclomatic 18) Sources/MijiaCore/FragmentedMP4Demuxer.swift:488— VideoNALUnits.annexBToLengthPrefixed 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.
HADiscovery.buildInstance (cyclomatic 18) Sources/MijiaCore/HADiscovery.swift:178— HADiscovery.buildInstance 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.
HADiscovery.isPrivateLANIPv4 (cyclomatic 18) Sources/MijiaCore/HADiscovery.swift:639— HADiscovery.isPrivateLANIPv4 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.
HomeStore.allOffChange (cyclomatic 18) Sources/MijiaCore/HomeStore+Undo.swift:367— HomeStore.allOffChange has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SceneVisualCategory.init (cyclomatic 18) Sources/MijiaCore/Models.swift:1644— SceneVisualCategory.init 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. This is NOT this file's highest cyclomatic complexity: ApplianceActivity.localizedLabel (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
UserHabitMemory.suggestionTitle (cyclomatic 18) Sources/MijiaCore/UserHabitMemory.swift:1000— UserHabitMemory.suggestionTitle has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
MiAccountLogin.parseSetCookieExpiry (cyclomatic 18) Sources/MijiaCore/MiCloud/MiAccountLogin.swift:263— MiAccountLogin.parseSetCookieExpiry 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.
MiotFacetEngine.controls (cyclomatic 18) Sources/MijiaCore/MiCloud/MiotFacets.swift:553— MiotFacetEngine.controls 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.
MiotSynthesizer.synthesize (cyclomatic 18) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:82— MiotSynthesizer.synthesize has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MiotSynthesizer.genericSymbolName (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.
MiotSynthesizer.buildSensor (cyclomatic 18) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1274— MiotSynthesizer.buildSensor has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MiotSynthesizer.genericSymbolName (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.
Go2RTCOwnerRecord.parse (cyclomatic 18) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:81— Go2RTCOwnerRecord.parse 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.
actionPolicy.confirmationHazard (cyclomatic 18) windows/src/core/assistant/actionPolicy.ts:65— actionPolicy.confirmationHazard has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
haDomains.buildHAFacets (cyclomatic 18) windows/src/core/haDomains.ts:958— haDomains.buildHAFacets 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.
promptContext.deviceSpecificCriteria (cyclomatic 18) windows/src/core/assistant/promptContext.ts:330— promptContext.deviceSpecificCriteria 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.
SensorHistoryStore.mergeCloudSamples (cyclomatic 18) windows/src/core/sensorHistory.ts:627— SensorHistoryStore.mergeCloudSamples 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.
controlFailure.isCancellationError (cyclomatic 18) windows/src/core/controlFailure.ts:73— controlFailure.isCancellationError 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.
MultiAccountMiCloudProvider.execute (cyclomatic 18) windows/src/core/miAccountsStore.ts:1351— MultiAccountMiCloudProvider.execute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: miAccountsStore.extractDeviceMiotCommandDids (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
CameraLiveController.openCameraLiveView (cyclomatic 18) windows/src/ui/cameraLive.ts:260— CameraLiveController.openCameraLiveView 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.
detailDrawers.renderPlugDrawer (cyclomatic 18) windows/src/ui/detailDrawers.ts:342— detailDrawers.renderPlugDrawer 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.
appLifecycle.checkForAppUpdate (cyclomatic 18) windows/src/ui/appLifecycle.ts:376— appLifecycle.checkForAppUpdate 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.
MenuMijiaWindowsApp.panelHealth (cyclomatic 18) windows/src/ui/app.ts:1145— MenuMijiaWindowsApp.panelHealth 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.
MenuMijiaWindowsApp.swapIfNeeded (cyclomatic 18) windows/src/ui/app.ts:1499— MenuMijiaWindowsApp.swapIfNeeded 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HotkeyAndNotificationManager.roomOrderKeyAction (cyclomatic 17) Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:358— HotkeyAndNotificationManager.roomOrderKeyAction has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: HotkeyAndNotificationManager.perform (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
LiquidGlassSlider.classicBody (cyclomatic 17) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:686— LiquidGlassSlider.classicBody 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.
ClassicLiquidGlassSlider.classicBody (cyclomatic 17) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:315— ClassicLiquidGlassSlider.classicBody 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.
FragmentedMP4Demuxer.parseConfigRecord (cyclomatic 17) Sources/MijiaCore/FragmentedMP4Demuxer.swift:240— FragmentedMP4Demuxer.parseConfigRecord 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.
HomeStore.beginOptimisticWrite (cyclomatic 17) Sources/MijiaCore/HomeStore+ControlWrite.swift:651— HomeStore.beginOptimisticWrite 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.
HomeStore.setFacetValue (cyclomatic 17) Sources/MijiaCore/HomeStore+Controls.swift:895— HomeStore.setFacetValue 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.
SensorBucketRecord.addSample (cyclomatic 17) Sources/MijiaCore/SensorHistory.swift:147— SensorBucketRecord.addSample 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.
AirQualityLevel.init (cyclomatic 17) Sources/MijiaCore/SmartDevice+Presentation.swift:470— AirQualityLevel.init 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. This is NOT this file's highest cyclomatic complexity: SmartDevice.localizeApplianceMode (cyclomatic 25) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
UnsupportedDeviceCollector.homeAssistant (cyclomatic 17) Sources/MijiaCore/UnsupportedDeviceCollector.swift:89— UnsupportedDeviceCollector.homeAssistant 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.
AppUpdater.stageUpdate (cyclomatic 17) Sources/MijiaCore/UpdateChecker.swift:1060— AppUpdater.stageUpdate 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.
MiAccountsProvider.publishSnapshot (cyclomatic 17) Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:451— MiAccountsProvider.publishSnapshot has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
MiCloudProvider.extractStreamURL (cyclomatic 17) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1403— MiCloudProvider.extractStreamURL 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.
intent.extractEnglishNumericOps (cyclomatic 17) windows/src/core/assistant/intent.ts:1064— intent.extractEnglishNumericOps 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.
haDomains.buildWaterHeaterKind (cyclomatic 17) windows/src/core/haDomains.ts:370— haDomains.buildWaterHeaterKind 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
speakerActions.findDirectiveAction (cyclomatic 17) windows/src/core/miCloud/speakerActions.ts:82— speakerActions.findDirectiveAction 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.
provider.isLocalNetworkEndpoint (cyclomatic 17) windows/src/core/assistant/provider.ts:166— provider.isLocalNetworkEndpoint 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.
promptContext.buildIntentCatalog (cyclomatic 17) windows/src/core/assistant/promptContext.ts:204— promptContext.buildIntentCatalog 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.
safetyAndHealth.collectMaintenanceForDevice (cyclomatic 17) REDACTED:1123— safetyAndHealth.collectMaintenanceForDevice 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.
miAccountsStore.readAccountIndex (cyclomatic 17) windows/src/core/miAccountsStore.ts:299— miAccountsStore.readAccountIndex has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: miAccountsStore.extractDeviceMiotCommandDids (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
dualSourceProvider.readTuplePairs (cyclomatic 17) windows/src/core/dualSourceProvider.ts:141— dualSourceProvider.readTuplePairs 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.
intentExecution.executeIntents::runTargetBatch (cyclomatic 17) windows/src/ui/intentExecution.ts:515— intentExecution.executeIntents::runTargetBatch has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (intentExecution.executeIntents) 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.
speechGuard.executeBuiltInQuickAction (cyclomatic 17) windows/src/ui/speechGuard.ts:592— speechGuard.executeBuiltInQuickAction 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. This is NOT this file's highest cyclomatic complexity: speechGuard.toggleVoiceInput (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
settingsViews.renderUpdateSection (cyclomatic 17) windows/src/ui/settingsViews.ts:1032— settingsViews.renderUpdateSection 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.
roomOrderEditor.renderRoomOrderEditorModal (cyclomatic 17) windows/src/ui/roomOrderEditor.ts:275— roomOrderEditor.renderRoomOrderEditorModal has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 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.
liquidGlassSlider.syncLiquidGlassSlider (cyclomatic 17) windows/src/ui/liquidGlassSlider.ts:74— liquidGlassSlider.syncLiquidGlassSlider has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ControlCenterPanel.emptyStateView (cyclomatic 16) Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:442— ControlCenterPanel.emptyStateView 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.
DeviceFacetSection.rowBody (cyclomatic 16) Sources/MenuBarMijiaApp/DeviceFacetViews.swift:383— DeviceFacetSection.rowBody 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.
ConnectionSettingsTab.body (cyclomatic 16) Sources/MenuBarMijiaApp/SettingsWindowView.swift:1065— ConnectionSettingsTab.body 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.
URLCommandHandler.description (cyclomatic 16) Sources/MenuBarMijiaApp/URLCommandHandler.swift:210— URLCommandHandler.description 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.
UnsupportedDeviceScanner.readHomeAssistantRegistry (cyclomatic 16) Sources/MenuBarMijiaApp/UnsupportedDeviceScanner.swift:218— UnsupportedDeviceScanner.readHomeAssistantRegistry has cyclomatic complexity 16 (threshold 15). Of this number, 13 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.
ClassicClimatePanelModule.strip (cyclomatic 16) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:89— ClassicClimatePanelModule.strip 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.
ClassicControlCenterPanel.emptyStateView (cyclomatic 16) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810— ClassicControlCenterPanel.emptyStateView 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.
ClassicControlCenterPanel.tileDragGesture (cyclomatic 16) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:485— ClassicControlCenterPanel.tileDragGesture 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.
AssistantProviderPreset.infer (cyclomatic 16) Sources/MijiaCore/AssistantConfig.swift:200— AssistantProviderPreset.infer 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.
IntentCatalog.text (cyclomatic 16) Sources/MijiaCore/CommandIntent.swift:752— IntentCatalog.text 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.
ControlFailure.classify (cyclomatic 16) Sources/MijiaCore/ControlFailure.swift:57— ControlFailure.classify has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
FragmentedMP4Demuxer.append (cyclomatic 16) Sources/MijiaCore/FragmentedMP4Demuxer.swift:67— FragmentedMP4Demuxer.append 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.
HAWebSocketProvider.connectAndListen (cyclomatic 16) Sources/MijiaCore/HomeProvider.swift:463— HAWebSocketProvider.connectAndListen 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.
HomeStore.setCoverMotor (cyclomatic 16) Sources/MijiaCore/HomeStore+Controls.swift:777— HomeStore.setCoverMotor 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.
HomeStore.resolveCameraStream (cyclomatic 16) Sources/MijiaCore/HomeStore+Controls.swift:1489— HomeStore.resolveCameraStream 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.
ModelActionPolicy.hazard (cyclomatic 16) Sources/MijiaCore/ModelActionPolicy.swift:229— ModelActionPolicy.hazard has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ModelIntentResolver.extractBalancedJSONObject (cyclomatic 16) Sources/MijiaCore/ModelIntentResolver.swift:1082— ModelIntentResolver.extractBalancedJSONObject 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: ModelIntentResolver.systemOneOperation (cyclomatic 27) 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.
SafetyMonitor.evaluate (cyclomatic 16) Sources/MijiaCore/SafetyMonitor.swift:36— SafetyMonitor.evaluate 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.
DiagnosticsReportBuilder.markdown (cyclomatic 16) Sources/MijiaCore/UnsupportedDeviceCollector.swift:285— DiagnosticsReportBuilder.markdown 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.
MiotSynthesizer.facetProps (cyclomatic 16) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:215— MiotSynthesizer.facetProps 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: MiotSynthesizer.genericSymbolName (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.
MiotSynthesizer.primary (cyclomatic 16) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:525— MiotSynthesizer.primary 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: MiotSynthesizer.genericSymbolName (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.
MiotSynthesizer.vacuumStatus (cyclomatic 16) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1503— MiotSynthesizer.vacuumStatus 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. This is NOT this file's highest cyclomatic complexity: MiotSynthesizer.genericSymbolName (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.
facets.propertyFacet (cyclomatic 16) windows/src/core/miCloud/facets.ts:270— facets.propertyFacet 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.
chineseIntentTables.spokenChineseNumber (cyclomatic 16) windows/src/core/assistant/chineseIntentTables.ts:195— chineseIntentTables.spokenChineseNumber 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.
provider.inferAssistantPreset (cyclomatic 16) windows/src/core/assistant/provider.ts:233— provider.inferAssistantPreset 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.
modelIntentResolver.extractBalancedJSONObject (cyclomatic 16) windows/src/core/assistant/modelIntentResolver.ts:590— modelIntentResolver.extractBalancedJSONObject 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: ModelIntentResolver.decodeSystemOneOp (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
raycastSnapshot.buildDeviceCapabilities (cyclomatic 16) windows/src/core/raycastSnapshot.ts:254— raycastSnapshot.buildDeviceCapabilities 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: raycastSnapshot.categoryTitleForDevice (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
AutomationEngine.evaluateSensorThresholdRules (cyclomatic 16) windows/src/core/automationEngine.ts:1323— AutomationEngine.evaluateSensorThresholdRules 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.
updateChecker.parseInstallerAssetRecord (cyclomatic 16) windows/src/core/updateChecker.ts:102— updateChecker.parseInstallerAssetRecord 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.
updateChecker.parseUpdateState (cyclomatic 16) windows/src/core/updateChecker.ts:169— updateChecker.parseUpdateState 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.
connectionsAndDiagView.buildDesensitizedDiagnosticsMarkdown (cyclomatic 16) windows/src/ui/connectionsAndDiagView.ts:875— connectionsAndDiagView.buildDesensitizedDiagnosticsMarkdown has cyclomatic complexity 16 (threshold 15). Of this number, 12 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.
onboardingGuide.switchConnectionModeInOnboarding (cyclomatic 16) windows/src/ui/onboardingGuide.ts:285— onboardingGuide.switchConnectionModeInOnboarding 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.
panelKeyboard.submitPanelInput (cyclomatic 16) windows/src/ui/panelKeyboard.ts:102— panelKeyboard.submitPanelInput has cyclomatic complexity 16 (threshold 15). Of this number, 12 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.
activityStackView.partitionUndoStepsByHighRiskConfirmation (cyclomatic 16) windows/src/ui/activityStackView.ts:709— activityStackView.partitionUndoStepsByHighRiskConfirmation 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.
activityStackView.renderSingleActivityRow (cyclomatic 16) windows/src/ui/activityStackView.ts:1314— activityStackView.renderSingleActivityRow 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.
DeviceSynthesizer.buildSmartDevice (cognitive 237) Sources/MijiaCore/DeviceSynthesizer.swift:871— DeviceSynthesizer.buildSmartDevice has cognitive complexity 237 (threshold 15). Drivers by points: boolean chains 87, if/else 60 (83 pts), ternaries 18 (42 pts), loops 9 (21 pts), match/switch 2 (4 pts) (nesting depth added 61). Of this number, 233 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.
deviceViews.renderPrimaryDrawer (cognitive 228) windows/src/ui/deviceViews.ts:235— deviceViews.renderPrimaryDrawer has cognitive complexity 228 (threshold 15). Drivers by points: ternaries 63 (165 pts), if/else 27 (39 pts), boolean chains 24 (nesting depth added 114). Of this number, 192 points are the body's own statements and 36 belong to 11 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.
commandEffects.applyCommandToDevices (cognitive 202) windows/src/core/commandEffects.ts:23— commandEffects.applyCommandToDevices has cognitive complexity 202 (threshold 15). Drivers by points: if/else 61 (149 pts), boolean chains 38, ternaries 2 (9 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 98). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commandEffects.inverseCommands (cognitive 202) windows/src/core/commandEffects.ts:268— commandEffects.inverseCommands has cognitive complexity 202 (threshold 15). Drivers by points: if/else 40 (109 pts), ternaries 27 (71 pts), boolean chains 21, match/switch 1 (nesting depth added 113). 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.
PanelRenderPipeline.commitRender (cognitive 200) windows/src/ui/reconciler.ts:1294— PanelRenderPipeline.commitRender has cognitive complexity 200 (threshold 15). Drivers by points: if/else 63 (112 pts), boolean chains 57, ternaries 13 (23 pts), loops 3 (8 pts) (nesting depth added 64). Of this number, 156 points are the body's own statements and 44 belong to 11 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.
AutomationEngine.dispatchEvent (cognitive 198) windows/src/core/automationEngine.ts:1045— AutomationEngine.dispatchEvent has cognitive complexity 198 (threshold 15). Drivers by points: if/else 52 (130 pts), ternaries 10 (26 pts), loops 9 (22 pts), boolean chains 19, match/switch 1 (nesting depth added 107). Of this number, 191 points are the body's own statements and 7 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.
CameraLiveController.resolveCloudCameraStream (cognitive 192) windows/src/ui/cameraLive.ts:924— CameraLiveController.resolveCloudCameraStream has cognitive complexity 192 (threshold 15). Drivers by points: if/else 50 (125 pts), ternaries 10 (46 pts), boolean chains 15, error handling 2 (4 pts), loops 1 (2 pts) (nesting depth added 114). Of this number, 186 points are the body's own statements and 6 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.
SmartDevice.statusSubtitle (cognitive 171) Sources/MijiaCore/SmartDevice+Presentation.swift:97— SmartDevice.statusSubtitle has cognitive complexity 171 (threshold 15). Drivers by points: if/else 66 (128 pts), ternaries 9 (21 pts), boolean chains 16, match/switch 3 (6 pts) (nesting depth added 77). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models.deviceStatusSummary (cognitive 169) windows/src/core/models.ts:1129— models.deviceStatusSummary has cognitive complexity 169 (threshold 15). Drivers by points: if/else 50 (97 pts), ternaries 24 (62 pts), boolean chains 9, match/switch 1 (nesting depth added 85). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
appUrlCommand.onOpenURL (cognitive 146) REDACTED:1064— appUrlCommand.onOpenURL has cognitive complexity 146 (threshold 15). Drivers by points: if/else 36 (72 pts), ternaries 21 (54 pts), boolean chains 19, match/switch 1 (nesting depth added 69). Of this number, 145 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.
HomeStore.handleProviderEvent (cognitive 143) Sources/MijiaCore/HomeStore+Backend.swift:225— HomeStore.handleProviderEvent has cognitive complexity 143 (threshold 15). Drivers by points: if/else 44 (101 pts), boolean chains 20, loops 5 (16 pts), ternaries 2 (5 pts), match/switch 1 (nesting depth added 71). 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.
homeAssistant.buildKind (cognitive 137) windows/src/core/homeAssistant.ts:413— homeAssistant.buildKind has cognitive complexity 137 (threshold 15). Drivers by points: if/else 36 (56 pts), boolean chains 42, ternaries 15 (35 pts), loops 2 (4 pts) (nesting depth added 42). Of this number, 103 points are the body's own statements and 34 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.
deviceViews.renderDeviceTile (cognitive 137) windows/src/ui/deviceViews.ts:1252— deviceViews.renderDeviceTile has cognitive complexity 137 (threshold 15). Drivers by points: ternaries 70 (110 pts), boolean chains 22, if/else 5 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeviceDeduplicator.capabilityScore (cognitive 136) Sources/MijiaCore/DeviceDeduplicator.swift:400— DeviceDeduplicator.capabilityScore has cognitive complexity 136 (threshold 15). Drivers by points: if/else 63 (126 pts), boolean chains 7, ternaries 1 (2 pts), match/switch 1 (nesting depth added 64). 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.
MiIOCryptoAndPacket.swift.cleanMalformedFirmwareJSON (cognitive 136) Sources/MijiaCore/MiCloud/MiIOCryptoAndPacket.swift:513— MiIOCryptoAndPacket.swift.cleanMalformedFirmwareJSON has cognitive complexity 136 (threshold 15). Drivers by points: if/else 28 (77 pts), loops 11 (27 pts), boolean chains 23, match/switch 4 (9 pts) (nesting depth added 70). Of this number, 129 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.
panelKeyboard.handlePanelKey (cognitive 132) windows/src/ui/panelKeyboard.ts:260— panelKeyboard.handlePanelKey has cognitive complexity 132 (threshold 15). Drivers by points: if/else 49 (78 pts), boolean chains 34, ternaries 6 (20 pts) (nesting depth added 43). Of this number, 131 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.
HomeStore.togglePrimary (cognitive 131) Sources/MijiaCore/HomeStore+Controls.swift:60— HomeStore.togglePrimary has cognitive complexity 131 (threshold 15). Drivers by points: if/else 46 (90 pts), ternaries 11 (26 pts), boolean chains 7, match/switch 3 (5 pts), error handling 2 (3 pts) (nesting depth added 62). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
settingsEvents.bindSettingsEvents (cognitive 130) REDACTED:714— settingsEvents.bindSettingsEvents has cognitive complexity 130 (threshold 15). Drivers by points: if/else 79 (106 pts), boolean chains 17, ternaries 5, error handling 1, loops 1 (nesting depth added 27). Most of this is not in the body itself: 12 of the 130 points are its own statements and the rest belongs to 27 function items inside it that branch (a function literal at line 1229, a function literal at line 1109, a function literal at line 1030, …). 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.
miAccountsStore.mergeMiAccountSnapshots (cognitive 117) windows/src/core/miAccountsStore.ts:778— miAccountsStore.mergeMiAccountSnapshots has cognitive complexity 117 (threshold 15). Drivers by points: if/else 24 (79 pts), loops 11 (21 pts), boolean chains 9, ternaries 3 (8 pts) (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DeviceDeduplicator.merge (cognitive 112) Sources/MijiaCore/DeviceDeduplicator.swift:43— DeviceDeduplicator.merge has cognitive complexity 112 (threshold 15). Drivers by points: if/else 32 (56 pts), boolean chains 25, loops 16 (19 pts), ternaries 5 (7 pts), match/switch 2 (5 pts) (nesting depth added 32). Of this number, 110 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.
FragmentedMP4Demuxer.parseFragment (cognitive 112) Sources/MijiaCore/FragmentedMP4Demuxer.swift:301— FragmentedMP4Demuxer.parseFragment has cognitive complexity 112 (threshold 15). Drivers by points: if/else 22 (78 pts), ternaries 6 (20 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 76). Of this number, 108 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.
panelView.renderNotificationStack (cognitive 109) windows/src/ui/panelView.ts:279— panelView.renderNotificationStack has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 21 (85 pts), if/else 12 (19 pts), boolean chains 5 (nesting depth added 71). Of this number, 106 points are the body's own statements and 3 belong to 2 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.
LocalIntentParser.parseDeviceCommand (cognitive 107) Sources/MijiaCore/LocalIntentParser.swift:244— LocalIntentParser.parseDeviceCommand has cognitive complexity 107 (threshold 15). Drivers by points: if/else 26 (62 pts), loops 15 (18 pts), boolean chains 16, ternaries 3 (8 pts), match/switch 1 (3 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SmartDevice.mergingOptimisticFields (cognitive 103) Sources/MijiaCore/OptimisticField.swift:190— SmartDevice.mergingOptimisticFields has cognitive complexity 103 (threshold 15). Drivers by points: if/else 50 (99 pts), boolean chains 3, match/switch 1 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
intent.parseChineseDeviceCommand (cognitive 103) windows/src/core/assistant/intent.ts:1154— intent.parseChineseDeviceCommand has cognitive complexity 103 (threshold 15). Drivers by points: if/else 29 (63 pts), loops 16 (20 pts), boolean chains 12, ternaries 3 (8 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layoutGestures.bindLayoutGestures (cognitive 101) windows/src/ui/layoutGestures.ts:63— layoutGestures.bindLayoutGestures has cognitive complexity 101 (threshold 15). Drivers by points: if/else 46 (74 pts), boolean chains 21, ternaries 4 (6 pts) (nesting depth added 30). None of this is in the body itself: all 101 points belong to 7 function items inside it that branch (a function literal at line 174, a function literal at line 271, a function literal at line 337, …). 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.
LocalIntentParser.parseEnglishCommand (cognitive 100) Sources/MijiaCore/LocalIntentParser.swift:784— LocalIntentParser.parseEnglishCommand has cognitive complexity 100 (threshold 15). Drivers by points: if/else 27 (55 pts), boolean chains 19, loops 19, ternaries 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SmartDevice.sfSymbolName (cognitive 100) Sources/MijiaCore/SmartDevice+Presentation.swift:9— SmartDevice.sfSymbolName has cognitive complexity 100 (threshold 15). Drivers by points: if/else 21 (43 pts), ternaries 14 (34 pts), boolean chains 22, match/switch 1 (nesting depth added 42). 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.
MiotCommandMapper.map (cognitive 98) Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:32— MiotCommandMapper.map has cognitive complexity 98 (threshold 15). Drivers by points: if/else 30 (58 pts), ternaries 7 (18 pts), boolean chains 15, match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserHabitMemory.topSuggestions (cognitive 95) windows/src/core/assistant/habits.ts:608— UserHabitMemory.topSuggestions has cognitive complexity 95 (threshold 15). Drivers by points: if/else 35 (61 pts), boolean chains 15, loops 8 (10 pts), ternaries 7 (9 pts) (nesting depth added 30). Of this number, 74 points are the body's own statements and 21 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.
automationSettingsView.renderAutomationAndSafetySettingsSections (cognitive 95) windows/src/ui/automationSettingsView.ts:813— automationSettingsView.renderAutomationAndSafetySettingsSections has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 59 (91 pts), boolean chains 3, if/else 1 (nesting depth added 32). Of this number, 70 points are the body's own statements and 25 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.
cloudRefresh.refreshDevices (cognitive 95) REDACTED:84— cloudRefresh.refreshDevices has cognitive complexity 95 (threshold 15). Drivers by points: if/else 37 (55 pts), boolean chains 21, ternaries 6 (17 pts), error handling 2 (nesting depth added 29). Of this number, 92 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.
deviceViews.deviceSvgIcon (cognitive 95) windows/src/ui/deviceViews.ts:852— deviceViews.deviceSvgIcon has cognitive complexity 95 (threshold 15). Drivers by points: if/else 28 (57 pts), boolean chains 24, ternaries 6 (13 pts), match/switch 1 (nesting depth added 36). 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.
DeviceSynthesizer.synthesize (cognitive 94) Sources/MijiaCore/DeviceSynthesizer.swift:267— DeviceSynthesizer.synthesize has cognitive complexity 94 (threshold 15). Drivers by points: if/else 24 (58 pts), boolean chains 26, loops 7 (10 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
appUrlCommand.executeDirectAskPreset (cognitive 94) REDACTED:824— appUrlCommand.executeDirectAskPreset has cognitive complexity 94 (threshold 15). Drivers by points: if/else 46 (69 pts), ternaries 20 (39 pts), boolean chains 17 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (appUrlCommand.executeDirectAskPreset::runDirectCover) 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.
verify-flyout-layout.evaluateSnapshot (cognitive 93) windows/scripts/verify-flyout-layout.mjs:42— verify-flyout-layout.evaluateSnapshot has cognitive complexity 93 (threshold 15). Drivers by points: if/else 34 (58 pts), ternaries 7 (14 pts), boolean chains 13, loops 4 (8 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dualSourceProvider.extractHADeviceIdentities (cognitive 93) windows/src/core/dualSourceProvider.ts:149— dualSourceProvider.extractHADeviceIdentities has cognitive complexity 93 (threshold 15). Drivers by points: if/else 15 (49 pts), ternaries 7 (22 pts), loops 6 (15 pts), boolean chains 7 (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OptimisticField.changedFields (cognitive 92) Sources/MijiaCore/OptimisticField.swift:108— OptimisticField.changedFields has cognitive complexity 92 (threshold 15). Drivers by points: if/else 44 (87 pts), boolean chains 4, match/switch 1 (nesting depth added 43). 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.
promptContext.catalogStateSummary (cognitive 91) windows/src/core/assistant/promptContext.ts:89— promptContext.catalogStateSummary has cognitive complexity 91 (threshold 15). Drivers by points: ternaries 21 (45 pts), if/else 18 (38 pts), boolean chains 7, match/switch 1 (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.
optimisticLock.syncDirectCommandToFacets (cognitive 91) windows/src/core/optimisticLock.ts:910— optimisticLock.syncDirectCommandToFacets has cognitive complexity 91 (threshold 15). Drivers by points: if/else 21 (61 pts), ternaries 4 (17 pts), boolean chains 10, loops 2 (3 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudProvider.resolveCameraStream (cognitive 88) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1132— MiCloudProvider.resolveCameraStream has cognitive complexity 88 (threshold 15). Drivers by points: if/else 27 (68 pts), boolean chains 14, error handling 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
settings.loadSettings (cognitive 83) windows/src/ui/settings.ts:59— settings.loadSettings has cognitive complexity 83 (threshold 15). Drivers by points: ternaries 31 (65 pts), boolean chains 14, if/else 2 (3 pts), error handling 1 (nesting depth added 35). Of this number, 81 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.
reconciler.reconcileElementTree (cognitive 82) windows/src/ui/reconciler.ts:385— reconciler.reconcileElementTree has cognitive complexity 82 (threshold 15). Drivers by points: if/else 31 (68 pts), boolean chains 7, loops 5, ternaries 1 (2 pts) (nesting depth added 38). Of this number, 68 points are the body's own statements and 14 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.
MenuMijiaWindowsApp.performUndo (cognitive 82) windows/src/ui/app.ts:857— MenuMijiaWindowsApp.performUndo has cognitive complexity 82 (threshold 15). Drivers by points: if/else 31 (58 pts), boolean chains 13, ternaries 4 (8 pts), loops 2 (3 pts) (nesting depth added 32). Of this number, 78 points are the body's own statements and 4 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.
homeAssistant.haServiceCall (cognitive 81) windows/src/core/homeAssistant.ts:1130— homeAssistant.haServiceCall has cognitive complexity 81 (threshold 15). Drivers by points: if/else 26 (57 pts), ternaries 8 (15 pts), boolean chains 8, match/switch 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
intentExecution.executeIntents (cognitive 81) windows/src/ui/intentExecution.ts:390— intentExecution.executeIntents has cognitive complexity 81 (threshold 15). Drivers by points: if/else 55 (131 pts), ternaries 7 (22 pts), boolean chains 18, loops 7 (12 pts), error handling 2 (7 pts) (nesting depth added 101). To reduce it, split the body into named stages: move each independent 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 (intentExecution.executeIntents::runTargetBatch) 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.
cameraHubs.resolveLiveCameraTarget (cognitive 80) windows/src/core/miCloud/cameraHubs.ts:390— cameraHubs.resolveLiveCameraTarget has cognitive complexity 80 (threshold 15). Drivers by points: if/else 19 (43 pts), boolean chains 18, loops 3 (11 pts), ternaries 7 (8 pts) (nesting depth added 33). Of this number, 75 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.
energyHistory.sanitizeStored (cognitive 80) windows/src/core/energyHistory.ts:192— energyHistory.sanitizeStored has cognitive complexity 80 (threshold 15). Drivers by points: if/else 20 (44 pts), loops 8 (17 pts), boolean chains 16, ternaries 1 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
facets.facetControls (cognitive 78) windows/src/core/miCloud/facets.ts:484— facets.facetControls has cognitive complexity 78 (threshold 15). Drivers by points: ternaries 12 (46 pts), if/else 9 (20 pts), boolean chains 11, loops 1 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
commandDispatch.applyCommand (cognitive 78) windows/src/ui/commandDispatch.ts:839— commandDispatch.applyCommand has cognitive complexity 78 (threshold 15). Drivers by points: if/else 23 (35 pts), ternaries 12 (22 pts), boolean chains 18, loops 2, error handling 1 (nesting depth added 22). Of this number, 76 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.
demo.demoSensorHistorySamples (cognitive 78) windows/src/ui/demo.ts:26— demo.demoSensorHistorySamples has cognitive complexity 78 (threshold 15). Drivers by points: ternaries 28 (68 pts), boolean chains 5, loops 2 (3 pts), if/else 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAHomeSnapshot.receive (cognitive 76) windows/src/core/homeAssistant.ts:1328— HAHomeSnapshot.receive has cognitive complexity 76 (threshold 15). Drivers by points: if/else 24 (47 pts), ternaries 4 (15 pts), boolean chains 11, loops 1 (3 pts) (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UserHabitMemory.topSuggestions (cognitive 75) Sources/MijiaCore/UserHabitMemory.swift:704— UserHabitMemory.topSuggestions has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (38 pts), boolean chains 21, loops 8 (10 pts), ternaries 3 (6 pts) (nesting depth added 19). Of this number, 74 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.
connectionsAndDiagView.renderConnectionsAndDiagSection (cognitive 75) windows/src/ui/connectionsAndDiagView.ts:1078— connectionsAndDiagView.renderConnectionsAndDiagSection has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 40 (57 pts), boolean chains 15, if/else 2 (3 pts) (nesting depth added 18). Of this number, 51 points are the body's own statements and 24 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.
naturalCommand.handleNaturalCommand (cognitive 75) windows/src/ui/naturalCommand.ts:45— naturalCommand.handleNaturalCommand has cognitive complexity 75 (threshold 15). Drivers by points: if/else 30 (49 pts), boolean chains 16, ternaries 5 (9 pts), error handling 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cameraLiveModalView.renderCameraLiveModalView (cognitive 74) windows/src/ui/cameraLiveModalView.ts:36— cameraLiveModalView.renderCameraLiveModalView has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 29 (47 pts), if/else 16, boolean chains 11 (nesting depth added 18). Of this number, 62 points are the body's own statements and 12 belong 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.
activityStackView.buildUpperCardFactories (cognitive 74) windows/src/ui/activityStackView.ts:1408— activityStackView.buildUpperCardFactories has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 17 (28 pts), if/else 18 (25 pts), boolean chains 20, loops 1 (nesting depth added 18). Of this number, 52 points are the body's own statements and 22 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.
cloudRefresh.cloudPanelStructureFingerprint (cognitive 72) REDACTED:475— cloudRefresh.cloudPanelStructureFingerprint has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 15 (70 pts), boolean chains 2 (nesting depth added 55). Most of this is not in the body itself: 3 of the 72 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 498, 553). 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.
MacContextAutomation.events (cognitive 71) Sources/MijiaCore/MacContextAutomation.swift:92— MacContextAutomation.events has cognitive complexity 71 (threshold 15). Drivers by points: if/else 21 (42 pts), boolean chains 28, match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
automationEngine.executeAutomationRule (cognitive 71) windows/src/core/automationEngine.ts:863— automationEngine.executeAutomationRule has cognitive complexity 71 (threshold 15). Drivers by points: if/else 27 (56 pts), loops 4 (10 pts), boolean chains 4, ternaries 1 (nesting depth added 35). Of this number, 70 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.
UnsupportedDeviceScanner.scan (cognitive 70) REDACTED:601— UnsupportedDeviceScanner.scan has cognitive complexity 70 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 5 (14 pts), ternaries 5 (10 pts), boolean chains 8, error handling 2 (5 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deviceViews.renderClimateStrip (cognitive 70) windows/src/ui/deviceViews.ts:120— deviceViews.renderClimateStrip has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 35 (60 pts), boolean chains 10 (nesting depth added 25). Of this number, 59 points are the body's own statements and 11 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.
reconciler.extractControlIdentityKey (cognitive 68) windows/src/ui/reconciler.ts:128— reconciler.extractControlIdentityKey has cognitive complexity 68 (threshold 15). Drivers by points: if/else 52 (59 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
reconciler.syncElementAttributesAndProps (cognitive 68) windows/src/ui/reconciler.ts:266— reconciler.syncElementAttributesAndProps has cognitive complexity 68 (threshold 15). Drivers by points: if/else 25 (46 pts), boolean chains 20, loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppURLParser.parseEnvelope (cognitive 67) Sources/MijiaCore/AppURLCommand.swift:131— AppURLParser.parseEnvelope has cognitive complexity 67 (threshold 15). Drivers by points: if/else 24 (40 pts), boolean chains 23, ternaries 1 (2 pts), loops 1, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DemoHomeProvider.applying (cognitive 67) Sources/MijiaCore/DemoHomeProvider.swift:486— DemoHomeProvider.applying has cognitive complexity 67 (threshold 15). Drivers by points: match/switch 9 (27 pts), if/else 14 (24 pts), ternaries 2 (8 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sensorHistory.parseHomeAssistantHistoryResponse (cognitive 66) windows/src/core/sensorHistory.ts:1308— sensorHistory.parseHomeAssistantHistoryResponse has cognitive complexity 66 (threshold 15). Drivers by points: if/else 13 (34 pts), ternaries 4 (14 pts), boolean chains 13, loops 3 (5 pts) (nesting depth added 33). Of this number, 61 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.
Context.coerce (cognitive 65) Sources/MijiaCore/MiCloud/MiotCommandMapper.swift:374— Context.coerce has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 14, ternaries 4 (8 pts), match/switch 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
command.coercePropValue (cognitive 64) windows/src/core/miCloud/command.ts:25— command.coercePropValue has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (43 pts), boolean chains 11, ternaries 7 (10 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
controlFailure.classifyRawError (cognitive 64) windows/src/core/controlFailure.ts:136— controlFailure.classifyRawError has cognitive complexity 64 (threshold 15). Drivers by points: if/else 26 (44 pts), boolean chains 12, ternaries 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAWebSocketProvider.mapCommandToService (cognitive 63) Sources/MijiaCore/HomeProvider.swift:817— HAWebSocketProvider.mapCommandToService has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (30 pts), ternaries 11 (29 pts), match/switch 2 (4 pts) (nesting depth added 34). 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.
DoorbellDetector.ingestHASnapshot (cognitive 62) windows/src/core/automationEngine.ts:1400— DoorbellDetector.ingestHASnapshot has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (27 pts), ternaries 9 (20 pts), boolean chains 12, loops 3 (nesting depth added 26). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.executeIntentPlan (cognitive 61) Sources/MijiaCore/HomeStore+Assistant.swift:886— HomeStore.executeIntentPlan has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (30 pts), ternaries 8 (16 pts), boolean chains 9, loops 4, match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.executeQuickAction (cognitive 61) Sources/MijiaCore/HomeStore+Undo.swift:115— HomeStore.executeQuickAction has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (36 pts), boolean chains 15, loops 3 (6 pts), match/switch 2 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IntentCatalog.stateSummary (cognitive 59) Sources/MijiaCore/CommandIntent.swift:882— IntentCatalog.stateSummary has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 13 (27 pts), if/else 13 (25 pts), boolean chains 6, match/switch 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.runAssistantCommand (cognitive 59) Sources/MijiaCore/HomeStore+Assistant.swift:357— HomeStore.runAssistantCommand has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (42 pts), ternaries 5 (11 pts), boolean chains 4, error handling 1 (2 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.
cloudRefresh.patchCloudPresentation (cognitive 59) REDACTED:589— cloudRefresh.patchCloudPresentation has cognitive complexity 59 (threshold 15). Drivers by points: if/else 28 (40 pts), boolean chains 11, loops 5 (6 pts), ternaries 1 (2 pts) (nesting depth added 14). Of this number, 57 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.
XiaomiCameraBridge.spawnCS2UDPRelay (cognitive 58) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:1335— XiaomiCameraBridge.spawnCS2UDPRelay has cognitive complexity 58 (threshold 15). Drivers by points: if/else 19 (47 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commandDispatch.scheduleEchoReadBack.executeSingleDeviceReadBack (cognitive 56) windows/src/ui/commandDispatch.ts:577— commandDispatch.scheduleEchoReadBack.executeSingleDeviceReadBack has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 14 (30 pts), if/else 14 (22 pts), boolean chains 4 (nesting depth added 24). Of this number, 54 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.
cloudRefresh.refreshMultiAccountXiaomiDevices (cognitive 56) REDACTED:821— cloudRefresh.refreshMultiAccountXiaomiDevices has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (31 pts), ternaries 5 (13 pts), boolean chains 11, 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.
URLCommandHandler.execute (cognitive 55) Sources/MenuBarMijiaApp/URLCommandHandler.swift:292— URLCommandHandler.execute has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 6 (16 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 26). 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.
WeeklyHealthReport.markdown (cognitive 54) Sources/MijiaCore/WeeklyHealthReport.swift:253— WeeklyHealthReport.markdown has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 6 (19 pts), boolean chains 5, loops 1 (2 pts), match/switch 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.
quickActions.planQuickAction (cognitive 54) windows/src/core/quickActions.ts:134— quickActions.planQuickAction has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (33 pts), ternaries 3 (10 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 32). Of this number, 53 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
raycastSnapshot.normalizeLightGroupOwners (cognitive 54) windows/src/core/raycastSnapshot.ts:468— raycastSnapshot.normalizeLightGroupOwners has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 6 (17 pts), boolean chains 8 (nesting depth added 29). Of this number, 41 points are the body's own statements and 13 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.
MenuBarPanelController.handleMouseDown (cognitive 53) Sources/MenuBarMijiaApp/MenuBarPanelController.swift:1361— MenuBarPanelController.handleMouseDown has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (30 pts), boolean chains 23 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.commitManualWrite (cognitive 53) Sources/MijiaCore/HomeStore+ControlWrite.swift:868— HomeStore.commitManualWrite has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 9, error handling 3 (5 pts), ternaries 2 (3 pts), loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PanelSearch.action (cognitive 53) Sources/MijiaCore/PanelSearch.swift:355— PanelSearch.action has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 15, ternaries 3 (6 pts), match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelIntentResolver.planFromSystemOne (cognitive 53) windows/src/core/assistant/modelIntentResolver.ts:205— ModelIntentResolver.planFromSystemOne has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 12 (20 pts), if/else 10 (19 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 20). 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.
optimisticLock.applyHAExtendedCommandEffect (cognitive 53) windows/src/core/optimisticLock.ts:1007— optimisticLock.applyHAExtendedCommandEffect has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (33 pts), ternaries 3 (10 pts), boolean chains 9, loops 1 (nesting depth added 26). Of this number, 52 points are the body's own statements and 1 belongs 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.
detailDrawers.bindDetailDrawerEvents (cognitive 53) windows/src/ui/detailDrawers.ts:592— detailDrawers.bindDetailDrawerEvents has cognitive complexity 53 (threshold 15). Drivers by points: if/else 29 (30 pts), boolean chains 15, ternaries 7 (8 pts) (nesting depth added 2). None of this is in the body itself: all 53 points belong to 19 function items inside it that branch (a function literal at line 654, a function literal at line 773, a function literal at line 688, …). 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.
IntentValidator.normalize (cognitive 52) Sources/MijiaCore/CommandIntent.swift:345— IntentValidator.normalize has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 11 (22 pts), boolean chains 6, match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
HomeStore.assistantEffect (cognitive 52) Sources/MijiaCore/HomeStore+Assistant.swift:1147— HomeStore.assistantEffect has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (33 pts), ternaries 8 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
safetyAndHealth.renderWeeklyHealthMarkdown (cognitive 52) REDACTED:1319— safetyAndHealth.renderWeeklyHealthMarkdown has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 7 (13 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiAccountLogin.parseServiceTokenCookie (cognitive 51) windows/src/core/miCloud/accountLogin.ts:132— MiAccountLogin.parseServiceTokenCookie has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (34 pts), loops 4 (7 pts), ternaries 2 (7 pts), boolean chains 3 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAHomeSnapshot.receive (cognitive 50) Sources/MijiaCore/HAHomeSnapshot.swift:38— HAHomeSnapshot.receive has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 9, loops 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ManualControlPolicy.facetRequiresConfirmation (cognitive 49) Sources/MijiaCore/ManualControlPolicy.swift:176— ManualControlPolicy.facetRequiresConfirmation has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 24, if/else 18 (24 pts), match/switch 1 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SafetyMonitor.evaluate (cognitive 49) REDACTED:536— SafetyMonitor.evaluate has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 9, ternaries 2 (8 pts), loops 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
automationEngine.readSensorMetricValue (cognitive 49) windows/src/core/automationEngine.ts:775— automationEngine.readSensorMetricValue has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 14 (47 pts), boolean chains 1, match/switch 1 (nesting depth added 33). 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.
intentExecution.executeSingleCommand (cognitive 49) windows/src/ui/intentExecution.ts:773— intentExecution.executeSingleCommand has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (35 pts), boolean chains 9, ternaries 3 (4 pts), error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
activityStackView.bindUnifiedUpperStack (cognitive 49) windows/src/ui/activityStackView.ts:1603— activityStackView.bindUnifiedUpperStack has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 5 (11 pts), boolean chains 10, error handling 2 (4 pts), loops 2 (nesting depth added 20). Most of this is not in the body itself: 8 of the 49 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1627, finishPointer, a function literal at line 1616). 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.
PanelKeyRouter.afterSearch (cognitive 48) Sources/MenuBarMijiaApp/PanelKeyRouter.swift:86— PanelKeyRouter.afterSearch has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 17, ternaries 2 (4 pts), match/switch 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.
FragmentedMP4Demuxer.parseTrak (cognitive 48) Sources/MijiaCore/FragmentedMP4Demuxer.swift:150— FragmentedMP4Demuxer.parseTrak has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (25 pts), ternaries 4 (11 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 2 (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.
MiCloudProvider.fetchPropsHybrid (cognitive 48) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:613— MiCloudProvider.fetchPropsHybrid has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (28 pts), error handling 4 (9 pts), loops 5 (8 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserHabitMemory.record (cognitive 48) windows/src/core/assistant/habits.ts:308— UserHabitMemory.record has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (33 pts), boolean chains 7, loops 3 (5 pts), ternaries 3 (nesting depth added 16). Of this number, 46 points are the body's own statements and 2 belong 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.
HomeAssistantSynthesizer.synthesize (cognitive 48) windows/src/core/homeAssistant.ts:857— HomeAssistantSynthesizer.synthesize has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 10, loops 5 (7 pts), ternaries 4 (nesting depth added 14). Of this number, 32 points are the body's own statements and 16 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.
connectionsAndDiagView.performSignOutSingleMiAccountOnHost (cognitive 48) windows/src/ui/connectionsAndDiagView.ts:478— connectionsAndDiagView.performSignOutSingleMiAccountOnHost has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 12, loops 3 (6 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 13). Of this number, 47 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.
onboardingGuide.mountOnboardingGuide (cognitive 48) windows/src/ui/onboardingGuide.ts:343— onboardingGuide.mountOnboardingGuide has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (23 pts), ternaries 7 (14 pts), boolean chains 11 (nesting depth added 8). Most of this is not in the body itself: 6 of the 48 points are its own statements and the rest belongs to 12 function items inside it that branch (renderSourceBody, completeAndClose, a function literal at line 663, …). 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.
ClassicDeviceCardView.headerRow (cognitive 47) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:479— ClassicDeviceCardView.headerRow has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 13 (22 pts), if/else 15 (20 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
verify-flyout-layout.main (cognitive 47) windows/scripts/verify-flyout-layout.mjs:578— verify-flyout-layout.main has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 4 (7 pts), error handling 2 (5 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 20). Of this number, 45 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.
haDomains.buildSingleHAFacet (cognitive 47) windows/src/core/haDomains.ts:1004— haDomains.buildSingleHAFacet has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (22 pts), ternaries 10 (16 pts), boolean chains 8, match/switch 1 (nesting depth added 13). Of this number, 46 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.
habits.shareHabitSentence (cognitive 47) windows/src/core/assistant/habits.ts:792— habits.shareHabitSentence has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dom.morphMatchingDom (cognitive 47) windows/src/ui/dom.ts:21— dom.morphMatchingDom has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (38 pts), boolean chains 7, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cloudRefresh.refreshDualSourceDevices (cognitive 47) REDACTED:1079— cloudRefresh.refreshDualSourceDevices has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 11, ternaries 3 (5 pts), loops 2 (3 pts), error handling 1 (nesting depth added 10). Of this number, 40 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.
HomeStore.undoTurnAllOff (cognitive 46) Sources/MijiaCore/HomeStore+Undo.swift:725— HomeStore.undoTurnAllOff has cognitive complexity 46 (threshold 15). Drivers by points: loops 7 (18 pts), if/else 14 (16 pts), ternaries 4 (8 pts), boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.applyUndoCommands (cognitive 46) Sources/MijiaCore/HomeStore+Undo.swift:1036— HomeStore.applyUndoCommands has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 14, ternaries 1 (3 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OfflineHistory.load (cognitive 46) REDACTED:954— OfflineHistory.load has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 4 (10 pts), ternaries 1 (5 pts), boolean chains 3, error handling 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commandDispatch.captureReversibleFacetBeforeWrite (cognitive 46) windows/src/ui/commandDispatch.ts:277— commandDispatch.captureReversibleFacetBeforeWrite has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 11, loops 1 (nesting depth added 18). Of this number, 45 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.
UserHabitMemory.record (cognitive 45) Sources/MijiaCore/UserHabitMemory.swift:325— UserHabitMemory.record has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 14, loops 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnergyHistory.record (cognitive 45) windows/src/core/energyHistory.ts:454— EnergyHistory.record has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 9, loops 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.
panelView.renderPanel (cognitive 45) windows/src/ui/panelView.ts:19— panelView.renderPanel has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 40 (41 pts), boolean chains 4 (nesting depth added 1). Of this number, 39 points are the body's own statements and 6 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.
HomeStore.init (cognitive 44) Sources/MijiaCore/HomeStore.swift:869— HomeStore.init has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 15, ternaries 4 (6 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
percentScale.rawFromPercent (cognitive 44) windows/src/core/miCloud/percentScale.ts:55— percentScale.rawFromPercent has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 9 (22 pts), if/else 6 (16 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
activityStackView.executeAutomationCardUndo (cognitive 44) windows/src/ui/activityStackView.ts:772— activityStackView.executeAutomationCardUndo has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 16). Of this number, 41 points are the body's own statements and 3 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.
activityStackView.buildActivityFeed (cognitive 44) windows/src/ui/activityStackView.ts:1106— activityStackView.buildActivityFeed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 5 (10 pts), boolean chains 7, loops 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.
CameraLivePlayback.start (cognitive 43) Sources/MenuBarMijiaApp/CameraLivePlayback.swift:70— CameraLivePlayback.start has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 8, 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.
deviceViews.applianceOrGenericIcon (cognitive 42) windows/src/ui/deviceViews.ts:706— deviceViews.applianceOrGenericIcon has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22, boolean chains 20. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
menuViews.renderContextMenu (cognitive 42) windows/src/ui/menuViews.ts:88— menuViews.renderContextMenu has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 16 (24 pts), if/else 8 (12 pts), boolean chains 6 (nesting depth added 12). 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.
HomeStore.rebuildLiveProvider (cognitive 41) Sources/MijiaCore/HomeStore+Backend.swift:666— HomeStore.rebuildLiveProvider has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 15 (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.
UserHabitMemory.isActionable (cognitive 41) Sources/MijiaCore/UserHabitMemory.swift:949— UserHabitMemory.isActionable has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 15, match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.synthesize (cognitive 41) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:82— MiotSynthesizer.synthesize has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 7 (21 pts), if/else 5 (13 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
automationEngine.parseStoredRule (cognitive 41) windows/src/core/automationEngine.ts:417— automationEngine.parseStoredRule has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 20 (26 pts), boolean chains 10, if/else 5 (nesting depth added 6). Of this number, 40 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.
settingsEvents.commitSettingsSave (cognitive 41) REDACTED:567— settingsEvents.commitSettingsSave has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.confirmUndoTargets (cognitive 40) Sources/MijiaCore/HomeStore+Undo.swift:889— HomeStore.confirmUndoTargets has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 16, ternaries 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.buildMediaPlayerKind (cognitive 40) windows/src/core/haDomains.ts:515— haDomains.buildMediaPlayerKind has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 12, if/else 4 (7 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.
haDomains.buildSyntheticPrimaryHAFacets (cognitive 40) windows/src/core/haDomains.ts:802— haDomains.buildSyntheticPrimaryHAFacets has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 11, ternaries 3 (11 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
sensorHistory.extractMiHistoryRawNumbers (cognitive 40) windows/src/core/sensorHistory.ts:1002— sensorHistory.extractMiHistoryRawNumbers has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 8, ternaries 2 (4 pts), error handling 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeviceCardView.headerRow (cognitive 39) Sources/MenuBarMijiaApp/DeviceCardView.swift:538— DeviceCardView.headerRow has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 11 (16 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicControlCenterPanel.pageSections (cognitive 39) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:223— ClassicControlCenterPanel.pageSections has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 3 (9 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FragmentedMP4Demuxer.parseConfigRecord (cognitive 39) Sources/MijiaCore/FragmentedMP4Demuxer.swift:240— FragmentedMP4Demuxer.parseConfigRecord has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 4 (9 pts), match/switch 1 (nesting depth added 24). 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.
safetyAndHealth.evaluateSafetyFacetValue (cognitive 39) REDACTED:260— safetyAndHealth.evaluateSafetyFacetValue has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 3 (8 pts), boolean chains 7 (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.
intentExecution.executeIntents::runTargetBatch (cognitive 39) windows/src/ui/intentExecution.ts:515— intentExecution.executeIntents::runTargetBatch has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (intentExecution.executeIntents) 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.
roomOrderEditor.bindRoomOrderEditorEvents (cognitive 39) windows/src/ui/roomOrderEditor.ts:458— roomOrderEditor.bindRoomOrderEditorEvents has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22 (23 pts), boolean chains 8, ternaries 7 (8 pts) (nesting depth added 2). Most of this is not in the body itself: 8 of the 39 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 519, 472, 597, …). 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.
GrokBallRenderer.drawRibbons (cognitive 38) Sources/MenuBarMijiaApp/GrokBallRenderer.swift:92— GrokBallRenderer.drawRibbons has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 11 (21 pts), if/else 5 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAFacetEngine.control (cognitive 38) Sources/MijiaCore/HAFacets.swift:36— HAFacetEngine.control has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 8, match/switch 3 (5 pts), ternaries 3 (4 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LocalIntentParser.extractEnglishNumericOperations (cognitive 38) Sources/MijiaCore/LocalIntentParser.swift:1037— LocalIntentParser.extractEnglishNumericOperations has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 2 (8 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelIntentResolver.planFromSystemOne (cognitive 38) Sources/MijiaCore/ModelIntentResolver.swift:686— ModelIntentResolver.planFromSystemOne has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 9, loops 4 (9 pts), ternaries 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SmartDevice.hasDetailDrawer (cognitive 38) Sources/MijiaCore/Models.swift:1476— SmartDevice.hasDetailDrawer has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 37, 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.
MiotSynthesizer.buildSensor (cognitive 38) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1274— MiotSynthesizer.buildSensor has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 3 (12 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.mergeRoomPage (cognitive 38) windows/src/core/miCloud/client.ts:503— MiCloudClient.mergeRoomPage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 7 (13 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 16). Of this number, 28 points are the body's own statements and 10 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.
cameraHubs.resolveCameraHub (cognitive 38) windows/src/core/miCloud/cameraHubs.ts:117— cameraHubs.resolveCameraHub has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 7, ternaries 3 (5 pts) (nesting depth added 10). Of this number, 37 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.
activityStackView.bindActivityStackAfterRender (cognitive 38) windows/src/ui/activityStackView.ts:1674— activityStackView.bindActivityStackAfterRender has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 7 (nesting depth added 14). Of this number, 24 points are the body's own statements and 14 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.
MenuBarPanelController.showPanel (cognitive 37) Sources/MenuBarMijiaApp/MenuBarPanelController+Presentation.swift:32— MenuBarPanelController.showPanel has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 2 (10 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MiCloudProvider.runLoop (cognitive 37) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:208— MiCloudProvider.runLoop has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (20 pts), error handling 3 (6 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HabitShare.swift.shareHabitSentence (cognitive 37) Sources/MijiaCore/HabitShare.swift:37— HabitShare.swift.shareHabitSentence has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 11, 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.
haDomains.auxiliaryEntitiesForCover (cognitive 37) windows/src/core/haDomains.ts:675— haDomains.auxiliaryEntitiesForCover has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 7, loops 5 (6 pts), ternaries 1 (nesting depth added 11). 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.
habits.mentionedHabitTargets (cognitive 37) windows/src/core/assistant/habits.ts:898— habits.mentionedHabitTargets has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 11 (14 pts), boolean chains 2 (nesting depth added 13). Of this number, 29 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.
optimisticLock.runTrackedDevicePresetCommands (cognitive 37) windows/src/core/optimisticLock.ts:442— optimisticLock.runTrackedDevicePresetCommands has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (43 pts), ternaries 5 (15 pts), boolean chains 8, loops 2 (6 pts) (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (optimisticLock.runTrackedDevicePresetCommands::runSubsequent) 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.
optimisticLock.mergeHomeSnapshotRespectingLocks (cognitive 37) windows/src/core/optimisticLock.ts:659— optimisticLock.mergeHomeSnapshotRespectingLocks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 9, loops 3 (nesting depth added 11). Of this number, 33 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.
automationEngine.commandsForPowerIntent (cognitive 37) windows/src/core/automationEngine.ts:804— automationEngine.commandsForPowerIntent has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 13 (28 pts), if/else 3 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CredentialVault.deleteMiSession (cognitive 37) windows/src/core/secureStore.ts:470— CredentialVault.deleteMiSession has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 7 (12 pts), ternaries 1 (4 pts), boolean chains 2, error handling 2 (nesting depth added 17). None of this is in the body itself: all 37 points belong to one function literal inside it that branches (line 471). 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.
automationSettingsView.renderTriggerOptionsEditor (cognitive 37) windows/src/ui/automationSettingsView.ts:702— automationSettingsView.renderTriggerOptionsEditor has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 14 (29 pts), if/else 6, boolean chains 2 (nesting depth added 15). Of this number, 17 points are the body's own statements and 20 belong to 8 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.
sensorHistoryView.renderSensorHistorySection (cognitive 37) windows/src/ui/sensorHistoryView.ts:699— sensorHistoryView.renderSensorHistorySection has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 27 (31 pts), boolean chains 3, if/else 2, loops 1 (nesting depth added 4). Of this number, 28 points are the body's own statements and 9 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.
panelView.renderSliderDeck (cognitive 37) windows/src/ui/panelView.ts:443— panelView.renderSliderDeck has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 11 (27 pts), boolean chains 6, if/else 4 (nesting depth added 16). Of this number, 35 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.
deviceViews.renderCollapsedInlineSlider (cognitive 37) windows/src/ui/deviceViews.ts:1092— deviceViews.renderCollapsedInlineSlider has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 8 (12 pts), boolean chains 11 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
appLifecycle.hydrateCredentials (cognitive 37) windows/src/ui/appLifecycle.ts:92— appLifecycle.hydrateCredentials has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 7, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SensorCardView.chartPlot (cognitive 36) Sources/MenuBarMijiaApp/SensorCardView.swift:435— SensorCardView.chartPlot has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 4 (7 pts), loops 2 (6 pts), boolean chains 5, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicSensorCardView.chartPlot (cognitive 36) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:402— ClassicSensorCardView.chartPlot has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 4 (7 pts), loops 2 (6 pts), boolean chains 5, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SensorHistory.mergeCloudSamples (cognitive 36) Sources/MijiaCore/SensorHistory.swift:405— SensorHistory.mergeCloudSamples has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (5 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.parsePropValues (cognitive 36) windows/src/core/miCloud/client.ts:632— MiCloudClient.parsePropValues has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 9, ternaries 5 (9 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.mapHAFacetCommand (cognitive 36) windows/src/core/haDomains.ts:1142— haDomains.mapHAFacetCommand has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 5 (7 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 12). Of this number, 26 points are the body's own statements and 10 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.
dualSourceProvider.reconcilePairedHALightGroups (cognitive 36) windows/src/core/dualSourceProvider.ts:485— dualSourceProvider.reconcilePairedHALightGroups has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 15). Of this number, 35 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.
deviceViews.renderSensorCard (cognitive 36) windows/src/ui/deviceViews.ts:21— deviceViews.renderSensorCard has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 23 (31 pts), boolean chains 3, if/else 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MenuMijiaWindowsApp.renderDeviceGrid (cognitive 36) windows/src/ui/app.ts:1275— MenuMijiaWindowsApp.renderDeviceGrid has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 11 (21 pts), boolean chains 8, if/else 6 (7 pts) (nesting depth added 11). Of this number, 23 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.
CameraLivePanelController.present (cognitive 35) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:314— CameraLivePanelController.present has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 9, ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.executeRaycastPower (cognitive 35) Sources/MijiaCore/RaycastControls.swift:393— HomeStore.executeRaycastPower has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 10 (12 pts), boolean chains 10 (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.
ApplianceActivity.init (cognitive 35) Sources/MijiaCore/Models.swift:829— ApplianceActivity.init has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (23 pts), boolean chains 11, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiCloudProvider.pollDoorbellEvents (cognitive 35) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:781— MiCloudProvider.pollDoorbellEvents has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (27 pts), error handling 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MiCloudProvider.execute (cognitive 35) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:983— MiCloudProvider.execute has cognitive complexity 35 (threshold 15). Drivers by points: error handling 7 (14 pts), if/else 7 (11 pts), match/switch 2 (6 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelIntentResolver.extractBalancedJSONObject (cognitive 35) windows/src/core/assistant/modelIntentResolver.ts:590— modelIntentResolver.extractBalancedJSONObject has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (29 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
safetyAndHealth.extractSensorObservations (cognitive 35) REDACTED:303— safetyAndHealth.extractSensorObservations has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 13). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dualSourceProvider.readTuplePairs (cognitive 35) windows/src/core/dualSourceProvider.ts:141— dualSourceProvider.readTuplePairs has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (20 pts), if/else 5 (10 pts), boolean chains 4, 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.
ClassicDeviceCardView.compactHeaderRow (cognitive 34) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360— ClassicDeviceCardView.compactHeaderRow has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 7, boolean chains 5 (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.
CameraPTZDragPlanner.direction (cognitive 34) Sources/MijiaCore/CameraPTZ.swift:286— CameraPTZDragPlanner.direction has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 6 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
speakerActions.findDirectiveAction (cognitive 34) windows/src/core/miCloud/speakerActions.ts:82— speakerActions.findDirectiveAction has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 6 (9 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
facetViews.row (cognitive 34) windows/src/ui/facetViews.ts:223— facetViews.row has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 14 (23 pts), boolean chains 7, if/else 4 (nesting depth added 9). Of this number, 25 points are the body's own statements and 9 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.
ApplianceDetailDrawer.body (cognitive 33) Sources/MenuBarMijiaApp/ApplianceDetailDrawer.swift:15— ApplianceDetailDrawer.body has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 11, ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GrokBallAnimator.sample (cognitive 33) Sources/MenuBarMijiaApp/GrokBallView.swift:207— GrokBallAnimator.sample has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 7, match/switch 2 (4 pts), ternaries 4, loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IntentDeviceCategory.init (cognitive 33) Sources/MijiaCore/CommandIntent.swift:261— IntentDeviceCategory.init has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 18, if/else 7 (10 pts), ternaries 2 (4 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
IntentCatalog.init (cognitive 33) Sources/MijiaCore/CommandIntent.swift:607— IntentCatalog.init has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 1 (4 pts), loops 3, boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeviceSynthesizer.auxiliaryEntities (cognitive 33) Sources/MijiaCore/DeviceSynthesizer.swift:701— DeviceSynthesizer.auxiliaryEntities has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 12, loops 1 (nesting depth added 8). Of this number, 18 points are the body's own statements and 15 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.
EnergyHistory.record (cognitive 33) Sources/MijiaCore/EnergyHistory.swift:117— EnergyHistory.record has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 7, 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.
HADiscovery.parseMDNSZoneOutput (cognitive 33) Sources/MijiaCore/HADiscovery.swift:237— HADiscovery.parseMDNSZoneOutput has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAWebSocketProvider.runReceiveLoop (cognitive 33) Sources/MijiaCore/HomeProvider.swift:576— HAWebSocketProvider.runReceiveLoop has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 2 (5 pts), boolean chains 2, error handling 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OfflineHistory.record (cognitive 33) REDACTED:798— OfflineHistory.record has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 2, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiAccountsStore.loadUnlocked (cognitive 33) windows/src/core/miAccountsStore.ts:385— MiAccountsStore.loadUnlocked has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 7, loops 3, error handling 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PanelRenderPipeline.patchPopover (cognitive 33) windows/src/ui/reconciler.ts:1088— PanelRenderPipeline.patchPopover has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, loops 2 (4 pts), ternaries 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.
DeviceCardView.fanDrawer (cognitive 32) Sources/MenuBarMijiaApp/DeviceCardView.swift:905— DeviceCardView.fanDrawer has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 11 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StatusItemEventDecision.decide (cognitive 32) Sources/MenuBarMijiaApp/StatusItemEventDecision.swift:42— StatusItemEventDecision.decide has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 4, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ClassicDeviceCardView.fanDrawer (cognitive 32) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938— ClassicDeviceCardView.fanDrawer has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 11 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CdpSession.constructor (cognitive 32) windows/scripts/verify-flyout-layout.mjs:215— CdpSession.constructor has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, loops 3 (4 pts), error handling 1 (3 pts), ternaries 2 (nesting depth added 10). None of this is in the body itself: all 32 points belong to 3 function items inside it that branch (a function literal at line 238, failAll, a function literal at line 237). 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.
haDomains.resolveHACameraMotionFallback (cognitive 32) windows/src/core/haDomains.ts:920— haDomains.resolveHACameraMotionFallback has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 9, ternaries 3 (5 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sensorHistory.extractSensorLiveMetrics (cognitive 32) windows/src/core/sensorHistory.ts:431— sensorHistory.extractSensorLiveMetrics has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sensorHistory.resolveMiotSensorPropertyKeys (cognitive 32) windows/src/core/sensorHistory.ts:951— sensorHistory.resolveMiotSensorPropertyKeys has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 7, loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
detailDrawers.renderApplianceDrawer (cognitive 32) windows/src/ui/detailDrawers.ts:126— detailDrawers.renderApplianceDrawer has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 12 (13 pts), boolean chains 5 (nesting depth added 8). Of this number, 27 points are the body's own statements and 5 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.
detailDrawers.updateLiveSliderReadout (cognitive 32) windows/src/ui/detailDrawers.ts:469— detailDrawers.updateLiveSliderReadout has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 6 (12 pts), boolean chains 3 (nesting depth added 10). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpeechInputController.start (cognitive 31) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:150— SpeechInputController.start has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 10, 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.
DeviceCardView.contextMenuItems (cognitive 31) Sources/MenuBarMijiaApp/DeviceCardView.swift:246— DeviceCardView.contextMenuItems has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (21 pts), ternaries 6 (8 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DeviceDeduplicator.reconcilePairedHALightGroups (cognitive 31) Sources/MijiaCore/DeviceDeduplicator.swift:525— DeviceDeduplicator.reconcilePairedHALightGroups has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 10, loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiAccountsProvider.updateAccounts (cognitive 31) Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:216— MiAccountsProvider.updateAccounts has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 8 (9 pts), boolean chains 8 (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.
ModelIntentResolver.decodeChatOp (cognitive 31) windows/src/core/assistant/modelIntentResolver.ts:498— ModelIntentResolver.decodeChatOp has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (24 pts), if/else 5 (6 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
safetyAndHealth.buildWeeklyHealthReport (cognitive 31) REDACTED:1141— safetyAndHealth.buildWeeklyHealthReport has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 5 (8 pts), boolean chains 7, loops 4 (nesting depth added 8). Of this number, 26 points are the body's own statements and 5 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.
appLifecycle.bindGlobalKeys::onKeyDown (cognitive 31) windows/src/ui/appLifecycle.ts:964— appLifecycle.bindGlobalKeys::onKeyDown has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicDeviceCardView.contextMenuItems (cognitive 30) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190— ClassicDeviceCardView.contextMenuItems has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 6 (8 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ModelIntentResolver.extractBalancedJSONObject (cognitive 30) Sources/MijiaCore/ModelIntentResolver.swift:1082— ModelIntentResolver.extractBalancedJSONObject has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.genericApplianceStatusText (cognitive 30) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1531— MiotSynthesizer.genericApplianceStatusText has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 20, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UserHabitMemory.unrecord (cognitive 30) windows/src/core/assistant/habits.ts:470— UserHabitMemory.unrecord has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 9). Of this number, 28 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.
sensorHistory.parseMiCloudHistoryPoints (cognitive 30) windows/src/core/sensorHistory.ts:1067— sensorHistory.parseMiCloudHistoryPoints has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
activityStackView.pruneOrphanedDeviceActivities (cognitive 30) windows/src/ui/activityStackView.ts:325— activityStackView.pruneOrphanedDeviceActivities has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 5, ternaries 2 (5 pts), loops 2 (nesting depth added 9). 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.
activityStackView.tickSafetyHealthAndAutomation (cognitive 30) windows/src/ui/activityStackView.ts:1008— activityStackView.tickSafetyHealthAndAutomation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 9 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.
activityStackView.dismissActivityById (cognitive 30) windows/src/ui/activityStackView.ts:1541— activityStackView.dismissActivityById has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AssistantResponseArea.body (cognitive 29) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:334— AssistantResponseArea.body has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 9, ternaries 4 (8 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CameraLiveVideoPlayer.enqueue (cognitive 29) Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:261— CameraLiveVideoPlayer.enqueue has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 8, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ControlCenterPanel.emptyStateView (cognitive 29) Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:442— ControlCenterPanel.emptyStateView has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 7 (9 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConnectionSettingsTab.body (cognitive 29) Sources/MenuBarMijiaApp/SettingsWindowView.swift:1065— ConnectionSettingsTab.body has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 3 (5 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.
ClassicControlCenterPanel.emptyStateView (cognitive 29) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810— ClassicControlCenterPanel.emptyStateView has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 7 (9 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UserHabitMemory.unrecord (cognitive 29) Sources/MijiaCore/UserHabitMemory.swift:510— UserHabitMemory.unrecord has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, loops 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.cachedExtendedKind (cognitive 29) windows/src/core/haDomains.ts:1338— haDomains.cachedExtendedKind has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (24 pts), boolean chains 2, if/else 1 (2 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
cloudRefresh.refreshHADevices (cognitive 29) REDACTED:369— cloudRefresh.refreshHADevices has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 11, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CameraLivePanelView.viewportContent (cognitive 28) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:1899— CameraLivePanelView.viewportContent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.syncManualSessionFieldLocks (cognitive 28) Sources/MijiaCore/HomeStore+ControlWrite.swift:360— HomeStore.syncManualSessionFieldLocks has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.confirmToggleReadBack (cognitive 28) Sources/MijiaCore/HomeStore+Controls.swift:339— HomeStore.confirmToggleReadBack has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.startUpdateInstallation (cognitive 28) Sources/MijiaCore/HomeStore+Update.swift:88— HomeStore.startUpdateInstallation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 3, error handling 2, match/switch 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.
DiagnosticsReportBuilder.markdown (cognitive 28) Sources/MijiaCore/UnsupportedDeviceCollector.swift:285— DiagnosticsReportBuilder.markdown has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 2 (6 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.
MiAccountLogin.parseSetCookieExpiry (cognitive 28) Sources/MijiaCore/MiCloud/MiAccountLogin.swift:263— MiAccountLogin.parseSetCookieExpiry has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
verify-flyout-layout.runLaunchChromeStartupSelfTest (cognitive 28) windows/scripts/verify-flyout-layout.mjs:496— verify-flyout-layout.runLaunchChromeStartupSelfTest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12, error handling 5 (6 pts), boolean chains 5, ternaries 3 (5 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.
habits.habitActionable (cognitive 28) windows/src/core/assistant/habits.ts:227— habits.habitActionable has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 19, if/else 5 (8 pts), match/switch 1 (nesting depth added 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.
synthesis.applianceActivity (cognitive 28) windows/src/core/miCloud/synthesis.ts:383— synthesis.applianceActivity has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19, boolean chains 6, ternaries 1 (2 pts), match/switch 1 (nesting depth added 1). 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: 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.
sensorHistory.resolveHomeAssistantSensorEntityIds (cognitive 28) windows/src/core/sensorHistory.ts:1371— sensorHistory.resolveHomeAssistantSensorEntityIds has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, loops 2 (3 pts), ternaries 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.
MultiAccountMiCloudProvider.execute (cognitive 28) windows/src/core/miAccountsStore.ts:1351— MultiAccountMiCloudProvider.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 2 (4 pts), ternaries 3 (4 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
miAccountsStore.refreshMiAccountsConcurrently::refreshOne (cognitive 28) windows/src/core/miAccountsStore.ts:1098— miAccountsStore.refreshMiAccountsConcurrently::refreshOne has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 8, ternaries 5 (8 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResumeRecoveryController.flush (cognitive 28) windows/src/ui/appLifecycle.ts:721— ResumeRecoveryController.flush has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (14 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuMijiaWindowsApp.bindOpenAnimation (cognitive 28) windows/src/ui/app.ts:1561— MenuMijiaWindowsApp.bindOpenAnimation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 6, ternaries 2 (nesting depth added 3). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 1678, normalizeEdge, scrollActiveRoomIntoView, …). 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.
activityStackView.partitionUndoStepsByHighRiskConfirmation (cognitive 28) windows/src/ui/activityStackView.ts:709— activityStackView.partitionUndoStepsByHighRiskConfirmation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 4 (8 pts), boolean chains 3, 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.
CameraLivePanelController.startMJPEGStream (cognitive 27) Sources/MenuBarMijiaApp/CameraLivePanelController.swift:991— CameraLivePanelController.startMJPEGStream has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 6, 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.
DeviceCardView.compactHeaderRow (cognitive 27) Sources/MenuBarMijiaApp/DeviceCardView.swift:424— DeviceCardView.compactHeaderRow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 7, boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SystemActivityMonitor.apply (cognitive 27) Sources/MenuBarMijiaApp/SystemActivityMonitor.swift:121— SystemActivityMonitor.apply has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 8, loops 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FragmentedMP4Demuxer.append (cognitive 27) Sources/MijiaCore/FragmentedMP4Demuxer.swift:67— FragmentedMP4Demuxer.append has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.executeCoverPosition (cognitive 27) Sources/MijiaCore/RaycastControls.swift:267— HomeStore.executeCoverPosition has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DeviceKind.acceptsControlWrites (cognitive 27) Sources/MijiaCore/Models.swift:1268— DeviceKind.acceptsControlWrites has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 26, 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.
SmartDevice.environmentReading (cognitive 27) Sources/MijiaCore/Models.swift:1523— SmartDevice.environmentReading has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 5 (10 pts), boolean chains 4, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiAccountsProvider.publishSnapshot (cognitive 27) Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:451— MiAccountsProvider.publishSnapshot has cognitive complexity 27 (threshold 15). Drivers by points: loops 8 (15 pts), if/else 3 (7 pts), boolean chains 5 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
miotFacetText.facetValue (cognitive 27) windows/src/core/miotFacetText.ts:205— miotFacetText.facetValue has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
appUrlCommand.resolveTarget (cognitive 27) REDACTED:468— appUrlCommand.resolveTarget has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 12). Of this number, 24 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
CredentialVault.loadInternal (cognitive 27) windows/src/core/secureStore.ts:277— CredentialVault.loadInternal has cognitive complexity 27 (threshold 15). Drivers by points: error handling 3 (10 pts), if/else 5 (9 pts), ternaries 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sensorHistoryView.triggerRemoteHistoryFetchIfNeeded (cognitive 27) windows/src/ui/sensorHistoryView.ts:423— sensorHistoryView.triggerRemoteHistoryFetchIfNeeded has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, ternaries 2 (3 pts) (nesting depth added 6). Of this number, 17 points are the body's own statements and 10 belong 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.
CameraLiveController.commitCameraStreamUrl (cognitive 27) windows/src/ui/cameraLive.ts:1220— CameraLiveController.commitCameraStreamUrl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 9, 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.
detailDrawers.renderCoverDrawer (cognitive 27) windows/src/ui/detailDrawers.ts:267— detailDrawers.renderCoverDrawer has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 8, 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.
SensorCardView.body (cognitive 26) Sources/MenuBarMijiaApp/SensorCardView.swift:51— SensorCardView.body has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 8, if/else 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IntentReply.describe (cognitive 26) Sources/MijiaCore/CommandIntent.swift:470— IntentReply.describe has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (16 pts), if/else 4 (6 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FragmentedMP4Demuxer.findVisualSampleEntry (cognitive 26) Sources/MijiaCore/FragmentedMP4Demuxer.swift:208— FragmentedMP4Demuxer.findVisualSampleEntry has cognitive complexity 26 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (8 pts), match/switch 1 (4 pts), ternaries 1 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HADiscovery.isAllowedLANDiscoveryHost (cognitive 26) Sources/MijiaCore/HADiscovery.swift:575— HADiscovery.isAllowedLANDiscoveryHost has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 19, if/else 6, loops 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MiCloudClient.decodeResponse (cognitive 26) Sources/MijiaCore/MiCloud/MiCloudClient.swift:316— MiCloudClient.decodeResponse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudDiscovery.homeFallback (cognitive 26) Sources/MijiaCore/MiCloud/MiCloudDiscovery.swift:110— MiCloudDiscovery.homeFallback has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (5 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.facetProps (cognitive 26) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:215— MiotSynthesizer.facetProps has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.buildCoverKind (cognitive 26) windows/src/core/haDomains.ts:208— haDomains.buildCoverKind has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 17 (24 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.buildHAFacets (cognitive 26) windows/src/core/haDomains.ts:958— haDomains.buildHAFacets has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
habits.decodeHabitOperation (cognitive 26) windows/src/core/assistant/habits.ts:207— habits.decodeHabitOperation has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (24 pts), if/else 1, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
speakerActions.findTtsAction (cognitive 26) windows/src/core/miCloud/speakerActions.ts:50— speakerActions.findTtsAction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
safetyAndHealth.evaluateSensorAlerts (cognitive 26) REDACTED:396— safetyAndHealth.evaluateSensorAlerts has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 3 (8 pts), boolean chains 7, if/else 3 (7 pts), loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settingsViews.renderGeneralPanel (cognitive 26) windows/src/ui/settingsViews.ts:324— settingsViews.renderGeneralPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 20 (23 pts), boolean chains 3 (nesting depth added 3). Of this number, 21 points are the body's own statements and 5 belong to 5 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.
sensorHistoryView.computePlotGeometry (cognitive 26) windows/src/ui/sensorHistoryView.ts:598— sensorHistoryView.computePlotGeometry has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 5 (6 pts), boolean chains 5, loops 1 (nesting depth added 6). Of this number, 22 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.
sensorHistoryView.bindSensorHistoryEvents (cognitive 26) windows/src/ui/sensorHistoryView.ts:936— sensorHistoryView.bindSensorHistoryEvents has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20, boolean chains 6. None of this is in the body itself: all 26 points belong to 12 function literals inside it that branch (lines 956, 983, 1002, …). 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.
GrokBallSidecarController.handlePointer (cognitive 25) Sources/MenuBarMijiaApp/GrokBallSidecarController.swift:266— GrokBallSidecarController.handlePointer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 3 (5 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MenuBarStatusSummary.text (cognitive 25) Sources/MenuBarMijiaApp/MenuBarMijiaApp.swift:107— MenuBarStatusSummary.text has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 3 (9 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
URLCommandHandler.resolve (cognitive 25) Sources/MenuBarMijiaApp/URLCommandHandler.swift:154— URLCommandHandler.resolve has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
HomeStore.revert (cognitive 25) Sources/MijiaCore/HomeStore+ControlWrite.swift:774— HomeStore.revert has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.executeRaycastDirectCommand (cognitive 25) Sources/MijiaCore/RaycastControls.swift:15— HomeStore.executeRaycastDirectCommand has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, boolean chains 11. 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.
LGWebOSClient.handleIncomingMessage (cognitive 25) Sources/MijiaCore/LGWebOSClient.swift:743— LGWebOSClient.handleIncomingMessage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, loops 2 (4 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SafetyMonitor.evaluate (cognitive 25) Sources/MijiaCore/SafetyMonitor.swift:36— SafetyMonitor.evaluate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, match/switch 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.extractRawNumbers (cognitive 25) Sources/MijiaCore/MiCloud/MiCloudClient.swift:1110— MiCloudClient.extractRawNumbers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 10, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MiCloudProvider.extractStreamURL (cognitive 25) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1403— MiCloudProvider.extractStreamURL has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
models.hasDetailDrawer (cognitive 25) windows/src/core/models.ts:632— models.hasDetailDrawer has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 23, if/else 1, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
facets.buildMiotFacets (cognitive 25) windows/src/core/miCloud/facets.ts:173— facets.buildMiotFacets has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
speakerActions.coerceSilentExecutionArg (cognitive 25) windows/src/core/miCloud/speakerActions.ts:165— speakerActions.coerceSilentExecutionArg has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, ternaries 3 (5 pts) (nesting depth added 6). Of this number, 21 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.
synthesis.primaryMiotService (cognitive 25) windows/src/core/miCloud/synthesis.ts:710— synthesis.primaryMiotService has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 8). Of this number, 22 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.
promptContext.buildIntentCatalog (cognitive 25) windows/src/core/assistant/promptContext.ts:204— promptContext.buildIntentCatalog has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 3, loops 2 (nesting depth added 8). Of this number, 24 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.
appUrlCommand.runIntentOnDevice (cognitive 25) REDACTED:639— appUrlCommand.runIntentOnDevice has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 11). Of this number, 24 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.
homeAssistant.cachedKind (cognitive 25) windows/src/core/homeAssistant.ts:302— homeAssistant.cachedKind has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (22 pts), boolean chains 2, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
HomeStore.beginOptimisticWrite (cognitive 24) Sources/MijiaCore/HomeStore+ControlWrite.swift:651— HomeStore.beginOptimisticWrite has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
LocalIntentParser.parse (cognitive 24) Sources/MijiaCore/LocalIntentParser.swift:126— LocalIntentParser.parse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalIntentParser.extractNumericOperations (cognitive 24) Sources/MijiaCore/LocalIntentParser.swift:686— LocalIntentParser.extractNumericOperations has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.interpretedLockStatus (cognitive 24) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1379— MiotSynthesizer.interpretedLockStatus has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 18, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
intent.extractEnglishNumericOps (cognitive 24) windows/src/core/assistant/intent.ts:1064— intent.extractEnglishNumericOps has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (6 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
habits.listReadableHabits (cognitive 24) windows/src/core/assistant/habits.ts:1043— habits.listReadableHabits has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (16 pts), if/else 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OfflineHistory.trim (cognitive 24) REDACTED:911— OfflineHistory.trim has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (6 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sensorHistory.querySingleMiMetricSeries (cognitive 24) windows/src/core/sensorHistory.ts:1166— sensorHistory.querySingleMiMetricSeries has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (8 pts), loops 3 (4 pts), error handling 1 (nesting depth added 10). Of this number, 14 points are the body's own statements and 10 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.
AutomationEngine.evaluateSensorThresholdRules (cognitive 24) windows/src/core/automationEngine.ts:1323— AutomationEngine.evaluateSensorThresholdRules has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
speechGuard.bindCompanionAndUpdaterEvents (cognitive 24) windows/src/ui/speechGuard.ts:1258— speechGuard.bindCompanionAndUpdaterEvents has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, ternaries 2, loops 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1268, 1305, 1260). 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.
settingsViews.renderUpdateSection (cognitive 24) windows/src/ui/settingsViews.ts:1032— settingsViews.renderUpdateSection has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14 (23 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.
proactive.maybeRefreshProactiveInBackground (cognitive 24) windows/src/ui/proactive.ts:202— proactive.maybeRefreshProactiveInBackground has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, ternaries 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 10 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, 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.
detailDrawers.renderPlugDrawer (cognitive 24) windows/src/ui/detailDrawers.ts:342— detailDrawers.renderPlugDrawer has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 6 (9 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.
deviceViews.renderSmallDeviceTile (cognitive 24) windows/src/ui/deviceViews.ts:1200— deviceViews.renderSmallDeviceTile has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14 (20 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HotkeyAndNotificationManager.setupLocalKeyboardMonitors (cognitive 23) Sources/MenuBarMijiaApp/HotkeyAndNotificationManager.swift:273— HotkeyAndNotificationManager.setupLocalKeyboardMonitors has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReleaseNotesDigest.plainFallback (cognitive 23) Sources/MenuBarMijiaApp/UpdateSection.swift:392— ReleaseNotesDigest.plainFallback has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicClimatePanelModule.strip (cognitive 23) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:89— ClassicClimatePanelModule.strip has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 7 (9 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.
VideoNALUnits.annexBToLengthPrefixed (cognitive 23) Sources/MijiaCore/FragmentedMP4Demuxer.swift:488— VideoNALUnits.annexBToLengthPrefixed has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (6 pts), ternaries 2 (5 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.menuBarText (cognitive 23) Sources/MijiaCore/HomeStore+Metrics.swift:161— HomeStore.menuBarText has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, ternaries 2 (4 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalIntentParser.bareCategoryOutcome (cognitive 23) Sources/MijiaCore/LocalIntentParser.swift:411— LocalIntentParser.bareCategoryOutcome has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts), match/switch 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.
SensorHistory.points (cognitive 23) Sources/MijiaCore/SensorHistory.swift:513— SensorHistory.points has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
facets.propertyFacet (cognitive 23) windows/src/core/miCloud/facets.ts:270— facets.propertyFacet has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 7 (10 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.
deviceCategory.deviceCategory (cognitive 23) windows/src/core/assistant/deviceCategory.ts:246— deviceCategory.deviceCategory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
appUrlCommand.executeDirectAskPreset::runDirectCover (cognitive 23) REDACTED:886— appUrlCommand.executeDirectAskPreset::runDirectCover has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 5 (7 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (appUrlCommand.executeDirectAskPreset) 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.
SensorHistoryStore.mergeCloudSamples (cognitive 23) windows/src/core/sensorHistory.ts:627— SensorHistoryStore.mergeCloudSamples has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 3 (4 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EnergyHistory.deviceTotals (cognitive 23) windows/src/core/energyHistory.ts:667— EnergyHistory.deviceTotals has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 4 (5 pts), ternaries 2 (nesting depth added 6). Of this number, 20 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.
speechGuard.executeBuiltInQuickAction (cognitive 23) windows/src/ui/speechGuard.ts:592— speechGuard.executeBuiltInQuickAction has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 2, boolean chains 1, ternaries 1 (nesting depth added 7). Of this number, 17 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.
automationSettingsView.summarizeRuleDetails (cognitive 23) windows/src/ui/automationSettingsView.ts:598— automationSettingsView.summarizeRuleDetails has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10, ternaries 3 (7 pts), boolean chains 6 (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.
sensorHistoryView.syncSensorHistoryHost (cognitive 23) windows/src/ui/sensorHistoryView.ts:525— sensorHistoryView.syncSensorHistoryHost has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
detailDrawers.bindSpeakerCommandBars::submitSpeakerInput (cognitive 23) windows/src/ui/detailDrawers.ts:1207— detailDrawers.bindSpeakerCommandBars::submitSpeakerInput has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, ternaries 3, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CameraLivePanelController.ptzDragMoved (cognitive 22) Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:76— CameraLivePanelController.ptzDragMoved has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicControlCenterPanel.mainDashboard (cognitive 22) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:306— ClassicControlCenterPanel.mainDashboard has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAWebSocketProvider.runConnectionLoop (cognitive 22) Sources/MijiaCore/HomeProvider.swift:392— HAWebSocketProvider.runConnectionLoop has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.turnAllOff (cognitive 22) Sources/MijiaCore/HomeStore+Undo.swift:423— HomeStore.turnAllOff has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
HomeStore.buildQuickActionItems (cognitive 22) Sources/MijiaCore/RaycastSnapshot.swift:766— HomeStore.buildQuickActionItems has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 8, ternaries 4, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelActionPolicy.decide (cognitive 22) Sources/MijiaCore/ModelActionPolicy.swift:124— ModelActionPolicy.decide has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (6 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SensorBucketRecord.addSample (cognitive 22) Sources/MijiaCore/SensorHistory.swift:147— SensorBucketRecord.addSample has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 10 (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.
SensorHistory.migrateUnscopedEntriesIfNeeded (cognitive 22) Sources/MijiaCore/SensorHistory.swift:308— SensorHistory.migrateUnscopedEntriesIfNeeded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 5 (9 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.
UpdateManifest.parse (cognitive 22) Sources/MijiaCore/UpdateManifest.swift:110— UpdateManifest.parse has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, if/else 3 (4 pts), 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.
LocalMiIOClient.sendOnce (cognitive 22) Sources/MijiaCore/MiCloud/LocalMiIOClient.swift:554— LocalMiIOClient.sendOnce has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, 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.
MiCloudClient.fetchMetricSeries (cognitive 22) Sources/MijiaCore/MiCloud/MiCloudClient.swift:903— MiCloudClient.fetchMetricSeries has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 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.
MiotFacetEngine.facets (cognitive 22) Sources/MijiaCore/MiCloud/MiotFacets.swift:284— MiotFacetEngine.facets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models.deviceEnvironmentReading (cognitive 22) windows/src/core/models.ts:893— models.deviceEnvironmentReading has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 10, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
speakerActions.mapSpeakerActionInputs (cognitive 22) windows/src/core/miCloud/speakerActions.ts:210— speakerActions.mapSpeakerActionInputs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
modelIntentResolver.proactiveSuggestionsFromSystemOne (cognitive 22) windows/src/core/assistant/modelIntentResolver.ts:667— modelIntentResolver.proactiveSuggestionsFromSystemOne has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (5 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.
sensorHistory.sanitizeStoredBucket (cognitive 22) windows/src/core/sensorHistory.ts:323— sensorHistory.sanitizeStoredBucket has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 5 (7 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scheduledCommands.parseOperation (cognitive 22) windows/src/core/scheduledCommands.ts:45— scheduledCommands.parseOperation has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (20 pts), if/else 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CameraLiveController.pumpAuthenticatedMjpeg (cognitive 22) windows/src/ui/cameraLive.ts:642— CameraLiveController.pumpAuthenticatedMjpeg has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
activityStackView.dispatchDesktopNotification (cognitive 22) windows/src/ui/activityStackView.ts:389— activityStackView.dispatchDesktopNotification has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 4 (9 pts), boolean chains 2, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnboardingGuideView.step1ConnectionCard (cognitive 21) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:225— OnboardingGuideView.step1ConnectionCard has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicGlass.body (cognitive 21) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:466— ClassicGlass.body has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 6 (10 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicControlCenterPanel.tileDragGesture (cognitive 21) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:485— ClassicControlCenterPanel.tileDragGesture has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IntentCatalog.text (cognitive 21) Sources/MijiaCore/CommandIntent.swift:752— IntentCatalog.text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 4, boolean chains 2, 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.
DualSourceHomeProvider.handle (cognitive 21) Sources/MijiaCore/DualSourceHomeProvider.swift:156— DualSourceHomeProvider.handle has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HADiscovery.unescapeDNSSD (cognitive 21) Sources/MijiaCore/HADiscovery.swift:100— HADiscovery.unescapeDNSSD has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.optimisticLockUntil (cognitive 21) Sources/MijiaCore/HomeStore.swift:814— HomeStore.optimisticLockUntil has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.apply (cognitive 21) Sources/MijiaCore/HomeStore+Assistant.swift:1048— HomeStore.apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.reconcileManualWriteSessionWithSnapshot (cognitive 21) Sources/MijiaCore/HomeStore+ControlWrite.swift:461— HomeStore.reconcileManualWriteSessionWithSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 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.
UnsupportedDeviceCollector.homeAssistant (cognitive 21) Sources/MijiaCore/UnsupportedDeviceCollector.swift:89— UnsupportedDeviceCollector.homeAssistant has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.parseLatestEventTimestamp (cognitive 21) Sources/MijiaCore/MiCloud/MiCloudClient.swift:1263— MiCloudClient.parseLatestEventTimestamp has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.primary (cognitive 21) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:525— MiotSynthesizer.primary has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
homeAssistant.homeAssistantIdentity (cognitive 21) windows/src/core/homeAssistant.ts:338— homeAssistant.homeAssistantIdentity has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, ternaries 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.
miAccountsStore.readAccountIndex (cognitive 21) windows/src/core/miAccountsStore.ts:299— miAccountsStore.readAccountIndex has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
energySettingsView.renderEnergySettingsSection (cognitive 21) windows/src/ui/energySettingsView.ts:425— energySettingsView.renderEnergySettingsSection has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 14 (15 pts), boolean chains 4, if/else 2 (nesting depth added 1). 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: 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.
sensorHistoryView.metricComfortBadge (cognitive 21) windows/src/ui/sensorHistoryView.ts:205— sensorHistoryView.metricComfortBadge has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
roomOrderEditor.renderRoomOrderEditorModal (cognitive 21) windows/src/ui/roomOrderEditor.ts:275— roomOrderEditor.renderRoomOrderEditorModal has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 2, if/else 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 297, 346). 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.
detailDrawers.bindCollapsedInlineSliders (cognitive 21) windows/src/ui/detailDrawers.ts:885— detailDrawers.bindCollapsedInlineSliders has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 10 (nesting depth added 1). None of this is in the body itself: all 21 points belong to 3 function literals inside it that branch (lines 925, 905, 927). 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.
settingsEvents.probeAssistantConnection (cognitive 21) REDACTED:258— settingsEvents.probeAssistantConnection has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 3 (4 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
activityStackView.doesUndoStepActivateHighRiskDevice (cognitive 21) windows/src/ui/activityStackView.ts:671— activityStackView.doesUndoStepActivateHighRiskDevice has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), ternaries 2 (4 pts), match/switch 1 (nesting depth added 5). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 682). 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.
ControlCenterPanel.deviceCollectionView (cognitive 20) Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:675— ControlCenterPanel.deviceCollectionView has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 5 (6 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DeviceCardView.cardBody (cognitive 20) Sources/MenuBarMijiaApp/DeviceCardView.swift:186— DeviceCardView.cardBody has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 5, if/else 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HADiscovery.parseTXTRecordTokens (cognitive 20) Sources/MijiaCore/HADiscovery.swift:139— HADiscovery.parseTXTRecordTokens has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PanelHealthResolver.resolve (cognitive 20) Sources/MijiaCore/HomeStore+Backend.swift:1375— PanelHealthResolver.resolve has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 1 (2 pts), match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
HomeStore.runUndoCommands (cognitive 20) Sources/MijiaCore/HomeStore+Undo.swift:967— HomeStore.runUndoCommands has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.performUpdateCheck (cognitive 20) Sources/MijiaCore/HomeStore+Update.swift:40— HomeStore.performUpdateCheck has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 2, 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.
HomeStore.exportRaycastSnapshotIfNeeded (cognitive 20) Sources/MijiaCore/RaycastSnapshot.swift:666— HomeStore.exportRaycastSnapshotIfNeeded has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LGWebOSProtocol.friendlySourceName (cognitive 20) Sources/MijiaCore/LGWebOSClient.swift:240— LGWebOSProtocol.friendlySourceName has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CoverSubtype.init (cognitive 20) Sources/MijiaCore/Models.swift:580— CoverSubtype.init has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 7, match/switch 1 (2 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.
SensorHistory.record (cognitive 20) Sources/MijiaCore/SensorHistory.swift:358— SensorHistory.record has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 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.
BoundedHTTPStreamDelegate.urlSession (cognitive 20) Sources/MijiaCore/UpdateChecker.swift:1501— BoundedHTTPStreamDelegate.urlSession has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 1 (3 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotFacetEngine.controls (cognitive 20) Sources/MijiaCore/MiCloud/MiotFacets.swift:553— MiotFacetEngine.controls has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.buildClimate (cognitive 20) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:622— MiotSynthesizer.buildClimate has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 3 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.decodeResponse (cognitive 20) windows/src/core/miCloud/client.ts:196— MiCloudClient.decodeResponse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.parseDeviceRecord (cognitive 20) windows/src/core/miCloud/client.ts:269— MiCloudClient.parseDeviceRecord has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12, boolean chains 6, if/else 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
chineseIntentTables.spokenChineseNumber (cognitive 20) windows/src/core/assistant/chineseIntentTables.ts:195— chineseIntentTables.spokenChineseNumber has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (8 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cameraHubs.extractRecordParentDid (cognitive 20) windows/src/core/miCloud/cameraHubs.ts:49— cameraHubs.extractRecordParentDid has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scheduledCommands.parseQueues (cognitive 20) windows/src/core/scheduledCommands.ts:82— scheduledCommands.parseQueues has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), boolean chains 4, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
energySettingsView.recordHostSnapshotIfLive (cognitive 20) windows/src/ui/energySettingsView.ts:171— energySettingsView.recordHostSnapshotIfLive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, 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.
sensorHistoryView.resolveMiSessionForDevice (cognitive 20) windows/src/ui/sensorHistoryView.ts:363— sensorHistoryView.resolveMiSessionForDevice has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). 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.
CameraLiveController.bindEvents (cognitive 20) windows/src/ui/cameraLive.ts:1268— CameraLiveController.bindEvents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 8 (nesting depth added 1). None of this is in the body itself: all 20 points belong to 7 function literals inside it that branch (lines 1290, 1312, 1324, …). 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.
settingsSearch.searchSettings (cognitive 20) windows/src/ui/settingsSearch.ts:725— settingsSearch.searchSettings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 3 (5 pts), loops 2, boolean chains 1 (nesting depth added 6). Of this number, 13 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.
settingsEvents.hasUnsavedSettingsChanges (cognitive 20) REDACTED:204— settingsEvents.hasUnsavedSettingsChanges has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 2). Of this number, 18 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.
ControlCenterPanel.omnibar (cognitive 19) Sources/MenuBarMijiaApp/ControlCenterPanel.swift:497— ControlCenterPanel.omnibar has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 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, 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.
DeviceCardView.speakerDrawer (cognitive 19) Sources/MenuBarMijiaApp/DeviceCardView.swift:1225— DeviceCardView.speakerDrawer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeviceFacetSection.rowBody (cognitive 19) Sources/MenuBarMijiaApp/DeviceFacetViews.swift:383— DeviceFacetSection.rowBody has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 1 (3 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
RoomOrderRowView.body (cognitive 19) Sources/MenuBarMijiaApp/RoomOrderEditor.swift:549— RoomOrderRowView.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 7, boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SensorCardView.readoutBar (cognitive 19) Sources/MenuBarMijiaApp/SensorCardView.swift:356— SensorCardView.readoutBar has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicControlCenterPanel.omnibar (cognitive 19) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:542— ClassicControlCenterPanel.omnibar has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 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, 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.
ClassicDeviceCardView.speakerDrawer (cognitive 19) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1258— ClassicDeviceCardView.speakerDrawer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicSensorCardView.readoutBar (cognitive 19) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:323— ClassicSensorCardView.readoutBar has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicChipSurface.body (cognitive 19) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:166— ClassicChipSurface.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (9 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.
HADiscovery.buildInstance (cognitive 19) Sources/MijiaCore/HADiscovery.swift:178— HADiscovery.buildInstance has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 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.
ModelIntentResolver.proactiveSuggestionsFromSystemOne (cognitive 19) Sources/MijiaCore/ModelIntentResolver.swift:804— ModelIntentResolver.proactiveSuggestionsFromSystemOne has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UpdateSystemDriver.unpackDMG (cognitive 19) Sources/MijiaCore/UpdateChecker.swift:936— UpdateSystemDriver.unpackDMG has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (5 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotSynthesizer.buildKitchenAppliance (cognitive 19) Sources/MijiaCore/MiCloud/MiotSynthesizer.swift:1049— MiotSynthesizer.buildKitchenAppliance has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 6, match/switch 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.
Go2RTCOwnerRecord.parse (cognitive 19) Sources/MijiaCore/MiCloud/XiaomiCameraBridge.swift:81— Go2RTCOwnerRecord.parse has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 3 (5 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
verify-flyout-layout.findChromeBinary (cognitive 19) windows/scripts/verify-flyout-layout.mjs:145— verify-flyout-layout.findChromeBinary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
miCloudCrypto.base64ToBytes (cognitive 19) windows/src/core/miCloudCrypto.ts:66— miCloudCrypto.base64ToBytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.buildValveKind (cognitive 19) windows/src/core/haDomains.ts:439— haDomains.buildValveKind has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 4. 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: 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.
MiAccountLogin.waitForScan (cognitive 19) windows/src/core/miCloud/accountLogin.ts:87— MiAccountLogin.waitForScan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
synthesis.normalizeMiotPropValue (cognitive 19) windows/src/core/miCloud/synthesis.ts:96— synthesis.normalizeMiotPropValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
synthesis.genericApplianceStatusDescription (cognitive 19) windows/src/core/miCloud/synthesis.ts:523— synthesis.genericApplianceStatusDescription has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, 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.
optimisticLock.runTrackedDevicePresetCommands::runSubsequent (cognitive 19) windows/src/core/optimisticLock.ts:502— optimisticLock.runTrackedDevicePresetCommands::runSubsequent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (optimisticLock.runTrackedDevicePresetCommands) 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.
appUrlCommand.findUniqueAskDevice (cognitive 19) REDACTED:750— appUrlCommand.findUniqueAskDevice has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 2). Of this number, 12 points are the body's own statements and 7 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.
sensorHistory.parseHAHistoryTimestampMs (cognitive 19) windows/src/core/sensorHistory.ts:1291— sensorHistory.parseHAHistoryTimestampMs has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (11 pts), boolean chains 4, if/else 3 (4 pts) (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
miAccountsStore.executeMultiAccountMiotCommand (cognitive 19) windows/src/core/miAccountsStore.ts:1278— miAccountsStore.executeMultiAccountMiotCommand has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (4 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diagnosticsAndScanner.derivePollingBackoffDiagnostics (cognitive 19) REDACTED:959— diagnosticsAndScanner.derivePollingBackoffDiagnostics has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScheduledCommandStore.takeDue (cognitive 19) windows/src/core/scheduledCommands.ts:185— ScheduledCommandStore.takeDue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bindEvents.bindEvents::writeFacet (cognitive 19) windows/src/ui/bindEvents.ts:1329— bindEvents.bindEvents::writeFacet has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 6, if/else 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MenuMijiaWindowsApp.panelHealth (cognitive 19) windows/src/ui/app.ts:1145— MenuMijiaWindowsApp.panelHealth has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 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.
HorizontalWheelScrollMonitor.handleScrollWheel (cognitive 18) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:881— HorizontalWheelScrollMonitor.handleScrollWheel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UnsupportedDeviceScanner.readHomeAssistantRegistry (cognitive 18) Sources/MenuBarMijiaApp/UnsupportedDeviceScanner.swift:218— UnsupportedDeviceScanner.readHomeAssistantRegistry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 2, match/switch 1 (nesting depth added 3). 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.
DelayPhrase.spokenNumber (cognitive 18) Sources/MijiaCore/AssistantSchedule.swift:138— DelayPhrase.spokenNumber has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 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.
DualSourceHomeProvider.resolveCameraStream (cognitive 18) Sources/MijiaCore/DualSourceHomeProvider.swift:387— DualSourceHomeProvider.resolveCameraStream has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HADiscovery.isPrivateLANIPv4 (cognitive 18) Sources/MijiaCore/HADiscovery.swift:639— HADiscovery.isPrivateLANIPv4 has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (7 pts), 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.
HAWebSocketProvider.connectAndListen (cognitive 18) Sources/MijiaCore/HomeProvider.swift:463— HAWebSocketProvider.connectAndListen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
HomeStore.showToast (cognitive 18) Sources/MijiaCore/HomeStore.swift:1086— HomeStore.showToast has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HomeStore.setFacetValue (cognitive 18) Sources/MijiaCore/HomeStore+Controls.swift:895— HomeStore.setFacetValue has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 1 (2 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.
HomeStore.resolveCameraStream (cognitive 18) Sources/MijiaCore/HomeStore+Controls.swift:1489— HomeStore.resolveCameraStream has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (8 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LocalIntentParser.spokenNumber (cognitive 18) Sources/MijiaCore/LocalIntentParser.swift:654— LocalIntentParser.spokenNumber has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 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.
ModelIntentResolver.endpointURL (cognitive 18) Sources/MijiaCore/ModelIntentResolver.swift:469— ModelIntentResolver.endpointURL has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ModelIntentResolver.deviceSpecificCriteria (cognitive 18) Sources/MijiaCore/ModelIntentResolver.swift:883— ModelIntentResolver.deviceSpecificCriteria has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SceneVisualCategory.init (cognitive 18) Sources/MijiaCore/Models.swift:1644— SceneVisualCategory.init has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
intent.bareCategoryOutcome (cognitive 18) windows/src/core/assistant/intent.ts:912— intent.bareCategoryOutcome has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), ternaries 3, match/switch 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 2 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.
discovery.withHomeDeviceLists (cognitive 18) windows/src/core/miCloud/discovery.ts:112— discovery.withHomeDeviceLists has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiagnosticsLog.loadFromStorage (cognitive 18) REDACTED:840— DiagnosticsLog.loadFromStorage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), boolean chains 3, 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.
EnergyHistory.prune (cognitive 18) windows/src/core/energyHistory.ts:574— EnergyHistory.prune has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 7 (8 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
automationSettingsView.bindAutomationSettingsEvents::handleDraftInput (cognitive 18) windows/src/ui/automationSettingsView.ts:1298— automationSettingsView.bindAutomationSettingsEvents::handleDraftInput has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlCenterPanel.groupPromptOverlay (cognitive 17) Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:257— ControlCenterPanel.groupPromptOverlay has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4, boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlCenterPanel.deviceStacks (cognitive 17) Sources/MenuBarMijiaApp/ControlCenterPanelStacks.swift:180— ControlCenterPanel.deviceStacks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PanelSearchKeyboard.handle (cognitive 17) Sources/MenuBarMijiaApp/ControlCenterPanel.swift:826— PanelSearchKeyboard.handle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2, boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReleaseNotesDigest.titleBeforeDescription (cognitive 17) Sources/MenuBarMijiaApp/UpdateSection.swift:346— ReleaseNotesDigest.titleBeforeDescription has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, 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.
ClassicControlCenterPanel.groupPromptOverlay (cognitive 17) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:377— ClassicControlCenterPanel.groupPromptOverlay has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4, boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassicLayoutEditable.body (cognitive 17) Sources/MenuBarMijiaApp/Classic/ClassicLayoutEditing.swift:87— ClassicLayoutEditable.body has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HomeStore.setCoverMotor (cognitive 17) Sources/MijiaCore/HomeStore+Controls.swift:777— HomeStore.setCoverMotor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 2 (3 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.
HomeStore.dispatchFacetWrite (cognitive 17) Sources/MijiaCore/HomeStore+Controls.swift:1086— HomeStore.dispatchFacetWrite has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, error handling 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.
HomeStore.runBatchCommands (cognitive 17) Sources/MijiaCore/HomeStore+Undo.swift:663— HomeStore.runBatchCommands has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, error handling 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.
LGWebOSClient.discoverOnLAN (cognitive 17) Sources/MijiaCore/LGWebOSClient.swift:900— LGWebOSClient.discoverOnLAN has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 3, error handling 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.
MiCloudProvider.loadMissingSpecs (cognitive 17) Sources/MijiaCore/MiCloud/MiCloudProvider.swift:487— MiCloudProvider.loadMissingSpecs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4, error handling 1 (nesting depth added 5). Of this number, 13 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.
HabitShare.swift.mentionedTargets (cognitive 17) Sources/MijiaCore/HabitShare.swift:162— HabitShare.swift.mentionedTargets has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 7 (8 pts), boolean chains 1 (nesting depth added 4). Of this number, 15 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.
MiCloudClient.homeDevices (cognitive 17) windows/src/core/miCloud/client.ts:577— MiCloudClient.homeDevices has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 6). Of this number, 14 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.
chineseIntentTables.extractChineseNumericOps (cognitive 17) windows/src/core/assistant/chineseIntentTables.ts:219— chineseIntentTables.extractChineseNumericOps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.haLightCapabilityFlags (cognitive 17) windows/src/core/haDomains.ts:152— haDomains.haLightCapabilityFlags has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 5, if/else 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
promptContext.deviceSpecificCriteria (cognitive 17) windows/src/core/assistant/promptContext.ts:330— promptContext.deviceSpecificCriteria has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
appUrlCommand.describeResolvedTarget (cognitive 17) REDACTED:527— appUrlCommand.describeResolvedTarget has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 2 (4 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SensorHistoryStore.record (cognitive 17) windows/src/core/sensorHistory.ts:591— SensorHistoryStore.record has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DoorbellDetector.resolveTargetCameraDeviceId (cognitive 17) windows/src/core/automationEngine.ts:1469— DoorbellDetector.resolveTargetCameraDeviceId has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 2 (nesting depth added 3). Of this number, 12 points are the body's own statements and 5 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.
updateChecker.selectWindowsInstallerAsset (cognitive 17) windows/src/core/updateChecker.ts:117— updateChecker.selectWindowsInstallerAsset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
panelPrefs.migrateRoomScopedLayoutKeys (cognitive 17) windows/src/ui/panelPrefs.ts:246— panelPrefs.migrateRoomScopedLayoutKeys has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settingsViews.restoreSettingsDraft (cognitive 17) windows/src/ui/settingsViews.ts:108— settingsViews.restoreSettingsDraft has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3, 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.
CameraLiveController.attachLiveMedia (cognitive 17) windows/src/ui/cameraLive.ts:546— CameraLiveController.attachLiveMedia has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1 (nesting depth added 5). Of this number, 10 points are the body's own statements and 7 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.
appLifecycle.checkForAppUpdate (cognitive 17) windows/src/ui/appLifecycle.ts:376— appLifecycle.checkForAppUpdate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
panelKeyboard.submitPanelInput (cognitive 17) windows/src/ui/panelKeyboard.ts:102— panelKeyboard.submitPanelInput has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7 (nesting depth added 3). Of this number, 13 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.
panelKeyboard.activeModalContainer (cognitive 17) windows/src/ui/panelKeyboard.ts:169— panelKeyboard.activeModalContainer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PanelRenderPipeline.patchDimPreview (cognitive 17) windows/src/ui/reconciler.ts:1160— PanelRenderPipeline.patchDimPreview has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CameraLiveVideoPlayer.makeSampleBuffer (cognitive 16) Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:421— CameraLiveVideoPlayer.makeSampleBuffer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ControlCenterPanel.mainDashboard (cognitive 16) Sources/MenuBarMijiaApp/ControlCenterPanel.swift:294— ControlCenterPanel.mainDashboard has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CoverDetailDrawer.body (cognitive 16) Sources/MenuBarMijiaApp/CoverDetailDrawer.swift:16— CoverDetailDrawer.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnboardingGuideView.advancedAIModelCard (cognitive 16) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:613— OnboardingGuideView.advancedAIModelCard has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LiquidGlassSlider.classicBody (cognitive 16) Sources/MenuBarMijiaApp/ThemeAndMotion.swift:686— LiquidGlassSlider.classicBody has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 14, if/else 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClassicLiquidGlassSlider.classicBody (cognitive 16) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:315— ClassicLiquidGlassSlider.classicBody has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 14, if/else 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
L10n.captures (cognitive 16) Sources/MijiaCore/AppLocalization.swift:662— L10n.captures has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelayPhrase.extract (cognitive 16) Sources/MijiaCore/AssistantSchedule.swift:38— DelayPhrase.extract has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 5, ternaries 2 (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.
DeviceDeduplicator.pairByFallbackGroups (cognitive 16) Sources/MijiaCore/DeviceDeduplicator.swift:775— DeviceDeduplicator.pairByFallbackGroups has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, 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.
HAWebSocketProvider.resolveCameraStream (cognitive 16) Sources/MijiaCore/HomeProvider.swift:736— HAWebSocketProvider.resolveCameraStream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 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.
HomeStore.adjustFocusedDevice (cognitive 16) Sources/MijiaCore/HomeStore+ViewState.swift:50— HomeStore.adjustFocusedDevice has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudClient.queryHistoryRoute (cognitive 16) Sources/MijiaCore/MiCloud/MiCloudClient.swift:974— MiCloudClient.queryHistoryRoute has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 1 (3 pts), error handling 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiCloudDiscovery.devices (cognitive 16) Sources/MijiaCore/MiCloud/MiCloudDiscovery.swift:58— MiCloudDiscovery.devices has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (4 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiotPercentScale.raw (cognitive 16) Sources/MijiaCore/MiCloud/MiotPercentScale.swift:24— MiotPercentScale.raw has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 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. This shape REPEATS in the file: one other method here (MiotPercentScale.scaledPercent) 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.
MiotPercentScale.scaledPercent (cognitive 16) Sources/MijiaCore/MiCloud/MiotPercentScale.swift:41— MiotPercentScale.scaledPercent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 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. This shape REPEATS in the file: one other method here (MiotPercentScale.raw) 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.
models.deviceAcceptsControlWrites (cognitive 16) windows/src/core/models.ts:549— models.deviceAcceptsControlWrites has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, 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.
models.airQualityFromRaw (cognitive 16) windows/src/core/models.ts:1057— models.airQualityFromRaw has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MiCloudClient.parseLightGroupMembers (cognitive 16) windows/src/core/miCloud/client.ts:371— MiCloudClient.parseLightGroupMembers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). 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.
chineseIntentTables.buildDevicePhrases (cognitive 16) windows/src/core/assistant/chineseIntentTables.ts:271— chineseIntentTables.buildDevicePhrases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
haDomains.buildHumidifierKind (cognitive 16) windows/src/core/haDomains.ts:320— haDomains.buildHumidifierKind has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 6, if/else 2. 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.
cameraHubs.fetchCameraMetadataList (cognitive 16) windows/src/core/miCloud/cameraHubs.ts:326— cameraHubs.fetchCameraMetadataList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 4). Of this number, 9 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.
ModelIntentResolver.planFromChat (cognitive 16) windows/src/core/assistant/modelIntentResolver.ts:441— ModelIntentResolver.planFromChat has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), loops 2 (4 pts), if/else 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OfflineHistory.deviceSummaries (cognitive 16) REDACTED:863— OfflineHistory.deviceSummaries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
controlFailure.extractErrorShape (cognitive 16) windows/src/core/controlFailure.ts:39— controlFailure.extractErrorShape has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 4, if/else 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diagnosticsAndScanner.deriveCameraDiagnostics (cognitive 16) REDACTED:911— diagnosticsAndScanner.deriveCameraDiagnostics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateChecker.parseUpdateState (cognitive 16) windows/src/core/updateChecker.ts:169— updateChecker.parseUpdateState has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
panelPrefs.pageSections (cognitive 16) windows/src/ui/panelPrefs.ts:476— panelPrefs.pageSections has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 4 (6 pts), boolean chains 1, loops 1 (nesting depth added 5). Of this number, 14 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.
connectionsAndDiagView.buildDesensitizedDiagnosticsMarkdown (cognitive 16) windows/src/ui/connectionsAndDiagView.ts:875— connectionsAndDiagView.buildDesensitizedDiagnosticsMarkdown has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 3, if/else 2 (nesting depth added 3). Of this number, 12 points are the body's own statements and 4 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.
connectionsAndDiagView.renderTokenBadge (cognitive 16) windows/src/ui/connectionsAndDiagView.ts:1041— connectionsAndDiagView.renderTokenBadge has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
demo.seedDemoSensorHistory (cognitive 16) windows/src/ui/demo.ts:210— demo.seedDemoSensorHistory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CameraLiveController.bridgeHlsStreamToMjpeg (cognitive 16) windows/src/ui/cameraLive.ts:794— CameraLiveController.bridgeHlsStreamToMjpeg has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 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.
liquidGlassSlider.syncLiquidGlassSlider (cognitive 16) windows/src/ui/liquidGlassSlider.ts:74— liquidGlassSlider.syncLiquidGlassSlider has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (6 pts), if/else 3 (nesting depth added 1). 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, 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.
reconciler.syncSlidingTabIndicators (cognitive 16) windows/src/ui/reconciler.ts:530— reconciler.syncSlidingTabIndicators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (3 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.
bindEvents.toggleDeviceForHost (cognitive 16) windows/src/ui/bindEvents.ts:86— bindEvents.toggleDeviceForHost has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 2. 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: 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.
bindEvents.bindDeckEvents (cognitive 16) windows/src/ui/bindEvents.ts:1452— bindEvents.bindDeckEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 4, ternaries 1. Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 1517, 1478, 1494, …). 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.
MenuMijiaWindowsApp.swapIfNeeded (cognitive 16) windows/src/ui/app.ts:1499— MenuMijiaWindowsApp.swapIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, ternaries 1 (nesting depth added 2). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
activityStackView.renderSingleActivityRow (cognitive 16) windows/src/ui/activityStackView.ts:1314— activityStackView.renderSingleActivityRow has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D4 · Code Duplication· Near-duplicate member family (3 members, 16 shared lines) · ×1
Near-duplicate member family (3 members, 16 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360-456 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:479-619 | Sources/MenuBarMijiaApp/DeviceCardView.swift:538-669 — These 3 members are variants of one another: a block of 16 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (163 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:190-356 | Sources/MenuBarMijiaApp/DeviceCardView.swift:246-420 — These two members are variants of one another: 163 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (92 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:810-935 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:442-569 — These two members are variants of one another: 92 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (67 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1258— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1258-1354 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1225-1321 — These two members are variants of one another: 67 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (63 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:377— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:377-452 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:257-332 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (62 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:784— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:784-860 | Sources/MenuBarMijiaApp/DeviceCardView.swift:751-827 — These two members are variants of one another: 62 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (57 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1364— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1364-1449 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1331-1416 — These two members are variants of one another: 57 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (56 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:864— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:864-934 | Sources/MenuBarMijiaApp/DeviceCardView.swift:831-901 — These two members are variants of one another: 56 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (50 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:7— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:7-75 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1420-1488 — These two members are variants of one another: 50 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (47 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:768— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:768-847 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:675-779 — These two members are variants of one another: 47 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (39 shared lines) Sources/MijiaCore/HomeStore+Undo.swift:115— Sources/MijiaCore/HomeStore+Undo.swift:115-309 | Sources/MijiaCore/HomeStore+Undo.swift:423-525 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (32 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:315— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:315-408 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:686-762 — These two members are variants of one another: 32 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (24 shared lines) Sources/MenuBarMijiaApp/MiAccountSection.swift:212— Sources/MenuBarMijiaApp/MiAccountSection.swift:212-282 | Sources/MenuBarMijiaApp/MiAccountSection.swift:286-355 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (18 shared lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1228— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1228-1254 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1195-1221 — These two members are variants of one another: 18 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) Sources/MijiaCore/CommandIntent.swift:544— Sources/MijiaCore/CommandIntent.swift:544-560 | Sources/MijiaCore/SmartDevice+Presentation.swift:336-352 | Sources/MijiaCore/SmartDevice+Presentation.swift:354-364 | Sources/MijiaCore/SmartDevice+Presentation.swift:366-377 | Sources/MijiaCore/SmartDevice+Presentation.swift:426-435 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (102 corresponding lines) · ×1
Edited copy of a member (102 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938-1039 | Sources/MenuBarMijiaApp/DeviceCardView.swift:905-1006 — These two members are one piece of code written twice and then edited apart: 102 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (105 corresponding lines) · ×1
Edited copy of a member (105 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:542— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:542-646 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:497-602 — These two members are one piece of code written twice and then edited apart: 105 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (72 corresponding lines) · ×1
Edited copy of a member (72 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:129— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:129-200 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:123-195 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (65 corresponding lines) · ×1
Edited copy of a member (65 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:89— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:89-163 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:90-154 — These two members are one piece of code written twice and then edited apart: 65 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (52 corresponding lines) · ×1
Edited copy of a member (52 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:972— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:972-1023 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:606-657 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:724— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:724-779 | Sources/MenuBarMijiaApp/CoverDetailDrawer.swift:208-263 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:55— Sources/MenuBarMijiaApp/Classic/ClassicPanelDesign.swift:55-98 | Sources/MenuBarMijiaApp/PanelDesign.swift:280-324 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:688— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:688-732 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:644-690 — 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 (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:335— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:335-377 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:391-433 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:8— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:8-40 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:8-40 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:159— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:159-206 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:228-273 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:141— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:141-178 | Sources/MenuBarMijiaApp/SensorCardView.swift:171-211 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (51 corresponding lines) · ×1
Edited copy of a member (51 corresponding lines) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:672— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:672-722 | Sources/MenuBarMijiaApp/DeviceCardView.swift:691-747 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) Sources/MenuBarMijiaApp/AssistantCommandBar.swift:498— Sources/MenuBarMijiaApp/AssistantCommandBar.swift:498-527 | Sources/MenuBarMijiaApp/AssistantCommandBar.swift:530-558 — 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 (23 corresponding lines) · ×1
Edited copy of a member (23 corresponding lines) Sources/MijiaCore/MiCloud/MiCloudClient.swift:491— Sources/MijiaCore/MiCloud/MiCloudClient.swift:491-513 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:518-540 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) Sources/MijiaCore/HomeStore+Controls.swift:472— Sources/MijiaCore/HomeStore+Controls.swift:472-494 | Sources/MijiaCore/HomeStore+Controls.swift:754-775 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 18+ corresponding lines) · ×1
Edited copies of one member (4 members, 18+ corresponding lines) Sources/MijiaCore/HomeStore+Controls.swift:422— Sources/MijiaCore/HomeStore+Controls.swift:422-445 | Sources/MijiaCore/HomeStore+Controls.swift:447-470 | Sources/MijiaCore/HomeStore+Controls.swift:496-516 | Sources/MijiaCore/HomeStore+Controls.swift:684-701 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×1
Edited copy of a member (24 corresponding lines) Sources/MijiaCore/AssistantConfig.swift:570— Sources/MijiaCore/AssistantConfig.swift:570-593 | Sources/MijiaCore/KeychainAndPrefs.swift:54-82 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:179— Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:179-206 | Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:211-242 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×1
Edited copy of a member (21 corresponding lines) windows/src-tauri/src/camera.rs:928— windows/src-tauri/src/camera.rs:928-952 | windows/src-tauri/src/camera.rs:954-974 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×1
Edited copies of one member (4 members, 15+ corresponding lines) Sources/MijiaCore/DeviceSynthesizer.swift:69— Sources/MijiaCore/DeviceSynthesizer.swift:69-93 | Sources/MijiaCore/MiCloud/MiCloudClient.swift:21-35 | Sources/MijiaCore/Models.swift:305-333 | Sources/MijiaCore/Models.swift:718-744 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×1
Edited copy of a member (16 corresponding lines) Sources/MijiaCore/AppLocalization.swift:684— Sources/MijiaCore/AppLocalization.swift:684-699 | Sources/MijiaCore/AppLocalization.swift:701-718 — 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, 10+ corresponding lines) · ×1
Edited copies of one member (3 members, 10+ corresponding lines) Sources/MenuBarMijiaApp/AppIntents.swift:54— Sources/MenuBarMijiaApp/AppIntents.swift:54-66 | Sources/MenuBarMijiaApp/AppIntents.swift:104-113 | Sources/MenuBarMijiaApp/AppIntents.swift:149-160 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×1
Edited copies of one member (3 members, 8+ corresponding lines) Sources/MenuBarMijiaApp/AutomationEngine.swift:312— Sources/MenuBarMijiaApp/AutomationEngine.swift:312-326 | Sources/MenuBarMijiaApp/AutomationEngine.swift:330-344 | Sources/MenuBarMijiaApp/SystemActivityMonitor.swift:112-119 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) Sources/MenuBarMijiaApp/AppIntents.swift:37— Sources/MenuBarMijiaApp/AppIntents.swift:37-45 | Sources/MenuBarMijiaApp/AppIntents.swift:87-95 | Sources/MenuBarMijiaApp/AppIntents.swift:134-140 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 3+ corresponding lines) · ×1
Edited copies of one member (3 members, 3+ corresponding lines) Sources/MijiaCore/DualSourceHomeProvider.swift:380— Sources/MijiaCore/DualSourceHomeProvider.swift:380-385 | Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:560-562 | Sources/MijiaCore/MiCloud/MiCloudProvider.swift:1128-1130 — 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 (4 members, 1+ corresponding lines) · ×1
Edited copies of one member (4 members, 1+ corresponding lines) Sources/MenuBarMijiaApp/DeviceLayout.swift:132— Sources/MenuBarMijiaApp/DeviceLayout.swift:132-132 | Sources/MijiaCore/HomeStore+ControlWrite.swift:85-87 | Sources/MijiaCore/HomeStore+Controls.swift:1034-1036 | Sources/MijiaCore/MiCloud/MiAccountsProvider.swift:591-593 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (79 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:278— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:278-356 | Sources/MenuBarMijiaApp/DeviceCardView.swift:342-420 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:278` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (66 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:544— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:544-609 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:499-564 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (145 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:402— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:402-546 | Sources/MenuBarMijiaApp/SensorCardView.swift:435-579 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (56 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1167— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1167-1222 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1134-1189 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (48 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:229— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:229-276 | Sources/MenuBarMijiaApp/DeviceCardView.swift:285-332 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:229` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (46 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360-405 | Sources/MenuBarMijiaApp/DeviceCardView.swift:424-469 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:360` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (39 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:135— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:135-173 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:130-168 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MenuBarMijiaApp/ControlCenterPanel.swift:128` calls `frame` and `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:133` 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 (38 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:972— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:972-1009 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:606-643 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:972` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (57 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938-994 | Sources/MenuBarMijiaApp/DeviceCardView.swift:905-961 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:938` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:129— Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:129-163 | Sources/MenuBarMijiaApp/ClimatePanelModule.swift:120-154 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift` and `Sources/MenuBarMijiaApp/ClimatePanelModule.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 172 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicClimatePanelModule.swift:129` 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 (33 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:817— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:817-849 | Sources/MenuBarMijiaApp/DeviceCardView.swift:784-816 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:817` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (32 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:615— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:615-646 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:493-524 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (64 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:323— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:323-386 | Sources/MenuBarMijiaApp/SensorCardView.swift:356-419 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:999— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:999-1028 | Sources/MenuBarMijiaApp/DeviceCardView.swift:966-995 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:999` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (26–27 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:805— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:805-830 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:715-741 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:805` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:454— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift:454-479 | Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift:334-359 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 388 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (35–38 lines × 2) Sources/MijiaCore/LocalIntentParser.swift:342— Sources/MijiaCore/LocalIntentParser.swift:342-379 | Sources/MijiaCore/LocalIntentParser.swift:968-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/LocalIntentParser.swift:342` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/MijiaCore/LocalIntentParser.swift:1004` calls `Dictionary` and `Sources/MijiaCore/LocalIntentParser.swift:381` 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 (55 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1068— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1068-1122 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1035-1089 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17–21 lines × 2) Sources/MijiaCore/HomeStore+Undo.swift:245— Sources/MijiaCore/HomeStore+Undo.swift:245-265 | Sources/MijiaCore/HomeStore+Undo.swift:467-483 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/HomeStore+Undo.swift:245` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also 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 (19 lines × 4) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1279— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1279-1297 | Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1397-1415 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1246-1264 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1364-1382 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 952 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView.swift:1279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:940— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:940-959 | Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift:574-593 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift` as WHOLE FILES: this scan already matched 28 separate duplicated blocks between them, totalling at least 500 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelChrome.swift:940` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–19 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:381— Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:381-399 | Sources/MenuBarMijiaApp/ThemeAndMotion.swift:746-760 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift` and `Sources/MenuBarMijiaApp/ThemeAndMotion.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicThemeAndMotion.swift:381` 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) Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:191— Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:191-206 | Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:226-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:191` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `notify` to `Bool = false` in one and `Bool = true` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (24 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:177— Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:177-200 | Sources/MenuBarMijiaApp/ControlCenterPanel.swift:172-195 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift` and `Sources/MenuBarMijiaApp/ControlCenterPanel.swift` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 327 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanel.swift:177` 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–15 lines × 2) Sources/MenuBarMijiaApp/DeviceCardView.swift:463— Sources/MenuBarMijiaApp/DeviceCardView.swift:463-477 | Sources/MenuBarMijiaApp/DeviceCardView.swift:569-581 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/DeviceCardView.swift:463` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–15 lines × 2) Sources/MijiaCore/DeviceSynthesizer.swift:386— Sources/MijiaCore/DeviceSynthesizer.swift:386-400 | Sources/MijiaCore/DeviceSynthesizer.swift:402-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/DeviceSynthesizer.swift:386` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:7— Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:7-19 | Sources/MenuBarMijiaApp/DeviceCardView.swift:1421-1432 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift` and `Sources/MenuBarMijiaApp/DeviceCardView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicDeviceCardView+Camera.swift:7` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 4) Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:278— Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:278-289 | Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:310-321 | Sources/MenuBarMijiaApp/SensorCardView.swift:311-322 | Sources/MenuBarMijiaApp/SensorCardView.swift:343-354 — before extracting anything, compare `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift` and `Sources/MenuBarMijiaApp/SensorCardView.swift` as WHOLE FILES: this scan already matched 32 separate duplicated blocks between them, totalling at least 603 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MenuBarMijiaApp/Classic/ClassicSensorCardView.swift:278` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) Sources/MenuBarMijiaApp/OnboardingGuideView.swift:912— Sources/MenuBarMijiaApp/OnboardingGuideView.swift:912-922 | Sources/MenuBarMijiaApp/OnboardingGuideView.swift:936-947 — both copies are in the same file, so extract the 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 `Sources/MenuBarMijiaApp/OnboardingGuideView.swift:912` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `alignment` to `.top` in one and `.leading` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (14–16 lines × 2) Sources/MijiaCore/LocalIntentParser.swift:711— Sources/MijiaCore/LocalIntentParser.swift:711-726 | Sources/MijiaCore/LocalIntentParser.swift:1077-1090 — both copies are in the same file, so extract the 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 `Sources/MijiaCore/LocalIntentParser.swift:711` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 3) Sources/MijiaCore/DeviceSynthesizer.swift:1304— Sources/MijiaCore/DeviceSynthesizer.swift:1304-1310 | Sources/MijiaCore/DeviceSynthesizer.swift:1311-1317 | Sources/MijiaCore/DeviceSynthesizer.swift:1318-1324 — 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.
Duplicated block (6 lines × 3) Sources/MijiaCore/FragmentedMP4Demuxer.swift:252— Sources/MijiaCore/FragmentedMP4Demuxer.swift:252-257 | Sources/MijiaCore/FragmentedMP4Demuxer.swift:263-268 | Sources/MijiaCore/FragmentedMP4Demuxer.swift:283-288 — 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 `Sources/MijiaCore/FragmentedMP4Demuxer.swift:252` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (2–5 lines × 6) Sources/MijiaCore/CommandIntent.swift:556— Sources/MijiaCore/CommandIntent.swift:556-560 | Sources/MijiaCore/SmartDevice+Presentation.swift:340-342 | Sources/MijiaCore/SmartDevice+Presentation.swift:360-364 | Sources/MijiaCore/SmartDevice+Presentation.swift:370-372 | Sources/MijiaCore/SmartDevice+Presentation.swift:373-377 | Sources/MijiaCore/SmartDevice+Presentation.swift:430-431 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MijiaCore/CommandIntent.swift:556` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MijiaCore/CommandIntent.swift:556` calls `tr` and `Sources/MijiaCore/SmartDevice+Presentation.swift:340` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–10 lines × 2) windows/src-tauri/src/desktop_shell.rs:66— windows/src-tauri/src/desktop_shell.rs:66-75 | windows/src-tauri/src/desktop_shell.rs:123-130 — both copies are in the same file, so extract the 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 `windows/src-tauri/src/desktop_shell.rs:66` 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 × 3) windows/src-tauri/src/camera.rs:267— windows/src-tauri/src/camera.rs:267-275 | windows/src-tauri/src/camera.rs:1145-1153 | windows/src-tauri/src/camera.rs:1197-1205 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication· Edited copy of a member (1 corresponding lines) · ×1
Edited copy of a member (1 corresponding lines) scripts/linux-check/Shims/Security/Shim.swift:16— scripts/linux-check/Shims/Security/Shim.swift:16-21 | scripts/linux-check/Shims/Security/Shim.swift:22-22 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Off the main sequence: MijiaCore — MijiaCore: abstractness 0.03, instability 0.00, distance 0.97 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Outbound HTTP without resilience windows/scripts/verify-flyout-layout.mjs:202— `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Duplication concentrated across 2 sibling directories (16 clone groups) windows/src/core/optimisticLock.ts:364— 16 duplicated blocks under windows/src/ have copies in at least two of the sibling directories core, ui — 13 of them are reported below, and 3 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 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 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 16 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.
R10 · Code Duplication· Duplicated block with local edits (63 matched lines × 2 locations) · ×1
Duplicated block with local edits (63 matched lines × 2 locations) windows/src/ui/demo.ts:52— windows/src/ui/demo.ts:52 · windows/src/ui/demo.ts:143 — the two spans are one implementation copied and then locally edited — 400 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 (49 matched lines × 2 locations) · ×1
Duplicated block with local edits (49 matched lines × 2 locations) windows/src/core/models.ts:540— windows/src/core/models.ts:540 · windows/src/core/models.ts:618 — the two spans are one implementation copied and then locally edited — 232 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 (36 lines × 2 locations) raycast/src/search-devices.tsx:8— raycast/src/search-devices.tsx:8 · raycast/src/search-scenes.tsx:6 — 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) windows/src/ui/onboardingGuide.ts:286— windows/src/ui/onboardingGuide.ts:286 · REDACTED:1112 — the 2 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.
R10 · Code Duplication· Duplicated block with local edits (30 matched lines × 2 locations) · ×1
Duplicated block with local edits (30 matched lines × 2 locations) windows/src/core/assistant/chineseIntentTables.ts:219— windows/src/core/assistant/chineseIntentTables.ts:219 · windows/src/core/assistant/intent.ts:1064 — the two spans are one implementation copied and then locally edited — 283 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 (26 matched lines × 2 locations) · ×1
Duplicated block with local edits (26 matched lines × 2 locations) raycast/src/search-scenes.tsx:44— raycast/src/search-scenes.tsx:44 · raycast/src/search-scenes.tsx:71 — the two spans are one implementation copied and then locally edited — 182 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 (24 lines × 2 locations) windows/src/ui/onboardingGuide.ts:225— windows/src/ui/onboardingGuide.ts:225 · REDACTED:153 — 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 (21 lines × 2 locations) windows/src/core/assistant/intent.ts:1280— windows/src/core/assistant/intent.ts:1280 · windows/src/core/assistant/intent.ts:1585 — 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 (21 matched lines × 2 locations) · ×1
Duplicated block with local edits (21 matched lines × 2 locations) windows/src/ui/activityStackView.ts:150— windows/src/ui/activityStackView.ts:150 · windows/src/ui/sensorHistoryView.ts:251 — the two spans are one implementation copied and then locally edited — 109 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 (19 lines × 2 locations) windows/src/core/optimisticLock.ts:812— windows/src/core/optimisticLock.ts:812 · windows/src/ui/commandDispatch.ts:557 — 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 (18 matched lines × 2 locations) · ×1
Duplicated block with local edits (18 matched lines × 2 locations) REDACTED:5— REDACTED:5 · windows/src/core/sensorHistory.ts:98 — the two spans are one implementation copied and then locally edited — 151 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 (17 matched lines × 2 locations) · ×1
Duplicated block with local edits (17 matched lines × 2 locations) windows/src/ui/naturalCommand.ts:121— windows/src/ui/naturalCommand.ts:121 · windows/src/ui/naturalCommand.ts:243 — the two spans are one implementation copied and then locally edited — 103 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 (15 lines × 3 locations) windows/src/ui/automationSettingsView.ts:166— windows/src/ui/automationSettingsView.ts:166 · windows/src/ui/commandDispatch.ts:109 · windows/src/ui/detailDrawers.ts:1008 — 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 (15 matched lines × 2 locations) · ×1
Duplicated block with local edits (15 matched lines × 2 locations) windows/src/ui/bindEvents.ts:566— windows/src/ui/bindEvents.ts:566 · windows/src/ui/energySettingsView.ts:681 — the two spans are one implementation copied and then locally edited — 106 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 (13 lines × 3 locations) raycast/src/snapshot-validation.ts:40— raycast/src/snapshot-validation.ts:40 · raycast/src/snapshot-validation.ts:57 · raycast/src/snapshot-validation.ts:71 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function buildDeviceKind (cyclomatic 370, cognitive 540) windows/src/core/miCloud/synthesis.ts:1130— buildDeviceKind has cyclomatic complexity 370 and cognitive complexity 540; 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 deviceSvgIcon (cyclomatic 140, cognitive 99) windows/src/ui/deviceViews.ts:852— deviceSvgIcon has cyclomatic complexity 140 and cognitive complexity 99; 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 applyCommandToDevices (cyclomatic 138, cognitive 227) windows/src/core/commandEffects.ts:23— applyCommandToDevices has cyclomatic complexity 138 and cognitive complexity 227; 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 commitRender (cyclomatic 137, cognitive 172) windows/src/ui/reconciler.ts:1294— commitRender has cyclomatic complexity 137 and cognitive complexity 172; 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 classifyRawError (cyclomatic 135, cognitive 65) windows/src/core/controlFailure.ts:136— classifyRawError has cyclomatic complexity 135 and cognitive complexity 65; 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 handlePanelKey (cyclomatic 124, cognitive 133) windows/src/ui/panelKeyboard.ts:260— handlePanelKey has cyclomatic complexity 124 and cognitive complexity 133; 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 map (cyclomatic 122, cognitive 194) windows/src/core/miCloud/command.ts:95— map has cyclomatic complexity 122 and cognitive complexity 194; 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 renderPrimaryDrawer (cyclomatic 122, cognitive 173) windows/src/ui/deviceViews.ts:235— renderPrimaryDrawer has cyclomatic complexity 122 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 merge (cyclomatic 121, cognitive 179) windows/src/core/dualSourceProvider.ts:590— merge has cyclomatic complexity 121 and cognitive complexity 179; 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 inverseCommands (cyclomatic 117, cognitive 198) windows/src/core/commandEffects.ts:268— inverseCommands has cyclomatic complexity 117 and cognitive complexity 198; 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 dispatchEvent (cyclomatic 112, cognitive 209) windows/src/core/automationEngine.ts:1045— dispatchEvent has cyclomatic complexity 112 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 renderDeviceTile (cyclomatic 112, cognitive 131) windows/src/ui/deviceViews.ts:1252— renderDeviceTile has cyclomatic complexity 112 and cognitive complexity 131; 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 buildKind (cyclomatic 107, cognitive 161) windows/src/core/homeAssistant.ts:413— buildKind has cyclomatic complexity 107 and cognitive complexity 161; 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 applianceOrGenericIcon (cyclomatic 106, cognitive 43) windows/src/ui/deviceViews.ts:706— applianceOrGenericIcon has cyclomatic complexity 106 and cognitive complexity 43; 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 deviceStatusSummary (cyclomatic 104, cognitive 173) windows/src/core/models.ts:1129— deviceStatusSummary has cyclomatic complexity 104 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 onOpenURL (cyclomatic 90, cognitive 148) REDACTED:1064— onOpenURL has cyclomatic complexity 90 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 normalize (cyclomatic 90, cognitive 137) windows/src/core/assistant/intent.ts:340— normalize has cyclomatic complexity 90 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 capabilityScore (cyclomatic 86, cognitive 132) windows/src/core/dualSourceProvider.ts:533— capabilityScore has cyclomatic complexity 86 and cognitive complexity 132; 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 resolveCloudCameraStream (cyclomatic 84, cognitive 201) windows/src/ui/cameraLive.ts:924— resolveCloudCameraStream has cyclomatic complexity 84 and cognitive complexity 201; 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 refreshDevices (cyclomatic 79, cognitive 102) REDACTED:84— refreshDevices has cyclomatic complexity 79 and cognitive complexity 102; 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 evaluateSnapshot (cyclomatic 76, cognitive 108) windows/scripts/verify-flyout-layout.mjs:42— evaluateSnapshot has cyclomatic complexity 76 and cognitive complexity 108; 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 haServiceCall (cyclomatic 73, cognitive 82) windows/src/core/homeAssistant.ts:1130— haServiceCall has cyclomatic complexity 73 and cognitive complexity 82; 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 parseEnglish (cyclomatic 72, cognitive 104) windows/src/core/assistant/intent.ts:1361— parseEnglish has cyclomatic complexity 72 and cognitive complexity 104; 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 hasDetailDrawer (cyclomatic 72, cognitive 46) windows/src/core/models.ts:632— hasDetailDrawer has cyclomatic complexity 72 and cognitive complexity 46; 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 renderCameraLiveModalView (cyclomatic 69, cognitive 77) windows/src/ui/cameraLiveModalView.ts:36— renderCameraLiveModalView has cyclomatic complexity 69 and cognitive complexity 77; 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 executeDirectAskPreset (cyclomatic 66, cognitive 104) REDACTED:824— executeDirectAskPreset has cyclomatic complexity 66 and cognitive complexity 104; 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 66, cognitive 81) windows/src/ui/automationSettingsView.ts:1211— (anonymous) has cyclomatic complexity 66 and cognitive complexity 81; 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 loadSettings (cyclomatic 65, cognitive 93) windows/src/ui/settings.ts:59— loadSettings has cyclomatic complexity 65 and cognitive complexity 93; 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 renderAutomationAndSafetySettingsSections (cyclomatic 65, cognitive 64) windows/src/ui/automationSettingsView.ts:813— renderAutomationAndSafetySettingsSections has cyclomatic complexity 65 and cognitive complexity 64; 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 catalogStateSummary (cyclomatic 64, cognitive 94) windows/src/core/assistant/promptContext.ts:89— catalogStateSummary has cyclomatic complexity 64 and cognitive complexity 94; 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 applyCommand (cyclomatic 64, cognitive 84) windows/src/ui/commandDispatch.ts:839— applyCommand has cyclomatic complexity 64 and cognitive complexity 84; 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 commandsForIntent (cyclomatic 62, cognitive 104) windows/src/core/assistant/intent.ts:490— commandsForIntent has cyclomatic complexity 62 and cognitive complexity 104; 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 resolveLiveCameraTarget (cyclomatic 62, cognitive 89) windows/src/core/miCloud/cameraHubs.ts:390— resolveLiveCameraTarget has cyclomatic complexity 62 and cognitive complexity 89; 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 parseEnvelope (cyclomatic 62, cognitive 66) REDACTED:171— parseEnvelope has cyclomatic complexity 62 and cognitive complexity 66; 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 parseChineseDeviceCommand (cyclomatic 61, cognitive 99) windows/src/core/assistant/intent.ts:1154— parseChineseDeviceCommand has cyclomatic complexity 61 and cognitive complexity 99; 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 handleNaturalCommand (cyclomatic 60, cognitive 86) windows/src/ui/naturalCommand.ts:45— handleNaturalCommand has cyclomatic complexity 60 and cognitive complexity 86; 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 extractControlIdentityKey (cyclomatic 60, cognitive 69) windows/src/ui/reconciler.ts:128— extractControlIdentityKey has cyclomatic complexity 60 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 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 applianceActivity (cyclomatic 60, cognitive 28) windows/src/core/miCloud/synthesis.ts:383— applianceActivity has cyclomatic complexity 60 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 performUndo (cyclomatic 57, cognitive 89) windows/src/ui/app.ts:857— performUndo has cyclomatic complexity 57 and cognitive complexity 89; 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 executeIntents (cyclomatic 55, cognitive 87) windows/src/ui/intentExecution.ts:390— executeIntents has cyclomatic complexity 55 and cognitive complexity 87; 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.
R3 · Large Files· windows/src/core/miCloud/synthesis.ts · ×1
windows/src/core/miCloud/synthesis.ts: 1965 lines of code windows/src/core/miCloud/synthesis.ts:1— windows/src/core/miCloud/synthesis.ts has 1965 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
windows/src/ui/app.ts: 1679 lines of code windows/src/ui/app.ts:1— windows/src/ui/app.ts has 1679 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· windows/src/ui/activityStackView.ts · ×1
windows/src/ui/activityStackView.ts: 1664 lines of code windows/src/ui/activityStackView.ts:1— windows/src/ui/activityStackView.ts has 1664 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· windows/src/ui/reconciler.ts · ×1
windows/src/ui/reconciler.ts: 1619 lines of code windows/src/ui/reconciler.ts:1— windows/src/ui/reconciler.ts has 1619 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· windows/src/ui/deviceViews.ts · ×1
windows/src/ui/deviceViews.ts: 1551 lines of code windows/src/ui/deviceViews.ts:1— windows/src/ui/deviceViews.ts has 1551 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· windows/src/core/automationEngine.ts · ×1
windows/src/core/automationEngine.ts: 1497 lines of code windows/src/core/automationEngine.ts:1— windows/src/core/automationEngine.ts has 1497 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· windows/src/core/assistant/intent.ts · ×1
windows/src/core/assistant/intent.ts: 1491 lines of code windows/src/core/assistant/intent.ts:1— windows/src/core/assistant/intent.ts has 1491 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
windows/src/core/models.ts: 1483 lines of code windows/src/core/models.ts:1— windows/src/core/models.ts has 1483 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· windows/src/core/homeAssistant.ts · ×1
windows/src/core/homeAssistant.ts: 1472 lines of code windows/src/core/homeAssistant.ts:1— windows/src/core/homeAssistant.ts has 1472 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· windows/src/ui/automationSettingsView.ts · ×1
windows/src/ui/automationSettingsView.ts: 1459 lines of code windows/src/ui/automationSettingsView.ts:1— windows/src/ui/automationSettingsView.ts has 1459 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· windows/src/ui/bindEvents.ts · ×1
windows/src/ui/bindEvents.ts: 1452 lines of code windows/src/ui/bindEvents.ts:1— windows/src/ui/bindEvents.ts has 1452 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· windows/src/ui/cameraLive.ts · ×1
windows/src/ui/cameraLive.ts: 1407 lines of code windows/src/ui/cameraLive.ts:1— windows/src/ui/cameraLive.ts has 1407 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: 1372 lines of code REDACTED:1— REDACTED has 1372 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: 1364 lines of code REDACTED:1— REDACTED has 1364 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· windows/src/ui/connectionsAndDiagView.ts · ×1
windows/src/ui/connectionsAndDiagView.ts: 1361 lines of code windows/src/ui/connectionsAndDiagView.ts:1— windows/src/ui/connectionsAndDiagView.ts has 1361 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· windows/src/core/haDomains.ts · ×1
windows/src/core/haDomains.ts: 1355 lines of code windows/src/core/haDomains.ts:1— windows/src/core/haDomains.ts has 1355 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: 1349 lines of code REDACTED:1— REDACTED has 1349 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· windows/src/core/miAccountsStore.ts · ×1
windows/src/core/miAccountsStore.ts: 1325 lines of code windows/src/core/miAccountsStore.ts:1— windows/src/core/miAccountsStore.ts has 1325 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· windows/src/core/sensorHistory.ts · ×1
windows/src/core/sensorHistory.ts: 1325 lines of code windows/src/core/sensorHistory.ts:1— windows/src/core/sensorHistory.ts has 1325 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· windows/src/ui/detailDrawers.ts · ×1
windows/src/ui/detailDrawers.ts: 1242 lines of code windows/src/ui/detailDrawers.ts:1— windows/src/ui/detailDrawers.ts has 1242 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· windows/src/ui/speechGuard.ts · ×1
windows/src/ui/speechGuard.ts: 1226 lines of code windows/src/ui/speechGuard.ts:1— windows/src/ui/speechGuard.ts has 1226 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: 1209 lines of code REDACTED:1— REDACTED has 1209 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: 1156 lines of code REDACTED:1— REDACTED has 1156 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· windows/src/ui/commandDispatch.ts · ×1
windows/src/ui/commandDispatch.ts: 1123 lines of code windows/src/ui/commandDispatch.ts:1— windows/src/ui/commandDispatch.ts has 1123 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· windows/src/core/assistant/habits.ts · ×1
windows/src/core/assistant/habits.ts: 1091 lines of code windows/src/core/assistant/habits.ts:1— windows/src/core/assistant/habits.ts has 1091 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· windows/src/core/dualSourceProvider.ts · ×1
windows/src/core/dualSourceProvider.ts: 1076 lines of code windows/src/core/dualSourceProvider.ts:1— windows/src/core/dualSourceProvider.ts has 1076 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· windows/src/ui/appLifecycle.ts · ×1
windows/src/ui/appLifecycle.ts: 1043 lines of code windows/src/ui/appLifecycle.ts:1— windows/src/ui/appLifecycle.ts has 1043 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· windows/src/ui/settingsViews.ts · ×1
windows/src/ui/settingsViews.ts: 1008 lines of code windows/src/ui/settingsViews.ts:1— windows/src/ui/settingsViews.ts 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· windows/src/core/optimisticLock.ts · ×1
windows/src/core/optimisticLock.ts: 989 lines of code windows/src/core/optimisticLock.ts:1— windows/src/core/optimisticLock.ts has 989 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· windows/src/ui/sensorHistoryView.ts · ×1
windows/src/ui/sensorHistoryView.ts: 970 lines of code windows/src/ui/sensorHistoryView.ts:1— windows/src/ui/sensorHistoryView.ts has 970 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
windows/src/core/i18n.ts: 927 lines of code windows/src/core/i18n.ts:1— windows/src/core/i18n.ts has 927 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· windows/src/ui/intentExecution.ts · ×1
windows/src/ui/intentExecution.ts: 915 lines of code windows/src/ui/intentExecution.ts:1— windows/src/ui/intentExecution.ts has 915 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· windows/src/ui/onboardingGuide.ts · ×1
windows/src/ui/onboardingGuide.ts: 849 lines of code windows/src/ui/onboardingGuide.ts:1— windows/src/ui/onboardingGuide.ts has 849 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· windows/src/ui/settingsSearch.ts · ×1
windows/src/ui/settingsSearch.ts: 842 lines of code windows/src/ui/settingsSearch.ts:1— windows/src/ui/settingsSearch.ts has 842 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· windows/src/core/assistant/modelIntentResolver.ts · ×1
windows/src/core/assistant/modelIntentResolver.ts: 750 lines of code windows/src/core/assistant/modelIntentResolver.ts:1— windows/src/core/assistant/modelIntentResolver.ts has 750 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· windows/src/core/miCloud/client.ts · ×1
windows/src/core/miCloud/client.ts: 687 lines of code windows/src/core/miCloud/client.ts:1— windows/src/core/miCloud/client.ts has 687 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· windows/src/core/raycastSnapshot.ts · ×1
windows/src/core/raycastSnapshot.ts: 681 lines of code windows/src/core/raycastSnapshot.ts:1— windows/src/core/raycastSnapshot.ts has 681 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· windows/src/ui/panelPrefs.ts · ×1
windows/src/ui/panelPrefs.ts: 674 lines of code windows/src/ui/panelPrefs.ts:1— windows/src/ui/panelPrefs.ts has 674 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· windows/src/ui/energySettingsView.ts · ×1
windows/src/ui/energySettingsView.ts: 667 lines of code windows/src/ui/energySettingsView.ts:1— windows/src/ui/energySettingsView.ts has 667 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· windows/src/core/energyHistory.ts · ×1
windows/src/core/energyHistory.ts: 662 lines of code windows/src/core/energyHistory.ts:1— windows/src/core/energyHistory.ts has 662 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~234 LoC) raycast/src/search-devices.tsx— no import path from any entry point (39 application, 3 tooling, 64 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 (~99 LoC) raycast/src/search-scenes.tsx— no import path from any entry point (39 application, 3 tooling, 64 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 (~83 LoC) raycast/src/url.ts— no import path from any entry point (39 application, 3 tooling, 64 test roots considered), but 3 in-repo import(s) from 3 other file(s) do name it (raycast/src/ask.tsx, raycast/src/search-devices.tsx, raycast/src/search-scenes.tsx) — 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
Dead file (~38 LoC) raycast/src/ask.tsx— no import path from any entry point (39 application, 3 tooling, 64 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
Duplicated predicate windows/src/core/miCloud/cameraHubs.ts:91— `!Number.isInteger(value) || value < 0 || value > 255` appears character-identically in 2 files — windows/src/core/miCloud/cameraHubs.ts, windows/src/core/miCloud/client.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 windows/src/ui/energySettingsView.ts:175— `!dual && host.settings.connectionMode === "homeAssistant" && Boolean(host.haConnectionError)` appears character-identically in 2 files — windows/src/ui/energySettingsView.ts, windows/src/ui/sensorHistoryView.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 windows/src/ui/energySettingsView.ts:178— `!dual && host.settings.connectionMode === "xiaomiCloud" && Boolean(host.miSessionExpired)` appears character-identically in 2 files — windows/src/ui/energySettingsView.ts, windows/src/ui/sensorHistoryView.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:846— `!item || typeof item !== "object" || Array.isArray(item)` appears character-identically in 2 files — REDACTED, windows/src/core/miAccountsStore.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 windows/src/core/dualSourceProvider.ts:225— `!parsed || typeof parsed !== "object" || Array.isArray(parsed)` appears character-identically in 4 files — windows/src/core/dualSourceProvider.ts, windows/src/core/miAccountsStore.ts, windows/src/core/pollingPolicy.ts, windows/src/ui/automationSettingsView.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 windows/src/core/automationEngine.ts:367— `!raw || typeof raw !== "object" || Array.isArray(raw)` appears character-identically in 2 files — windows/src/core/automationEngine.ts, windows/src/core/cameraQuality.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 windows/src/core/miCloud/cameraHubs.ts:323— `!seen.has(r.did) && (seen.add(r.did), true)` appears character-identically in 2 files — windows/src/core/miCloud/cameraHubs.ts, windows/src/core/miCloud/client.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 windows/src/ui/panelPrefs.ts:287— `!trimmed || (originalName !== undefined && trimmed === originalName.trim())` appears character-identically in 2 files — windows/src/ui/panelPrefs.ts, windows/src/ui/roomOrderEditor.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 windows/src/core/haDomains.ts:1228— `!value || typeof value !== "object" || Array.isArray(value)` appears character-identically in 3 files — windows/src/core/haDomains.ts, windows/src/core/miAccountsStore.ts, windows/src/core/secureStore.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 windows/src/core/commandEffects.ts:145— `(k.kind === "speaker" || k.kind === "tv") && k.mediaEntityId === command.entityId` appears character-identically in 2 files — windows/src/core/commandEffects.ts, windows/src/core/optimisticLock.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 windows/src/core/optimisticLock.ts:392— `claim === undefined || ownsDeviceWrite(host, claim)` appears character-identically in 2 files — windows/src/core/optimisticLock.ts, windows/src/ui/intentExecution.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 windows/src/ui/onboardingGuide.ts:665— `endpoint && !/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(endpoint)` appears character-identically in 2 files — windows/src/ui/onboardingGuide.ts, 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 windows/src/ui/onboardingGuide.ts:246— `endpoint && host.settings.assistantCustomKeyEndpoint === endpoint` appears character-identically in 2 files — windows/src/ui/onboardingGuide.ts, 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 windows/src/core/miCloud/client.ts:489— `err instanceof MiCloudError && err.kind === "sessionExpired"` appears character-identically in 3 files — windows/src/core/miCloud/client.ts, windows/src/core/miCloud/discovery.ts, 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 windows/src/ui/appLifecycle.ts:297— `error instanceof Error && error.message.trim()` appears character-identically in 3 files — windows/src/ui/appLifecycle.ts, windows/src/ui/connectionsAndDiagView.ts, 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:701— `health.kind === "offline" && health.recovery === "qr"` appears character-identically in 2 files — REDACTED, windows/src/ui/panelView.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 windows/src/ui/appLifecycle.ts:1013— `host.cameraLive.activeLiveCameraId !== null && !host.cameraLive.liveCameraHidden` appears character-identically in 3 files — windows/src/ui/appLifecycle.ts, windows/src/ui/panelKeyboard.ts, windows/src/ui/reconciler.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 windows/src/ui/appLifecycle.ts:259— `host.cameraLive.activeLiveCameraId !== null || host.cameraLive.liveCameraKeepAliveTimer !== null` appears character-identically in 3 files — windows/src/ui/appLifecycle.ts, windows/src/ui/onboardingGuide.ts, 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 windows/src/ui/appLifecycle.ts:1005— `host.ctxMenu !== null || host.isHomeMenuOpen` appears character-identically in 2 files — windows/src/ui/appLifecycle.ts, windows/src/ui/panelKeyboard.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 windows/src/core/optimisticLock.ts:845— `host.isSyncingCloud === true && busyRetriesLeft > 0` appears character-identically in 2 files — windows/src/core/optimisticLock.ts, windows/src/ui/commandDispatch.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 windows/src/core/optimisticLock.ts:485— `host.replyBanner !== prevBanner && host.replyBanner?.isError` appears character-identically in 2 files — windows/src/core/optimisticLock.ts, windows/src/ui/intentExecution.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 windows/src/ui/naturalCommand.ts:170— `host.settings.assistantBaseURL.trim() || "https://openrouter.ai/api/v1"` appears character-identically in 2 files — windows/src/ui/naturalCommand.ts, windows/src/ui/proactive.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 windows/src/ui/appLifecycle.ts:147— `host.settings.connectionMode === "xiaomiCloud" && host.settings.miSession` appears character-identically in 2 files — windows/src/ui/appLifecycle.ts, windows/src/ui/speechGuard.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 windows/src/ui/onboardingGuide.ts:315— `host.settings.haBaseURL && host.settings.haToken` appears character-identically in 2 files — windows/src/ui/onboardingGuide.ts, 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 windows/src/core/miCloud/command.ts:237— `miotShortName(p.type) === "on" && p.access.includes("write")` appears character-identically in 2 files — windows/src/core/miCloud/command.ts, windows/src/core/miCloud/synthesis.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.
Silent fallback default in catch Sources/MenuBarMijiaApp/AppDiagnosticsLog.swift:55— `crashReportStamps` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:115— `encode` turns every thrown error into `"{}"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:154— `encodeOrder` turns every thrown error into `"[]"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:501— `groups` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:505— `encode` turns every thrown error into `"[]"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:509— `map` turns every thrown error into `[:]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:513— `encode` turns every thrown error into `"{}"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:521— `encode` turns every thrown error into `"[]"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:537— `decodeAliases` turns every thrown error into `[:]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:542— `encodeAliases` turns every thrown error into `"{}"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:546— `decodeOrder` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MenuBarMijiaApp/DeviceLayout.swift:551— `encodeOrder` turns every thrown error into `"[]"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MijiaCore/HomeProvider.swift:1025— `receiveJSON` turns every thrown error into `[:]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Sources/MijiaCore/MiCloud/MiAccountLogin.swift:364— `loadAccounts` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch REDACTED:716— `loadNumberMap` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:737— `loadBooleanMap` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/sensorHistory.ts:1204— `runRoute` (in `querySingleMiMetricSeries`) swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/sensorHistory.ts:1445— `fetchHomeAssistantSensorHistory` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/automationEngine.ts:506— `load` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/automationEngine.ts:565— `readStamps` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/miAccountsStore.ts:191— `readPersistedAccountExpiryMap` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/miAccountsStore.ts:323— `readAccountIndex` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:872— `loadFromStorage` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/core/dualSourceProvider.ts:333— `load` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Silent fallback default in catch windows/src/ui/cameraLive.ts:1440— `loadRawStorageMap` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 handler or in the docstring, and the row stops firing.
Subsumed condition operand windows/src-tauri/src/camera.rs:110— `path_lower.ends_with("/stream.mjpeg")` can never decide this `||` — every value satisfying `path_lower.ends_with("/stream.mjpeg")` also satisfies `path_lower.ends_with(".mjpeg")`, 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.
Subsumed condition operand scripts/check_supported_devices.py:34— `line.startswith("| :--")` can never decide this `||` — every value satisfying `line.startswith("| :--")` also satisfies `line.startswith("|")`, 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.
Subsumed condition operand scripts/check_supported_devices.py:34— `line.startswith("| Device")` can never decide this `||` — every value satisfying `line.startswith("| Device")` also satisfies `line.startswith("|")`, 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.
redundant comment windows/tests/cameraLens.test.ts:202— "Two online hubs in the same room -> ambiguous_hub" repeats the code it sits on: 5 of its 6 words (two, online, hubs, room, hub) are already in `const twoInSameRoom = resolveCameraHub(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment windows/tests/core.test.ts:2583— "Positive switched lights" repeats the code it sits on: 3 of its 3 words (positive, switched, lights) are already in `const positives: SmartDevice[] = [`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×2
Projects may be oversized for their cohesion Package.swift:1— `(repository root)` (88806 LoC, 804 module-visible types across 6 directories) overshoots its size bounds. 2 of 5 build unit(s) (Cargo, SwiftPM, npm) overshoot their size bounds, lowering Project Cohesion to 2.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Projects may be oversized for their cohesion windows/package.json:1— `windows` (63801 LoC, 454 module-visible types across 5 directories) overshoots its size bounds. 2 of 5 build unit(s) (Cargo, SwiftPM, npm) overshoot their size bounds, lowering Project Cohesion to 2.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Silent fallback default on Err windows/src-tauri/src/companion.rs:710— `drain_pending_open_urls` turns every `Err` into `Vec::new()` — 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.
Silent fallback default on Err windows/src-tauri/src/network.rs:426— `read_origin_store` turns every `Err` into `HashSet::new()` — 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.
Fat interface: SettingsEventsHost (18 required operations) REDACTED:75— `SettingsEventsHost` declares 18 required operations: `clearPendingHighRisk`, `selectRoom`, `habitSequences`, `lastHabitAction`, `checkForAppUpdate`, `handleNaturalCommand`, `invalidateSourceControl`, `openSettingsSheet`, `openUpdatePage`, `refreshDevices`, `refreshHADevices`, `render`, `saveSettings`, `shouldKeepPopoverPinned`, `signOutXiaomiAccount`, `startUpdateInstall`, `startXiaomiQRLogin`, `syncKeyFieldWithEndpoint`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 4 significant file(s) lose their only recent owner: Sources/MijiaCore/ModelIntentResolver.swift, Sources/MijiaCore/AssistantConfig.swift, Sources/MijiaCore/KeychainAndPrefs.swift, Sources/MijiaCore/MiCloud/MiCloudCrypto.swift. Pair on, review, or document these before any departure.
D21 · Naming Consistency· `sharesDID` spells `DID` where 25 names in the project spell it `Did` · ×1
`sharesDID` spells `DID` where 25 names in the project spell it `Did` Sources/MijiaCore/DeviceDeduplicator.swift:744— 25 of 26 names in project MenuBarMijiaApp spell the token `Did` (25 of 26; unit: names in project MenuBarMijiaApp containing `Did`). Peers: AutomationEngine.rulesDidChange (Sources/MenuBarMijiaApp/AutomationEngine.swift:192); CameraLivePanelController.ptzManualStopBatchDidFinish (Sources/MenuBarMijiaApp/CameraLivePanelController.swift:125); CameraLivePanelController.windowDidResignKey (Sources/MenuBarMijiaApp/CameraLivePanelPTZ.swift:390); CameraPictureInPicture.pictureInPictureControllerDidStartPictureInPicture (Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:807); CameraPictureInPicture.pictureInPictureControllerDidStopPictureInPicture (Sources/MenuBarMijiaApp/CameraLiveVideoPlayer.swift:845). Rename to `sharesDid`. [rule N6]
D21 · Naming Consistency· `cameraCardByHaDevice` spells `Ha` where 32 names in the project spell it `HA` · ×1
`cameraCardByHaDevice` spells `Ha` where 32 names in the project spell it `HA` windows/src/core/automationEngine.ts:1469— 32 of 34 names in project repository spell the token `HA` (32 of 34; unit: names in project repository containing `HA`). Peers: DoorbellDetector.ingestHASnapshot (windows/src/core/automationEngine.ts:1400); dualSourceProvider.extractHADeviceIdentities (windows/src/core/dualSourceProvider.ts:149); PairingState.pairedHA (windows/src/core/dualSourceProvider.ts:424); PairingState.miIndexForHA (windows/src/core/dualSourceProvider.ts:426); dualSourceProvider.reconcilePairedHALightGroups (windows/src/core/dualSourceProvider.ts:485). Rename to `cameraCardByHADevice`. [rule N6]
D21 · Naming Consistency· `sharesDID` spells `DID` where 13 names in the project spell it `Did` · ×1
`sharesDID` spells `DID` where 13 names in the project spell it `Did` windows/src/core/dualSourceProvider.ts:434— 13 of 14 names in project repository spell the token `Did` (13 of 14; unit: names in project repository containing `Did`). Peers: CameraRecordMetadata.parentDid (windows/src/core/miCloud/cameraHubs.ts:35); cameraHubs.extractRecordParentDid (windows/src/core/miCloud/cameraHubs.ts:49); LiveCameraBridgeTarget.bridgeDid (windows/src/core/miCloud/cameraHubs.ts:372); MiDeviceRecord.splitParentDid (windows/src/core/miCloud/client.ts:20); MiDeviceRecord.parentDid (windows/src/core/miCloud/client.ts:22). Rename to `sharesDid`. [rule N6]
D21 · Naming Consistency· `resolveHaCameraStreamUrl` spells `Ha` where 32 names in the project spell it `HA` · ×1
`resolveHaCameraStreamUrl` spells `Ha` where 32 names in the project spell it `HA` windows/src/ui/cameraLive.ts:330— 32 of 34 names in project repository spell the token `HA` (32 of 34; unit: names in project repository containing `HA`). Peers: DoorbellDetector.ingestHASnapshot (windows/src/core/automationEngine.ts:1400); dualSourceProvider.extractHADeviceIdentities (windows/src/core/dualSourceProvider.ts:149); PairingState.pairedHA (windows/src/core/dualSourceProvider.ts:424); PairingState.miIndexForHA (windows/src/core/dualSourceProvider.ts:426); dualSourceProvider.reconcilePairedHALightGroups (windows/src/core/dualSourceProvider.ts:485). Rename to `resolveHACameraStreamUrl`. [rule N6]
Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `windows/src-tauri`.
No SAST REDACTED:6— No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling· Dependabot does not watch npm/cargo · ×1
Dependabot does not watch npm/cargo REDACTED:3— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, `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.
R7 · Dead Code· Unused export 'HABIT_SEQUENCE_WINDOW_MS' · ×1
Unused export 'HABIT_SEQUENCE_WINDOW_MS' windows/src/core/assistant/habits.ts:56— Nothing ultimately consumes this binding: its only referrer is the re-export in windows/src/core/assistant.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in windows/src/core/assistant.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'claimDoorbellWindowForUser' · ×1
Unused export 'claimDoorbellWindowForUser' windows/src/ui/activityStackView.ts:897— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'renderUnifiedUpperStack' · ×1
Unused export 'renderUnifiedUpperStack' windows/src/ui/activityStackView.ts:1539— Nothing imports this binding — it is safe to review for removal.
Null assertions (`!`) override strict null checking — ~2.7 `!` null assertions per 1k TypeScript source lines — 180 assertion(s) across the 67843 source line(s) of the 101 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: windows/src/core/assistant/habits.ts (25), windows/src/core/dualSourceProvider.ts (16), windows/src/ui/sensorHistoryView.ts (14). 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.
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 44 file(s) — `Sources/MenuBarMijiaApp/AutomationEngine.swift`, `Sources/MenuBarMijiaApp/CameraLivePanelController.swift`, `Sources/MenuBarMijiaApp/Classic/ClassicControlCenterPanelLayout.swift`, `Sources/MenuBarMijiaApp/ControlCenterPanelChrome.swift`, `Sources/MenuBarMijiaApp/ControlCenterPanelLayout.swift`, … (+39 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 01a1e982-c358-74b6-ac6e-054781edee23 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 45 · Warnings: 1924 · Recommendations: 87 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 12:37 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.