Public report of tw93/Kaku, published 14 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, 14 November 2026, 18:25 UTC · Survey ID cd_8f592fb7992b4bc2b13a4bbd8c75538c
tw93/Kaku
Measured 14 November 2026, 18:23 UTC, at code version 5d3774f
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Up 2 since the last survey
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: 308,279 lines of product code in 65 projects, tests not counted · Estimated rebuild effort: about 2.5 person-years · Weakest lens: Accessibility, 46
Findings by how serious they are
65 critical1680 serious229 minor
18 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
14 November 2026, 18:23 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.
1881of 1974 findings point to an exact file and line, so you can open each one in the code. The other 93 concern the repository as a whole, such as missing documentation.
65dimensions across 9 lenses, read from 308,279 lines of product code in 65 projects.
tw93/Kaku falls short of our standard for a preview release, held back most by its Accessibility lens, the interface's usability with a keyboard or assistive technology. It scores 55 out of 100 and is rated Adequate, and 40 of its 65 critical findings are security problems.
Accessibility, at 46, is the weakest lens and counts most in the score. The best first step is fixing focus, motion and contrast, worth about 6 points. Recording design decisions comes next, worth about 2 points. Raising Accessibility to 65 would lift the score to about 62.
Thirty-eight weaknesses in the code could be used by an attacker. One known security hole in a package the code depends on can be used by attackers, and twenty-two parts of the code are no longer understood by anyone working on it. Fixing the weaknesses the scanner points to, updating the vulnerable packages and having someone learn the forgotten files would close these risks. Passing outside input through environment variables would fix the pipeline step that puts outside input straight into a shell command. Moving the business rules into the object that owns the data would take care of the business object that only holds data.
The product code is 308,279 lines, about €360,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 Accessibility rose from 46 to 65, the lowest score rated Strong, the score would rise from 55 to about 62.
Code composition: what the lines of code are
Product code 98%Tests 2%
New since the last survey: 412 findings
These 412 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FileTooLong: web/index.html crates/kaku-remote/assets/web/index.html
God Classes · FunctionTooLong: index.html.onFrame crates/kaku-remote/assets/web/index.html
God Classes · FileTooLong: web/desktop.js crates/kaku-remote/assets/web/desktop.js
God Classes · FileTooLong: src/lib.rs kaku/src/lib.rs
God Classes · FunctionTooLong: kaku::select_main_menu_command kaku/src/lib.rs
Code Duplication · Near-duplicate member pair (67 shared lines) kaku-gui/src/overlay/launcher.rs
Code Duplication · Near-duplicate member pair (50 shared lines) kaku/src/ai_config/tui/ui.rs
Code Duplication · Near-duplicate member pair (48 shared lines) crates/luahelper/src/lib.rs
Code Duplication · Near-duplicate member pair (43 shared lines) kaku-gui/src/ai_tools/search.rs
Code Duplication · Near-duplicate member pair (36 shared lines) kaku/src/ai_config/tui/ui.rs
Code Duplication · Near-duplicate member pair (33 shared lines) kaku-gui/src/termwindow/charselect.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) kaku/src/cli/activate_tab.rs
Code Duplication · Edited copy of a member (143 corresponding lines) kaku-gui/src/overlay/launcher.rs
Code Duplication · Edited copy of a member (87 corresponding lines) mux/src/tmux_commands.rs
Code Duplication · Edited copy of a member (69 corresponding lines) mux/src/tab.rs
Code Duplication · Edited copy of a member (66 corresponding lines) term/src/screen.rs
Code Duplication · Edited copy of a member (48 corresponding lines) kaku/src/ai_config/tui.rs
Code Duplication · Edited copy of a member (56 corresponding lines) kaku-gui/src/overlay/copy.rs
Code Duplication · Edited copy of a member (61 corresponding lines) kaku/src/ai_config/tui/providers/mod.rs
Code Duplication · Edited copy of a member (60 corresponding lines) kaku/src/ai_config/tui/ui.rs
Code Duplication · Edited copy of a member (46 corresponding lines) crates/wezterm-font/src/rasterizer/freetype.rs
Code Duplication · Edited copy of a member (43 corresponding lines) crates/wezterm-font/src/rasterizer/freetype.rs
Code Duplication · Edited copy of a member (82 corresponding lines) crates/wezterm-ssh/src/pty.rs
Code Duplication · Edited copy of a member (50 corresponding lines) kaku/src/ai_config/tui.rs
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 158 findings
These 158 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one. The first 100 are listed here.
€120,000 to €610,000, for 2,009 to 6,373 hours of work, about 2.5 person-years for 1 to 5 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.8 at a score of 55. 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: 308,279 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
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.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.
Raises the score by about 2 points · Low effort · ADR Quality
3
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Raises the score by about 3 points · Medium effort · Page structure
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €360,000 to build again, about 2.5 person-years of work. Its weakest lens is Accessibility, at 46 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
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. Of all the actions in this report, it raises the score most for the work it takes: about 6 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.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 229,902 lines over the last 90 days, which is about 932,380 lines a year. At that pace, the extra work comes to an estimated 123.5 to 741 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.
425 modules, with 1154 dependencies between them. 14 loops run through 48 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 385 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.
config.font uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break config.font, while a change to config.font can't break wezterm_dynamic.value.
Position
Below the diagonal: config.font uses a module listed above it, which is the healthy direction.
config.font uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break config.font, while a change to config.font can't break wezterm_escape_parser.csi.
Position
Below the diagonal: config.font uses a module listed above it, which is the healthy direction.
config.units uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break config.units, while a change to config.units can't break wezterm_dynamic.value.
Position
Below the diagonal: config.units uses a module listed above it, which is the healthy direction.
wezterm_color_types uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break wezterm_color_types, while a change to wezterm_color_types can't break wezterm_dynamic.value.
Position
Below the diagonal: wezterm_color_types uses a module listed above it, which is the healthy direction.
wezterm_input_types uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break wezterm_input_types, while a change to wezterm_input_types can't break wezterm_dynamic.value.
Position
Below the diagonal: wezterm_input_types uses a module listed above it, which is the healthy direction.
wezterm_surface.line.line uses wezterm_cell, so a change to wezterm_cell can break wezterm_surface.line.line, while a change to wezterm_surface.line.line can't break wezterm_cell.
Position
Below the diagonal: wezterm_surface.line.line uses a module listed above it, which is the healthy direction.
config.keyassignment uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break config.keyassignment, while a change to config.keyassignment can't break wezterm_dynamic.value.
Position
Below the diagonal: config.keyassignment uses a module listed above it, which is the healthy direction.
config.keyassignment uses config.units, so a change to config.units can break config.keyassignment, while a change to config.keyassignment can't break config.units.
Position
Below the diagonal: config.keyassignment uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.ai_chat.types uses wezterm_cell, so a change to wezterm_cell can break kaku_gui.overlay.ai_chat.types, while a change to kaku_gui.overlay.ai_chat.types can't break wezterm_cell.
Position
Below the diagonal: kaku_gui.overlay.ai_chat.types uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.ai_chat.types uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break kaku_gui.overlay.ai_chat.types, while a change to kaku_gui.overlay.ai_chat.types can't break wezterm_dynamic.value.
Position
Below the diagonal: kaku_gui.overlay.ai_chat.types uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.ai_chat.types uses wezterm_color_types, so a change to wezterm_color_types can break kaku_gui.overlay.ai_chat.types, while a change to kaku_gui.overlay.ai_chat.types can't break wezterm_color_types.
Position
Below the diagonal: kaku_gui.overlay.ai_chat.types uses a module listed above it, which is the healthy direction.
wezterm_surface uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break wezterm_surface, while a change to wezterm_surface can't break wezterm_surface.line.line.
Position
Below the diagonal: wezterm_surface uses a module listed above it, which is the healthy direction.
wezterm_term.color uses wezterm_color_types, so a change to wezterm_color_types can break wezterm_term.color, while a change to wezterm_term.color can't break wezterm_color_types.
Position
Below the diagonal: wezterm_term.color uses a module listed above it, which is the healthy direction.
config.color uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break config.color, while a change to config.color can't break wezterm_dynamic.value.
Position
Below the diagonal: config.color uses a module listed above it, which is the healthy direction.
config.color uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break config.color, while a change to config.color can't break wezterm_escape_parser.csi.
Position
Below the diagonal: config.color uses a module listed above it, which is the healthy direction.
config.color uses wezterm_color_types, so a change to wezterm_color_types can break config.color, while a change to config.color can't break wezterm_color_types.
Position
Below the diagonal: config.color uses a module listed above it, which is the healthy direction.
config.color uses wezterm_term.color, so a change to wezterm_term.color can break config.color, while a change to config.color can't break wezterm_term.color.
Position
Below the diagonal: config.color uses a module listed above it, which is the healthy direction.
wezterm_term.terminalstate uses wezterm_cell, so a change to wezterm_cell can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_cell.
Position
Below the diagonal: wezterm_term.terminalstate uses a module listed above it, which is the healthy direction.
wezterm_term.terminalstate uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_escape_parser.csi.
Position
Below the diagonal: wezterm_term.terminalstate uses a module listed above it, which is the healthy direction.
wezterm_term.terminalstate uses wezterm_term.input, so a change to wezterm_term.input can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_term.input.
Position
Below the diagonal: wezterm_term.terminalstate uses a module listed above it, which is the healthy direction.
wezterm_term.terminalstate uses wezterm_input_types, so a change to wezterm_input_types can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_input_types.
Position
Below the diagonal: wezterm_term.terminalstate uses a module listed above it, which is the healthy direction.
wezterm_term.terminalstate uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_surface.line.line.
Position
Below the diagonal: wezterm_term.terminalstate uses a module listed above it, which is the healthy direction.
wezterm_term.terminalstate uses wezterm_term.color, so a change to wezterm_term.color can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_term.color.
Position
Below the diagonal: wezterm_term.terminalstate uses a module listed above it, which is the healthy direction.
17→19 wezterm_term.terminalstate uses wezterm_term.terminalpart of a loop✕
Connections
4 pairs of types, where a type in wezterm_term.terminalstate uses a type in wezterm_term.terminal.
wezterm_term.terminalstate uses wezterm_term.terminal, so a change to wezterm_term.terminal can break wezterm_term.terminalstate, while a change to wezterm_term.terminalstate can't break wezterm_term.terminal.
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.
wezterm_term.terminal uses wezterm_term.terminalstate, so a change to wezterm_term.terminalstate can break wezterm_term.terminal, while a change to wezterm_term.terminal can't break wezterm_term.terminalstate.
Position
Below the diagonal: wezterm_term.terminal uses a module listed above it, which is the healthy direction.
config.config uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break config.config, while a change to config.config can't break wezterm_dynamic.value.
Position
Below the diagonal: config.config uses a module listed above it, which is the healthy direction.
config.config uses wezterm_input_types, so a change to wezterm_input_types can break config.config, while a change to config.config can't break wezterm_input_types.
Position
Below the diagonal: config.config uses a module listed above it, which is the healthy direction.
config.config uses config.keyassignment, so a change to config.keyassignment can break config.config, while a change to config.config can't break config.keyassignment.
Position
Below the diagonal: config.config uses a module listed above it, which is the healthy direction.
config.config uses wezterm_surface, so a change to wezterm_surface can break config.config, while a change to config.config can't break wezterm_surface.
Position
Below the diagonal: config.config uses a module listed above it, which is the healthy direction.
config.config uses wezterm_term.terminal, so a change to wezterm_term.terminal can break config.config, while a change to config.config can't break wezterm_term.terminal.
Position
Below the diagonal: config.config uses a module listed above it, which is the healthy direction.
mux.renderable uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break mux.renderable, while a change to mux.renderable can't break wezterm_dynamic.value.
Position
Below the diagonal: mux.renderable uses a module listed above it, which is the healthy direction.
mux.renderable uses wezterm_surface, so a change to wezterm_surface can break mux.renderable, while a change to mux.renderable can't break wezterm_surface.
Position
Below the diagonal: mux.renderable uses a module listed above it, which is the healthy direction.
mux.renderable uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.renderable, while a change to mux.renderable can't break wezterm_term.terminal.
Position
Below the diagonal: mux.renderable uses a module listed above it, which is the healthy direction.
kaku_gui.glyphcache uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break kaku_gui.glyphcache, while a change to kaku_gui.glyphcache can't break wezterm_escape_parser.csi.
Position
Below the diagonal: kaku_gui.glyphcache uses a module listed above it, which is the healthy direction.
kaku_gui.glyphcache uses config.font, so a change to config.font can break kaku_gui.glyphcache, while a change to kaku_gui.glyphcache can't break config.font.
Position
Below the diagonal: kaku_gui.glyphcache uses a module listed above it, which is the healthy direction.
kaku_gui.glyphcache uses wezterm_surface, so a change to wezterm_surface can break kaku_gui.glyphcache, while a change to kaku_gui.glyphcache can't break wezterm_surface.
Position
Below the diagonal: kaku_gui.glyphcache uses a module listed above it, which is the healthy direction.
kaku_gui.glyphcache uses wezterm_font, so a change to wezterm_font can break kaku_gui.glyphcache, while a change to kaku_gui.glyphcache can't break wezterm_font.
Position
Below the diagonal: kaku_gui.glyphcache uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.box_model uses config.units, so a change to config.units can break kaku_gui.termwindow.box_model, while a change to kaku_gui.termwindow.box_model can't break config.units.
Position
Below the diagonal: kaku_gui.termwindow.box_model uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.box_model uses wezterm_color_types, so a change to wezterm_color_types can break kaku_gui.termwindow.box_model, while a change to kaku_gui.termwindow.box_model can't break wezterm_color_types.
Position
Below the diagonal: kaku_gui.termwindow.box_model uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.box_model uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break kaku_gui.termwindow.box_model, while a change to kaku_gui.termwindow.box_model can't break wezterm_surface.line.line.
Position
Below the diagonal: kaku_gui.termwindow.box_model uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.box_model uses wezterm_term.color, so a change to wezterm_term.color can break kaku_gui.termwindow.box_model, while a change to kaku_gui.termwindow.box_model can't break wezterm_term.color.
Position
Below the diagonal: kaku_gui.termwindow.box_model uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.box_model uses wezterm_font, so a change to wezterm_font can break kaku_gui.termwindow.box_model, while a change to kaku_gui.termwindow.box_model can't break wezterm_font.
Position
Below the diagonal: kaku_gui.termwindow.box_model uses a module listed above it, which is the healthy direction.
24→37 kaku_gui.termwindow.box_model uses kaku_gui.termwindowpart of a loop✕
Connections
3 pairs of types, where a type in kaku_gui.termwindow.box_model uses a type in kaku_gui.termwindow.
kaku_gui.termwindow.box_model uses kaku_gui.termwindow, so a change to kaku_gui.termwindow can break kaku_gui.termwindow.box_model, while a change to kaku_gui.termwindow.box_model can't break kaku_gui.termwindow.
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.
kaku_remote.web uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break kaku_remote.web, while a change to kaku_remote.web can't break wezterm_escape_parser.csi.
Position
Below the diagonal: kaku_remote.web uses a module listed above it, which is the healthy direction.
kaku_remote.web uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break kaku_remote.web, while a change to kaku_remote.web can't break wezterm_surface.line.line.
Position
Below the diagonal: kaku_remote.web uses a module listed above it, which is the healthy direction.
kaku_remote.web uses wezterm_surface, so a change to wezterm_surface can break kaku_remote.web, while a change to kaku_remote.web can't break wezterm_surface.
Position
Below the diagonal: kaku_remote.web uses a module listed above it, which is the healthy direction.
kaku_remote.web uses wezterm_term.color, so a change to wezterm_term.color can break kaku_remote.web, while a change to kaku_remote.web can't break wezterm_term.color.
Position
Below the diagonal: kaku_remote.web uses a module listed above it, which is the healthy direction.
kaku_remote.web uses config.config, so a change to config.config can break kaku_remote.web, while a change to kaku_remote.web can't break config.config.
Position
Below the diagonal: kaku_remote.web uses a module listed above it, which is the healthy direction.
mux.tab uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.tab, while a change to mux.tab can't break wezterm_term.terminal.
Position
Below the diagonal: mux.tab uses a module listed above it, which is the healthy direction.
window.os.macos.window uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break window.os.macos.window, while a change to window.os.macos.window can't break wezterm_escape_parser.csi.
Position
Below the diagonal: window.os.macos.window uses a module listed above it, which is the healthy direction.
window.os.macos.window uses wezterm_input_types, so a change to wezterm_input_types can break window.os.macos.window, while a change to window.os.macos.window can't break wezterm_input_types.
Position
Below the diagonal: window.os.macos.window uses a module listed above it, which is the healthy direction.
window.os.macos.window uses config.keyassignment, so a change to config.keyassignment can break window.os.macos.window, while a change to window.os.macos.window can't break config.keyassignment.
Position
Below the diagonal: window.os.macos.window uses a module listed above it, which is the healthy direction.
window.os.macos.window uses config, so a change to config can break window.os.macos.window, while a change to window.os.macos.window can't break config.
Position
Below the diagonal: window.os.macos.window uses a module listed above it, which is the healthy direction.
window.os.macos.window uses wezterm_font, so a change to wezterm_font can break window.os.macos.window, while a change to window.os.macos.window can't break wezterm_font.
Position
Below the diagonal: window.os.macos.window uses a module listed above it, which is the healthy direction.
27→29 window.os.macos.window uses windowpart of a loop✕
Connections
15 pairs of types, where a type in window.os.macos.window uses a type in window.
window.os.macos.window uses window, so a change to window can break window.os.macos.window, while a change to window.os.macos.window can't break window.
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.
window uses window.os.macos.window, so a change to window.os.macos.window can break window, while a change to window can't break window.os.macos.window.
Position
Below the diagonal: window uses a module listed above it, which is the healthy direction.
mux.domain uses config.keyassignment, so a change to config.keyassignment can break mux.domain, while a change to mux.domain can't break config.keyassignment.
Position
Below the diagonal: mux.domain uses a module listed above it, which is the healthy direction.
mux.domain uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.domain, while a change to mux.domain can't break wezterm_term.terminal.
Position
Below the diagonal: mux.domain uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in mux.pane uses a type in wezterm_dynamic.value.
The types involved
mux.pane.Pane → wezterm_dynamic.value.Value
Direction
mux.pane uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break mux.pane, while a change to mux.pane can't break wezterm_dynamic.value.
Position
Below the diagonal: mux.pane uses a module listed above it, which is the healthy direction.
mux.pane uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break mux.pane, while a change to mux.pane can't break wezterm_surface.line.line.
Position
Below the diagonal: mux.pane uses a module listed above it, which is the healthy direction.
mux.pane uses config.keyassignment, so a change to config.keyassignment can break mux.pane, while a change to mux.pane can't break config.keyassignment.
Position
Below the diagonal: mux.pane uses a module listed above it, which is the healthy direction.
mux.pane uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.pane, while a change to mux.pane can't break wezterm_term.terminal.
Position
Below the diagonal: mux.pane uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses wezterm_cell, so a change to wezterm_cell can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break wezterm_cell.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses config.font, so a change to config.font can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break config.font.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses wezterm_color_types, so a change to wezterm_color_types can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break wezterm_color_types.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break wezterm_surface.line.line.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses wezterm_surface, so a change to wezterm_surface can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break wezterm_surface.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses wezterm_term.color, so a change to wezterm_term.color can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break wezterm_term.color.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses config, so a change to config can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break config.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses mux.renderable, so a change to mux.renderable can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break mux.renderable.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses wezterm_font, so a change to wezterm_font can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break wezterm_font.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses window, so a change to window can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break window.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow.render uses mux.pane, so a change to mux.pane can break kaku_gui.termwindow.render, while a change to kaku_gui.termwindow.render can't break mux.pane.
Position
Below the diagonal: kaku_gui.termwindow.render uses a module listed above it, which is the healthy direction.
mux.localpane uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break mux.localpane, while a change to mux.localpane can't break wezterm_dynamic.value.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.localpane uses wezterm_term.input, so a change to wezterm_term.input can break mux.localpane, while a change to mux.localpane can't break wezterm_term.input.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.localpane uses wezterm_input_types, so a change to wezterm_input_types can break mux.localpane, while a change to mux.localpane can't break wezterm_input_types.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.localpane uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break mux.localpane, while a change to mux.localpane can't break wezterm_surface.line.line.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.localpane uses config.keyassignment, so a change to config.keyassignment can break mux.localpane, while a change to mux.localpane can't break config.keyassignment.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.localpane uses wezterm_term.color, so a change to wezterm_term.color can break mux.localpane, while a change to mux.localpane can't break wezterm_term.color.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.localpane uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.localpane, while a change to mux.localpane can't break wezterm_term.terminal.
Position
Below the diagonal: mux.localpane uses a module listed above it, which is the healthy direction.
mux.ssh uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.ssh, while a change to mux.ssh can't break wezterm_term.terminal.
Position
Below the diagonal: mux.ssh uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses filedescriptor, so a change to filedescriptor can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break filedescriptor.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses wezterm_term.input, so a change to wezterm_term.input can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break wezterm_term.input.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses wezterm_input_types, so a change to wezterm_input_types can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break wezterm_input_types.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses config.keyassignment, so a change to config.keyassignment can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break config.keyassignment.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses wezterm_term.color, so a change to wezterm_term.color can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break wezterm_term.color.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses wezterm_term.terminal, so a change to wezterm_term.terminal can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break wezterm_term.terminal.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses mux.renderable, so a change to mux.renderable can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break mux.renderable.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
mux.termwiztermtab uses mux.domain, so a change to mux.domain can break mux.termwiztermtab, while a change to mux.termwiztermtab can't break mux.domain.
Position
Below the diagonal: mux.termwiztermtab uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_cell, so a change to wezterm_cell can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_cell.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_dynamic.value, so a change to wezterm_dynamic.value can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_dynamic.value.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_escape_parser.csi.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_term.input, so a change to wezterm_term.input can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_term.input.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses config.font, so a change to config.font can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break config.font.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses config.units, so a change to config.units can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break config.units.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_color_types, so a change to wezterm_color_types can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_color_types.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_input_types, so a change to wezterm_input_types can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_input_types.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_surface.line.line, so a change to wezterm_surface.line.line can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_surface.line.line.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses config.keyassignment, so a change to config.keyassignment can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break config.keyassignment.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_term.color, so a change to wezterm_term.color can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_term.color.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses config.color, so a change to config.color can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break config.color.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_term.terminal, so a change to wezterm_term.terminal can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_term.terminal.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses config.config, so a change to config.config can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break config.config.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses mux.renderable, so a change to mux.renderable can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break mux.renderable.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses wezterm_font, so a change to wezterm_font can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break wezterm_font.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses kaku_gui.glyphcache, so a change to kaku_gui.glyphcache can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break kaku_gui.glyphcache.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses kaku_gui.termwindow.box_model, so a change to kaku_gui.termwindow.box_model can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break kaku_gui.termwindow.box_model.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses kaku_remote.web, so a change to kaku_remote.web can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break kaku_remote.web.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses window.os.macos.window, so a change to window.os.macos.window can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break window.os.macos.window.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
kaku_gui.termwindow uses kaku_gui.termwindow.render, so a change to kaku_gui.termwindow.render can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break kaku_gui.termwindow.render.
Position
Below the diagonal: kaku_gui.termwindow uses a module listed above it, which is the healthy direction.
37→39 kaku_gui.termwindow uses kaku_gui.overlay.copypart of a loop✕
Connections
1 pair of types, where a type in kaku_gui.termwindow uses a type in kaku_gui.overlay.copy.
kaku_gui.termwindow uses kaku_gui.overlay.copy, so a change to kaku_gui.overlay.copy can break kaku_gui.termwindow, while a change to kaku_gui.termwindow can't break kaku_gui.overlay.copy.
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.
wezterm_client.client uses filedescriptor, so a change to filedescriptor can break wezterm_client.client, while a change to wezterm_client.client can't break filedescriptor.
Position
Below the diagonal: wezterm_client.client uses a module listed above it, which is the healthy direction.
wezterm_client.client uses mux.domain, so a change to mux.domain can break wezterm_client.client, while a change to wezterm_client.client can't break mux.domain.
Position
Below the diagonal: wezterm_client.client uses a module listed above it, which is the healthy direction.
wezterm_client.client uses mux.pane, so a change to mux.pane can break wezterm_client.client, while a change to wezterm_client.client can't break mux.pane.
Position
Below the diagonal: wezterm_client.client uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses wezterm_cell, so a change to wezterm_cell can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break wezterm_cell.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break wezterm_escape_parser.csi.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses wezterm_term.input, so a change to wezterm_term.input can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break wezterm_term.input.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses wezterm_input_types, so a change to wezterm_input_types can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break wezterm_input_types.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses config.keyassignment, so a change to config.keyassignment can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break config.keyassignment.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses kaku_gui.overlay.ai_chat.types, so a change to kaku_gui.overlay.ai_chat.types can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break kaku_gui.overlay.ai_chat.types.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses wezterm_term.color, so a change to wezterm_term.color can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break wezterm_term.color.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses wezterm_term.terminal, so a change to wezterm_term.terminal can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break wezterm_term.terminal.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses mux.renderable, so a change to mux.renderable can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break mux.renderable.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses mux.tab, so a change to mux.tab can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break mux.tab.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses mux.domain, so a change to mux.domain can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break mux.domain.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses mux.pane, so a change to mux.pane can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break mux.pane.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.copy uses kaku_gui.termwindow, so a change to kaku_gui.termwindow can break kaku_gui.overlay.copy, while a change to kaku_gui.overlay.copy can't break kaku_gui.termwindow.
Position
Below the diagonal: kaku_gui.overlay.copy uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses wezterm_escape_parser.csi, so a change to wezterm_escape_parser.csi can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break wezterm_escape_parser.csi.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses wezterm_term.input, so a change to wezterm_term.input can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break wezterm_term.input.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses wezterm_input_types, so a change to wezterm_input_types can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break wezterm_input_types.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses config.keyassignment, so a change to config.keyassignment can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break config.keyassignment.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses kaku_gui.overlay.ai_chat.types, so a change to kaku_gui.overlay.ai_chat.types can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break kaku_gui.overlay.ai_chat.types.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses wezterm_term.color, so a change to wezterm_term.color can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break wezterm_term.color.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses config, so a change to config can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break config.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses wezterm_term.terminal, so a change to wezterm_term.terminal can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break wezterm_term.terminal.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses mux.renderable, so a change to mux.renderable can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break mux.renderable.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses mux.domain, so a change to mux.domain can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break mux.domain.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses mux.pane, so a change to mux.pane can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break mux.pane.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
kaku_gui.overlay.quickselect uses kaku_gui.termwindow, so a change to kaku_gui.termwindow can break kaku_gui.overlay.quickselect, while a change to kaku_gui.overlay.quickselect can't break kaku_gui.termwindow.
Position
Below the diagonal: kaku_gui.overlay.quickselect uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 60% · Adequate · gated by D1, D2, X4 ·
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
40
High / Critical
A03:2025 — Software Supply Chain Failures
18
High / Critical
A02:2025 — Security Misconfiguration
3
Medium
Roadmap
Top priorities: 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; Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
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.
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
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 — 65
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 — 1680
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 — 229
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 18
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, 1881 of 1974 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 Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. 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 132 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 32 test source file(s) (.rs, .py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs, .py, .cjs) and this repository declares a Cargo test suite (repository root, 181 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — 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. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — 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. 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 on C# first (docs/plans/deterministic-engine.md, P5): 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 — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `crates/kaku-remote/assets/web/xterm-webgl.js` 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.
AX6 Interface segregation — 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
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 REDACTED (REDACTED). docker build failed (exit 1) — 10 | COPY crates/kaku-relay/src crates/kaku-relay/src 11 | >>> COPY crates/kaku-remote/assets/web crates/kaku-remote/assets/web 12 | 13 | WORKDIR /app/crates/kaku-relay -------------------- ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 22e9f259-eb21-4195-884a-5b013bd983e8::yu765q9thhkyv8yis52hcgd5z: "/crates/kaku-remote/assets/web": not found; runtime evidence skipped.
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. 'rusqlite' is imported (kaku/src/ai_config/tui/providers/mod.rs:183), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
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. 'rusqlite' is imported (kaku/src/ai_config/tui/providers/mod.rs:183), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
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. 'rusqlite' is imported (kaku/src/ai_config/tui/providers/mod.rs:183), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
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. 'rusqlite' is imported (kaku/src/ai_config/tui/providers/mod.rs:183), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
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 and Scala source only, and this repository's Rust, lua 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 and Scala source only, and this repository's Rust, lua 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.
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.
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.
X26 Unsynchronised callback handoff — 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, and Java, Kotlin, Scala, Go, Swift, Python and Ruby source only, and no C# was loaded, no Java, Kotlin, Scala, Go, Swift, Python or Ruby was found, and this repository's Lua 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.
X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X5 Nullable reference types — 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 and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Lua, Rust 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.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 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.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
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.
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.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. 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.
DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
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.
249 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was PhysKeyCode::for_each_code at 321. A further 34 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 BlockKey::from_char at 371 — they are counted neither in the figure above nor in this dimension's score. 8 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: kaku-gui/src/overlay/copy.rs (CopyOverlay::perform_assignment at 42), config/src/background.rs (GradientPreset::build at 38), crates/wezterm-ssh/src/sftp/error.rs (SftpError::try_from at 23), kaku-gui/src/inputmap.rs (kaku_gui::inputmap::ui_key at 22), kaku/src/cli/mod.rs (kaku::cli::run_cli_async at 21), and 3 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 104 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with PhysKeyCode::for_each_code (cyclomatic 321), TermWindow::perform_key_assignment (cyclomatic 175), kaku_gui::commands::derive_command_from_key_assignment (cyclomatic 167). — 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 3 together lifts Cyclomatic Complexity from 3.5 to about 5.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; 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.
+ 160 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 10 bodies over 120 down to 120 or less in Cognitive Complexity — start with PhysKeyCode::for_each_code (cognitive 427), kaku_remote::web::run_session (cognitive 385), TermWindow::render_screen_line (cognitive 218). — 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 10 together lifts Cognitive Complexity from 2.0 to about 2.9/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.0 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 101 MethodTooLong finding(s) in God Classes — start with mod.rs (15), lib.rs (11), window.rs (4). — One of this dimension's main actionable groups (101 warning-level).
Resolve the 82 FileTooLong finding(s) in God Classes — start with mod.rs (10), lib.rs (9), main.rs (2). — One of this dimension's main actionable groups (82 warning-level).
Resolve the 49 FunctionTooLong finding(s) in God Classes — start with mod.rs (6), lib.rs (5), web.rs (3). — One of this dimension's main actionable groups (49 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.
352 duplicated block group(s) detected. 4.6 % of the production lines (14,154 of 308,279) are in a reported copy. A further 186 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.
+ 177 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 28 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with search.rs (3), pty.rs (2), mod.rs (2). — One of this dimension's main actionable groups (28 warning-level).
Resolve the 27 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with customglyph.rs (5), mod.rs (4), palette.rs (2). — One of this dimension's main actionable groups (27 warning-level).
Resolve the 26 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with mod.rs (4), customglyph.rs (3), shell.rs (2). — One of this dimension's main actionable groups (26 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling7.2 / 10Strong✓ 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.
64 production modules (Cargo), 0 dependency cycle(s), 6 unstable depended-on module(s). Read from the build's own module declarations; 15 module(s) off the main sequence, with abstractness counted on 51 of the 64 (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: bintree · ×15
Unstable project color-funcs
Unstable project env-bootstrap
Unstable project kaku
Unstable project mux-lua
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 15 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (15 warning-level).
Resolve the 1 Unstable project color-funcs finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Unstable project env-bootstrap 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.
Low cohesion: Element (LCOM4 13) · ×5kaku-gui/src/termwindow/box_model.rs:223
What to do
Resolve the 5 Low cohesion finding(s) in Cohesion (LCOM4) — start with box_model.rs, config.rs, connection.rs. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality9.9 / 10Stronggated by 1 serious finding✓ 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.
4 skipped (4 with a documented reason), 1 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 132 tests. Measured on the JavaScript/TypeScript suite only — at least 32 test source file(s) (.rs, .py) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: an upload waiting for relay authentication settles when its socket closescrates/kaku-remote/tests/web.test.cjs:1154
Skipped (documented): a lost WebGL context hands the grid to the DOM at once and comes back · ×4crates/kaku-remote/tests/web.test.cjs:1949
What to do
Resolve the 1 No assertions finding(s) in Test Quality — start with web.test.cjs. — One of this dimension's main actionable groups (1 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.
59 outdated, 0 yanked direct Cargo dependencies. 160 of 163 direct crates were graded against crates.io (0 not published there, 3 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: anyhow · ×59
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
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 717 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. A further 1 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict.
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: kaku-gui/src/termwindow/mod.rs (45×175=7875); crates/kaku-remote/src/web.rs (61×119=7259); crates/kaku-remote/assets/web/index.html (109×46=5014) Repeated repair below the complexity floor: window/src/os/macos/menu.rs (4 of 7 changes were fixes); kaku-gui/src/termwindow/render/agent_title.rs (4 of 6 changes were fixes); window/src/lib.rs (4 of 6 changes were fixes)
Resolve the 35 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (4), main.rs (2), web.rs. — One of this dimension's main actionable groups (35 warning-level).
Resolve the 9 Repeated repair finding(s) in Churn × Complexity Hotspots — start with menu.rs, agent_title.rs, lib.rs. — One of this dimension's main actionable groups (9 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.6 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
45 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is kaku-gui/src/customglyph.rs. Counted over 334 of the 438 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 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
78 deducted task-comment markers across 308279 LoC (0.0/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 48 TodoComment finding(s) in Explicit Debt — start with mod.rs (5), terminfo.rs (4), pane.rs (4). — One of this dimension's main actionable groups (48 warning-level).
Resolve the 30 FixmeComment finding(s) in Explicit Debt — start with lib.rs (4), commands.rs (4), window.rs (3). — One of this dimension's main actionable groups (30 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 25 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
What it measures: 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).
40 finding(s): 0 critical, 39 high, 1 medium, 0 low. semgrep hit a parse error in 142 file(s) — `assets/shell-integration/kaku.sh` (lines 54–55, line 60, line 62, …), `assets/shell-integration/setup_zsh.sh` (line 1039, lines 2017–2519), `crates/kaku-remote/assets/web/desktop.js`, `crates/kaku-remote/assets/web/xterm-webgl.js` (line 1), `crates/kaku-remote/assets/web/xterm.js`, … (+137 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 25 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (12), REDACTED (3), REDACTED (3). — One of this dimension's main actionable groups (25 issue-level).
Resolve the 7 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4), REDACTED, REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-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 5 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (5). — One of this dimension's main actionable groups (5 warning-level).
Resolve the 5 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (5). — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 2 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d31_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.
137 of 334 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/bidi/src/bidi_class.rs. Counted over 334 of the 438 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 115 Orphaned file finding(s) in Knowledge Freshness — start with lib.rs (21), mod.rs (6), error.rs (4). — One of this dimension's main actionable groups (115 recommendation-level).
Resolve the 22 Orphaned knowledge finding(s) in Knowledge Freshness — start with lib.rs (5), domain.rs (2), bidi_class.rs. — One of this dimension's main actionable groups (22 issue-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
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.
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
1 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d44_recommendation.md · top locations in Appendix A, every location in findings.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 & labels5.4 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has 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. — crates/kaku-remote/assets/web/index.html:283
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. Wrap the primary content in <main>. — crates/kaku-remote/assets/web/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 interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — crates/kaku-remote/assets/web/index.html:284
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
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.
`body.phone #mobile-tabs` moves (`transition: transform 0.2s ease-out, visibility 0s 0.2s`) 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. — crates/kaku-remote/assets/web/index.html:46
`body.phone #mobile-tabs.show` moves (`transition: transform 0.2s ease-out`) 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. — crates/kaku-remote/assets/web/index.html:47
`#bar .dot.in` moves (`animation: dot-in 0.25s ease-out`) 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. — crates/kaku-remote/assets/web/index.html:94
`#bar .dot.out` moves (`animation: dot-out 0.3s ease-in forwards`) 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. — crates/kaku-remote/assets/web/index.html:95
`.mobile-row input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/kaku-remote/assets/web/index.html:58
`#bar .tab input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/kaku-remote/assets/web/index.html:108
`#find input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/kaku-remote/assets/web/index.html:168
`#dialog` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/kaku-remote/assets/web/index.html:219
`#dialog button:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/kaku-remote/assets/web/index.html:233
`.xterm.focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — crates/kaku-remote/assets/web/xterm.css:48
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 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 · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Other · Domain Modelling — Whether an aggregate references another aggregate by identity rather than embedding it by object reference.
Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.
Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.
Other · Domain Modelling — Whether domain identifiers are strongly typed (a newtype wrapper) rather than raw primitives — consistency once an idiom exists.
Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. Deterministic, adoption percentage.
Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.
Do you agree with this assessment?
DM4 · Rich vs anemic domain model7.9 / 10Strong✓ Tool-verified
Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
`DecodedPdu` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside. — crates/codec/src/lib.rs:287
What to do
Move the domain logic onto the entity (invariant-enforcing `&mut self` commands) instead of a foreign service.
Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.
Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.
Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.
Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.
Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
term/README.md links to `terminal/struct.Terminal.html`, but `term/terminal/struct.Terminal.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — term/README.md:18
What to do
Reconcile the README with reality: term/README.md links to `terminal/struct.Terminal.html`, but `term/terminal/struct.Terminal.html` does not exist.
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✓ Tool-verified
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.
1 public type in `window.os.macos.window` is marked as implementation by its own namespace, folder or name: `BackendImpl` (window/src/os/macos/window.rs:212, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — window/src/os/macos/window.rs:212
What to do
Hide `window.os.macos.window` (`BackendImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Do you agree with this assessment?
P2 · Observability7.9 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 25/26 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/wezterm-char-props/codegen`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
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.
`reqwest::blocking::get(` 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. — crates/wezterm-char-props/codegen/src/main.rs:22
What to do
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
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.
Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. This repository serves HTTP itself (`axum::serve(` (crates/kaku-remote/src/lib.rs:709)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
Set: Referrer-Policy. Missing: Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each.(−2.0 on this card.) The server: `axum::serve(` (crates/kaku-remote/src/lib.rs:709).
No handler of this repository's Rust server answers 400, 413 or 422 (`StatusCode::BAD_REQUEST`, `HttpResponse::BadRequest()`, `Status::BadRequest`, tonic `Status::invalid_argument`), and nothing declares validation — no `validator`/`garde` derive, no body limit (`DefaultBodyLimit::max`, `RequestBodyLimitLayer`, `JsonConfig::default().limit(…)`, Rocket `Limits`) — nothing shows inbound requests being checked, and refused, before a handler acts on them. A check that answers its failure with 200 and an error body is not seen. (−2.0 on this card.) The server: `axum::serve(` (crates/kaku-remote/src/lib.rs:709).
What to do
Add Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options beside the headers the Rust server already sets.
Validate what the server reads from a request — path, query, headers, body size and shape — and answer what fails with 400 (413 for an oversized body) before a handler acts on it: derive `validator::Validate` (or `garde::Validate`) on the request types and reject with `StatusCode::BAD_REQUEST`, and cap bodies with `DefaultBodyLimit::max`/`RequestBodyLimitLayer` or actix's `JsonConfig::default().limit(…)`.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
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.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. 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.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`info!` at line 786 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:786
`info!` at line 877 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:877
`info!` at line 882 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:882
`info!` at line 1047 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1047
`warn!` at line 1283 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1283
`warn!` at line 1291 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1291
`info!` at line 1320 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1320
`info!` at line 1339 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1339
`info!` at line 1352 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1352
`info!` at line 1362 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/kaku-relay/src/main.rs:1362
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 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 — 17 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 5 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not 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: this repository stores data through 'rusqlite' (kaku/src/ai_config/tui/providers/mod.rs:183) but declares no persisted model this check reads (Diesel table! columns, SeaORM entity / Diesel model / sqlx FromRow struct fields, CREATE TABLE and ALTER TABLE … ADD columns in SQL migrations and SQL string literals). Personal data may be written through raw SQL or a hosted backend, so whether its changes need an audit trail could not be established, and the trail's absence is not scored.
C4 Data Retention — Not assessed: this repository stores data through 'rusqlite' (kaku/src/ai_config/tui/providers/mod.rs:183) but declares no persisted model this check reads (Diesel table! columns, SeaORM entity / Diesel model / sqlx FromRow struct fields, CREATE TABLE and ALTER TABLE … ADD columns in SQL migrations and SQL string literals). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
C5 Data-Subject Rights — Not assessed: this repository stores data through 'rusqlite' (kaku/src/ai_config/tui/providers/mod.rs:183) but declares no persisted model this check reads (Diesel table! columns, SeaORM entity / Diesel model / sqlx FromRow struct fields, CREATE TABLE and ALTER TABLE … ADD columns in SQL migrations and SQL string literals). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 52 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.
AX1 Captive dependencies — Not applicable: 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.
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. 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
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — docker build failed (exit 1) — 10 | COPY crates/kaku-relay/src crates/kaku-relay/src 11 | >>> COPY crates/kaku-remote/assets/web crates/kaku-remote/assets/web 12 | 13 | WORKDIR /app/crates/kaku-relay -------------------- ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 22e9f259-eb21-4195-884a-5b013bd983e8::yu765q9thhkyv8yis52hcgd5z: "/crates/kaku-remote/assets/web": not found; runtime evidence skipped 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: this repository stores data through 'rusqlite' (kaku/src/ai_config/tui/providers/mod.rs:183) but declares no persisted model this check reads (Diesel table! columns, SeaORM entity / Diesel model / sqlx FromRow struct fields, CREATE TABLE and ALTER TABLE … ADD columns in SQL migrations and SQL string literals). Personal data may be written through raw SQL or a hosted backend, so the absence of a personal-data field here is not evidence that none is stored, and encryption at rest is not scored over a subject that could not be established.
D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
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.
D21 Naming Consistency — Naming consistency does not read html yet; not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust 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. Aggregate roots were found in only one source directory (mux), which is a layered codebase, not two contexts. 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 — no ADRs to check
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not measured — Rust suite
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
DM6 Domain ↔ infrastructure boundary — this Rust crate maps no type to a persistence framework (diesel/sea-orm/sqlx), so DM6's domain↔infrastructure fusion read has no population to be taken over
DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and 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
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, 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
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.
X12 Unreachable branch — X12 reached only 2% of this repository's production lines — rust (307,611 lines), lua (4,750 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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 2% of this repository's production lines — rust (307,611 lines), lua (4,750 lines), python (668 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
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.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not 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
X3 Exception handling — X3 reached only 2% of this repository's production lines — rust (307,611 lines), lua (4,750 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.
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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.
Orphaned knowledge crates/bidi/src/bidi_class.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/bidi/src/lib.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/wezterm-surface/src/lib.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/wezterm-ssh/src/config.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge termwiz/src/render/terminfo.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/wezterm-ssh/src/sessioninner.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/wezterm-char-props/src/widechar_width.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/color-types/src/lib.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/vtparse/src/lib.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/wezterm-escape-parser/src/tmux_cc/mod.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/wezterm-client/src/domain.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/wezterm-font/src/hbwrap.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/wezterm-font/src/rasterizer/freetype.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/wezterm-font/src/parser.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/wezterm-client/src/pane/renderable.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge termwiz/src/widgets/layout.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge mux/src/pane_encoding.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge mux/src/domain.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/wezterm-client/src/pane/clientpane.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/bintree/src/lib.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge kaku-gui/src/termwindow/background.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge kaku-gui/src/shapecache.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
AC2 · Forms & labels· <input> without a programmatic label · ×1
<input> without a programmatic label crates/kaku-remote/assets/web/index.html:283— 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.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×1
Click handler on a non-interactive <div> crates/kaku-remote/assets/web/index.html:284— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
DM4 · Rich vs anemic domain model· Anemic domain model · ×1
Anemic domain model: DecodedPdu crates/codec/src/lib.rs:287— `DecodedPdu` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside.
MethodTooLong: BlockKey.from_char kaku-gui/src/customglyph.rs:722— MethodTooLong — from_char runs 2925 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 2825 over it, 29.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GlyphCache.block_sprite kaku-gui/src/customglyph.rs:5175— MethodTooLong — block_sprite runs 612 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 512 over it, 6.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SessionHandler.process_one crates/wezterm-mux-server-impl/src/sessionhandler.rs:246— MethodTooLong — process_one runs 551 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 451 over it, 5.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: TermWindow.perform_key_assignment kaku-gui/src/termwindow/mod.rs:4845— MethodTooLong — perform_key_assignment runs 540 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
MethodTooLong: TermWindow.render_screen_line kaku-gui/src/termwindow/render/screen_line.rs:108— MethodTooLong — render_screen_line runs 462 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 362 over it, 4.62× 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: TermWindow.mouse_event_terminal kaku-gui/src/termwindow/mouseevent.rs:1893— MethodTooLong — mouse_event_terminal runs 437 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 337 over it, 4.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TermWindow.paint_pane kaku-gui/src/termwindow/render/pane.rs:152— MethodTooLong — paint_pane runs 427 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 327 over it, 4.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TerminalState.perform_csi_mode term/src/terminalstate/mod.rs:1683— MethodTooLong — perform_csi_mode runs 372 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 272 over it, 3.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.
MethodTooLong: TermWindow.new_window kaku-gui/src/termwindow/mod.rs:1626— MethodTooLong — new_window runs 341 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 241 over it, 3.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TermWindow.build_fancy_tab_bar kaku-gui/src/termwindow/render/fancy_tab_bar.rs:58— MethodTooLong — build_fancy_tab_bar runs 320 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 220 over it, 3.20× 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: TermWindow.mouse_event_impl kaku-gui/src/termwindow/mouseevent.rs:889— MethodTooLong — mouse_event_impl runs 281 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 181 over it, 2.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Performer.osc_dispatch term/src/terminalstate/performer.rs:856— MethodTooLong — osc_dispatch runs 278 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 178 over it, 2.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CommandDef.recreate_menubar kaku-gui/src/commands.rs:666— MethodTooLong — recreate_menubar runs 273 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 173 over it, 2.73× 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: TermWindow.dispatch_notif kaku-gui/src/termwindow/mod.rs:2447— MethodTooLong — dispatch_notif runs 272 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
MethodTooLong: TabBarState.new kaku-gui/src/tabbar.rs:1006— MethodTooLong — new runs 267 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: TerminfoRenderer.render_to termwiz/src/render/terminfo.rs:337— MethodTooLong — render_to runs 256 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 156 over it, 2.56× 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: WindowView.key_common window/src/os/macos/window.rs:8752— MethodTooLong — key_common runs 256 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 156 over it, 2.56× 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: TermWindow.paint_pass kaku-gui/src/termwindow/render/paint.rs:261— MethodTooLong — paint_pass runs 245 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
MethodTooLong: MuxPane.add_methods lua-api-crates/mux/src/pane.rs:88— MethodTooLong — add_methods runs 241 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 141 over it, 2.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: WindowView.define_class window/src/os/macos/window.rs:10034— MethodTooLong — define_class runs 239 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GuiWin.add_methods kaku-gui/src/scripting/guiwin.rs:35— MethodTooLong — add_methods runs 237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TermWindow.compute_element kaku-gui/src/termwindow/box_model.rs:542— MethodTooLong — compute_element runs 236 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 136 over it, 2.36× 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: InputMap.new kaku-gui/src/inputmap.rs:26— MethodTooLong — new runs 229 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 129 over it, 2.29× 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: KeyEvent.encode_kitty crates/wezterm-input-types/src/lib.rs:1660— MethodTooLong — encode_kitty runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× 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: WebGpuState.new_impl kaku-gui/src/termwindow/webgpu.rs:225— MethodTooLong — new_impl runs 212 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FileTooLong: macos/window.rs window/src/os/macos/window.rs— FileTooLong — 4772 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 116 free functions. The bar is 500 significant lines; this is 4272 over it, 9.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: termwindow/mod.rs kaku-gui/src/termwindow/mod.rs— FileTooLong — 4639 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 84% of them inside a single declaration: TermWindow (5 blocks, 1058-6973). The bar is 500 significant lines; this is 4139 over it, 9.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: src/customglyph.rs kaku-gui/src/customglyph.rs— FileTooLong — 3914 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 76% of them inside a single declaration: BlockKey (2 blocks, 218-5033). The bar is 500 significant lines; this is 3414 over it, 7.83× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: web/index.html crates/kaku-remote/assets/web/index.html— FileTooLong — 2943 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2443 over it, 5.89× 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: ai_config/tui.rs kaku/src/ai_config/tui.rs— FileTooLong — 2267 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 1767 over it, 4.53× 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/web.rs crates/kaku-remote/src/web.rs— FileTooLong — 2235 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 75 free functions. The bar is 500 significant lines; this is 1735 over it, 4.47× 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/bidi_class.rs crates/bidi/src/bidi_class.rs— FileTooLong — 2224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1724 over it, 4.45× 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/commands.rs kaku-gui/src/commands.rs— FileTooLong — 2092 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1592 over it, 4.18× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/csi.rs crates/wezterm-escape-parser/src/csi.rs— FileTooLong — 1932 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1432 over it, 3.86× 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: terminalstate/mod.rs term/src/terminalstate/mod.rs— FileTooLong — 1848 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 87% of them inside a single declaration: TerminalState (2 blocks, 302-2995). The bar is 500 significant lines; this is 1348 over it, 3.70× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/config.rs config/src/config.rs— FileTooLong — 1753 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 65% of them inside a single declaration: Config (3 blocks, 52-2173), declaring 87 free functions. The bar is 500 significant lines; this is 1253 over it, 3.51× 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: ai_chat/state.rs kaku-gui/src/overlay/ai_chat/state.rs— FileTooLong — 1739 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: App (2 blocks, 704-2526). The bar is 500 significant lines; this is 1239 over it, 3.48× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/lib.rs crates/wezterm-input-types/src/lib.rs— FileTooLong — 1702 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1202 over it, 3.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/tab.rs mux/src/tab.rs— FileTooLong — 1679 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 62% of them inside a single declaration: TabInner (2 blocks, 93-2584). The bar is 500 significant lines; this is 1179 over it, 3.36× 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: termwindow/mouseevent.rs kaku-gui/src/termwindow/mouseevent.rs— FileTooLong — 1656 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: TermWindow (503-2560). The bar is 500 significant lines; this is 1156 over it, 3.31× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: providers/mod.rs kaku/src/ai_config/tui/providers/mod.rs— FileTooLong — 1576 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 101 free functions. The bar is 500 significant lines; this is 1076 over it, 3.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: overlay/copy.rs kaku-gui/src/overlay/copy.rs— FileTooLong — 1424 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 924 over it, 2.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs mux/src/lib.rs— FileTooLong — 1271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 771 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/osc.rs crates/wezterm-escape-parser/src/osc.rs— FileTooLong — 1116 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 616 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: config_tui/mod.rs kaku/src/config_tui/mod.rs— FileTooLong — 1092 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: App (2 blocks, 361-1611). The bar is 500 significant lines; this is 592 over it, 2.18× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: macos/app.rs window/src/os/macos/app.rs— FileTooLong — 1072 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 59 free functions. The bar is 500 significant lines; this is 572 over it, 2.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/lib.rs crates/bidi/src/lib.rs— FileTooLong — 1049 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 73% of them inside a single declaration: BidiContext (2 blocks, 75-1729). The bar is 500 significant lines; this is 549 over it, 2.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/ftwrap.rs crates/wezterm-font/src/ftwrap.rs— FileTooLong — 1026 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 66% of them inside a single declaration: Face (3 blocks, 98-1155). The bar is 500 significant lines; this is 526 over it, 2.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: src/doctor.rs kaku/src/doctor.rs— FileTooLong — 1024 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 39 free functions. The bar is 500 significant lines; this is 524 over it, 2.05× 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/tabbar.rs kaku-gui/src/tabbar.rs— FileTooLong — 1017 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 43 free functions. The bar is 500 significant lines; this is 517 over it, 2.03× 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.
kaku_gui::cli_chat::run_repl (cognitive 116) kaku-gui/src/cli_chat/mod.rs:548— kaku_gui::cli_chat::run_repl has cognitive complexity 116 (threshold 15). Drivers by points: if/else 28 (79 pts), match/switch 6 (25 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_gui::overlay::ai_chat::input::handle_key (cognitive 76) kaku-gui/src/overlay/ai_chat/input.rs:10— kaku_gui::overlay::ai_chat::input::handle_key has cognitive complexity 76 (threshold 15). Drivers by points: if/else 32 (63 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::ai_tools::search::fallback_regex_search (cognitive 75) kaku-gui/src/ai_tools/search.rs:269— kaku_gui::ai_tools::search::fallback_regex_search has cognitive complexity 75 (threshold 15). Drivers by points: if/else 25 (63 pts), loops 5 (10 pts), boolean chains 2 (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.
kaku_gui::ai_chat_engine::run_agent (cognitive 74) kaku-gui/src/ai_chat_engine/mod.rs:387— kaku_gui::ai_chat_engine::run_agent has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (57 pts), match/switch 4 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::update::update_checker (cognitive 68) kaku-gui/src/update.rs:555— kaku_gui::update::update_checker has cognitive complexity 68 (threshold 15). Drivers by points: if/else 17 (52 pts), match/switch 3 (12 pts), boolean chains 3, loops 1 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_gui::ai_client::responses::parse_responses_sse (cognitive 66) kaku-gui/src/ai_client/responses.rs:205— kaku_gui::ai_client::responses::parse_responses_sse has cognitive complexity 66 (threshold 15). Drivers by points: if/else 26 (61 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::commands::derive_command_from_key_assignment (cognitive 61) kaku-gui/src/commands.rs:1108— kaku_gui::commands::derive_command_from_key_assignment has cognitive complexity 61 (threshold 15). Drivers by points: if/else 35 (50 pts), match/switch 4 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::overlay::ai_chat::input::handle_mouse (cognitive 58) kaku-gui/src/overlay/ai_chat/input.rs:424— kaku_gui::overlay::ai_chat::input::handle_mouse has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (50 pts), boolean chains 7, match/switch 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_gui::overlay::ai_chat::markdown::wrap_segments (cognitive 58) kaku-gui/src/overlay/ai_chat/markdown.rs:451— kaku_gui::overlay::ai_chat::markdown::wrap_segments has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (42 pts), loops 4 (7 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_gui::overlay::ai_chat::markdown::parse_markdown_blocks (cognitive 52) kaku-gui/src/overlay/ai_chat/markdown.rs:17— kaku_gui::overlay::ai_chat::markdown::parse_markdown_blocks has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (43 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_gui::ai_tools::project::exec_project_summary (cognitive 50) kaku-gui/src/ai_tools/project.rs:6— kaku_gui::ai_tools::project::exec_project_summary has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (38 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::ai_tools::search::exec_grep_search (cognitive 50) kaku-gui/src/ai_tools/search.rs:734— kaku_gui::ai_tools::search::exec_grep_search has cognitive complexity 50 (threshold 15). Drivers by points: if/else 21 (43 pts), match/switch 2 (4 pts), loops 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::overlay::ai_chat::render::render_chat (cognitive 49) kaku-gui/src/overlay/ai_chat/render.rs:463— kaku_gui::overlay::ai_chat::render::render_chat has cognitive complexity 49 (threshold 15). Drivers by points: if/else 27 (38 pts), boolean chains 5, loops 3, 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.
kaku_gui::remote_tabs::perform (cognitive 48) kaku-gui/src/remote_tabs.rs:21— kaku_gui::remote_tabs::perform has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (44 pts), match/switch 3 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::overlay::ai_chat::state::emit_assistant_markdown (cognitive 42) kaku-gui/src/overlay/ai_chat/state.rs:476— kaku_gui::overlay::ai_chat::state::emit_assistant_markdown has cognitive complexity 42 (threshold 15). Drivers by points: loops 8 (23 pts), match/switch 4 (13 pts), if/else 2 (5 pts), boolean chains 1 (nesting depth added 27). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
kaku_gui::termwindow::wrapped_link::rejoined_links (cognitive 42) kaku-gui/src/termwindow/wrapped_link.rs:96— kaku_gui::termwindow::wrapped_link::rejoined_links has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 10, loops 7 (10 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::overlay::ai_chat::ai_chat_overlay (cognitive 41) kaku-gui/src/overlay/ai_chat/mod.rs:82— kaku_gui::overlay::ai_chat::ai_chat_overlay has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 4 (9 pts), boolean chains 5, 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.
kaku_gui::ai_client::responses::emit_response_output (cognitive 40) kaku-gui/src/ai_client/responses.rs:442— kaku_gui::ai_client::responses::emit_response_output has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 3 (12 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::ai_chat_engine::approval::curl_is_dangerous (cognitive 33) kaku-gui/src/ai_chat_engine/approval.rs:372— kaku_gui::ai_chat_engine::approval::curl_is_dangerous has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (7 pts), boolean chains 6, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::overlay::confirm::run_confirmation_impl (cognitive 33) kaku-gui/src/overlay/confirm.rs:43— kaku_gui::overlay::confirm::run_confirmation_impl has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 5 (6 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::ai_chat_engine::approval::split_shell_segments (cognitive 32) kaku-gui/src/ai_chat_engine/approval.rs:117— kaku_gui::ai_chat_engine::approval::split_shell_segments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 8, 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.
kaku_gui::ai_tools::search::exec_symbol_search (cognitive 31) kaku-gui/src/ai_tools/search.rs:557— kaku_gui::ai_tools::search::exec_symbol_search has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 2 (3 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::ai_client::responses::translate_responses_messages (cognitive 30) kaku-gui/src/ai_client/responses.rs:18— kaku_gui::ai_client::responses::translate_responses_messages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::ai_tools::shell::exec_shell_exec (cognitive 29) kaku-gui/src/ai_tools/shell.rs:98— kaku_gui::ai_tools::shell::exec_shell_exec has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_gui::async_run_terminal_gui (cognitive 28) kaku-gui/src/main.rs:350— kaku_gui::async_run_terminal_gui has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionTooLong: kaku_gui::commands::derive_command_from_key_assignment kaku-gui/src/commands.rs:1108— FunctionTooLong — kaku_gui::commands::derive_command_from_key_assignment runs 1283 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1183 over it, 12.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: index.html.onFrame crates/kaku-remote/assets/web/index.html:3083— FunctionTooLong — onFrame runs 382 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 282 over it, 3.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.
FunctionTooLong: kaku_remote::web::run_session crates/kaku-remote/src/web.rs:2818— FunctionTooLong — kaku_remote::web::run_session runs 357 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 257 over it, 3.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: kaku_gui::ai_tools::registry::all_tools kaku-gui/src/ai_tools/registry.rs:15— FunctionTooLong — kaku_gui::ai_tools::registry::all_tools runs 308 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 208 over it, 3.08× 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: wezterm_escape_parser::tmux_cc::parse_line crates/wezterm-escape-parser/src/tmux_cc/mod.rs:219— FunctionTooLong — wezterm_escape_parser::tmux_cc::parse_line runs 259 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 159 over it, 2.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: kaku_gui::overlay::ai_chat::input::handle_key kaku-gui/src/overlay/ai_chat/input.rs:10— FunctionTooLong — kaku_gui::overlay::ai_chat::input::handle_key runs 249 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 149 over it, 2.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.
FunctionTooLong: kaku_gui::cli_chat::run_repl kaku-gui/src/cli_chat/mod.rs:548— FunctionTooLong — kaku_gui::cli_chat::run_repl runs 224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku_gui::ai_chat_engine::run_agent kaku-gui/src/ai_chat_engine/mod.rs:387— FunctionTooLong — kaku_gui::ai_chat_engine::run_agent runs 223 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku_gui::overlay::copy::copy_key_table kaku-gui/src/overlay/copy.rs:1832— FunctionTooLong — kaku_gui::overlay::copy::copy_key_table runs 198 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
FunctionTooLong: kaku_gui::overlay::ai_chat::render::render_chat kaku-gui/src/overlay/ai_chat/render.rs:463— FunctionTooLong — kaku_gui::overlay::ai_chat::render::render_chat runs 193 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× 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: mux::ssh::connect_ssh_session mux/src/ssh.rs:430— FunctionTooLong — mux::ssh::connect_ssh_session runs 177 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 77 over it, 1.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: kaku_remote::web::handle_input crates/kaku-remote/src/web.rs:2516— FunctionTooLong — kaku_remote::web::handle_input runs 165 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: wezterm_font::rasterizer::harfbuzz::record_to_cairo_surface crates/wezterm-font/src/rasterizer/harfbuzz.rs:104— FunctionTooLong — wezterm_font::rasterizer::harfbuzz::record_to_cairo_surface runs 165 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku::ai_config::tui::save_field kaku/src/ai_config/tui.rs:2757— FunctionTooLong — kaku::ai_config::tui::save_field runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku::ai_config::tui::providers::assistant::save_kaku_assistant_field_to_path kaku/src/ai_config/tui/providers/assistant.rs:438— FunctionTooLong — kaku::ai_config::tui::providers::assistant::save_kaku_assistant_field_to_path runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku_gui::ai_tools::search::exec_grep_search kaku-gui/src/ai_tools/search.rs:734— FunctionTooLong — kaku_gui::ai_tools::search::exec_grep_search runs 154 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku_gui::ai_client::responses::parse_responses_sse kaku-gui/src/ai_client/responses.rs:205— FunctionTooLong — kaku_gui::ai_client::responses::parse_responses_sse runs 153 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× 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: config::lua::make_lua_context config/src/lua.rs:283— FunctionTooLong — config::lua::make_lua_context runs 152 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× 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: kaku_gui::overlay::confirm::run_confirmation_impl kaku-gui/src/overlay/confirm.rs:43— FunctionTooLong — kaku_gui::overlay::confirm::run_confirmation_impl runs 150 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: kaku::doctor::build_shell_integration_group kaku/src/doctor.rs:448— FunctionTooLong — kaku::doctor::build_shell_integration_group runs 138 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× 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: wezterm_font::rasterizer::colr::apply_sweep_gradient_patches crates/wezterm-font/src/rasterizer/colr.rs:298— FunctionTooLong — wezterm_font::rasterizer::colr::apply_sweep_gradient_patches runs 134 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: kaku_gui::overlay::ai_chat::ai_chat_overlay kaku-gui/src/overlay/ai_chat/mod.rs:82— FunctionTooLong — kaku_gui::overlay::ai_chat::ai_chat_overlay runs 133 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 33 over it, 1.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.
FunctionTooLong: kaku_gui::ai_tools::search::exec_symbol_search kaku-gui/src/ai_tools/search.rs:557— FunctionTooLong — kaku_gui::ai_tools::search::exec_symbol_search runs 131 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: wezterm_dynamic_derive::fromdynamic::derive_enum crates/wezterm-dynamic/derive/src/fromdynamic.rs:139— FunctionTooLong — wezterm_dynamic_derive::fromdynamic::derive_enum runs 129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× 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: kaku::update::imp::run kaku/src/update.rs:80— FunctionTooLong — kaku::update::imp::run runs 129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× 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.
TodoComment termwiz/src/input.rs:273— // TODO: also respect self.application_keypad — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment termwiz/src/widgets/mod.rs:453— // TODO: garbage collect unreachable WidgetId's from self.state — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment termwiz/src/render/terminfo.rs:547— // TODO: this isn't spec'd by terminfo, but some terminals — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment termwiz/src/render/terminfo.rs:602— // TODO: slice out the requested region of the image, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment termwiz/src/render/terminfo.rs:624— // TODO: } else if self.caps.sixel() { — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment termwiz/src/render/terminfo.rs:1083— // TODO: could we use ECMA-48 REP for this?
TodoComment termwiz/src/lineedit/mod.rs:580— // TODO: there's no way we can match anything. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment termwiz/src/lineedit/mod.rs:635— // TODO: there's no way we can match anything. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment term/src/test/c0.rs:13— // TODO: when we can set the left margin, we should test that here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment term/src/test/c0.rs:36— // TODO: when we can set the left margin, we should test that here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment term/src/terminalstate/kitty.rs:48— // TODO: make this configurable via TerminalConfiguration — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment term/src/terminalstate/kitty.rs:818— // TODO: send an EINVAL error back here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment term/src/terminalstate/mod.rs:186— // TODO: selective_erase when supported — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment term/src/terminalstate/mod.rs:1496— // TODO: see https://vt100.net/docs/vt510-rm/DECSTR.html
TodoComment mux/src/lib.rs:1597— // TODO: disambiguate with TabId — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mux/src/lib.rs:1674— // TODO: disambiguate with TabId — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mux/src/localpane.rs:1026— // TODO: do we need to proactively list available tabs here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mux/src/ssh.rs:574— // TODO: TerminalWaker assumes that we're a SystemTerminal but that — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mux/src/termwiztermtab.rs:481— // TODO: TerminalWaker assumes that we're a SystemTerminal but that — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment mux/src/termwiztermtab.rs:570— // TODO: make a singleton — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment kaku-gui/src/termwindow/keyevent.rs:1269— // TODO: consider eliminating these codes from termwiz::input::KeyCode — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment kaku-gui/src/termwindow/render/pane.rs:379— // TODO: we only have a single scrollbar in a single position. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment kaku-gui/src/termwindow/render/pane.rs:766— // TODO: render a thingy to jump to prior prompt — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment kaku-gui/src/termwindow/render/pane.rs:861— // TODO: visual bell background layer — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment kaku-gui/src/termwindow/render/pane.rs:862— // TODO: scrollbar — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TermWindow::render_screen_line (cognitive 218) kaku-gui/src/termwindow/render/screen_line.rs:108— TermWindow::render_screen_line has cognitive complexity 218 (threshold 15). Drivers by points: if/else 75 (175 pts), loops 10 (26 pts), match/switch 5 (11 pts), boolean chains 6 (nesting depth added 122). Of this number, 194 points are the body's own statements and 24 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TermWindow::mouse_event_terminal (cognitive 187) kaku-gui/src/termwindow/mouseevent.rs:1893— TermWindow::mouse_event_terminal has cognitive complexity 187 (threshold 15). Drivers by points: if/else 60 (130 pts), boolean chains 21, match/switch 10 (19 pts), loops 5 (17 pts) (nesting depth added 91). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TermWindow::mouse_event_impl (cognitive 156) kaku-gui/src/termwindow/mouseevent.rs:889— TermWindow::mouse_event_impl has cognitive complexity 156 (threshold 15). Drivers by points: if/else 61 (128 pts), match/switch 9 (17 pts), boolean chains 11 (nesting depth added 75). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TermWindow::perform_key_assignment (cognitive 152) kaku-gui/src/termwindow/mod.rs:4845— TermWindow::perform_key_assignment has cognitive complexity 152 (threshold 15). Drivers by points: if/else 62 (110 pts), match/switch 21 (38 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::paint_pane (cognitive 103) kaku-gui/src/termwindow/render/pane.rs:152— TermWindow::paint_pane has cognitive complexity 103 (threshold 15). Drivers by points: if/else 54 (77 pts), boolean chains 15, match/switch 4 (10 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::paint_pass (cognitive 96) kaku-gui/src/termwindow/render/paint.rs:261— TermWindow::paint_pass has cognitive complexity 96 (threshold 15). Drivers by points: if/else 40 (76 pts), boolean chains 10, loops 4 (5 pts), match/switch 2 (5 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::dispatch_notif (cognitive 76) kaku-gui/src/termwindow/mod.rs:2447— TermWindow::dispatch_notif has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (63 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (3 pts) (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.
TermWindow::mouse_event_tab_bar (cognitive 75) kaku-gui/src/termwindow/mouseevent.rs:1651— TermWindow::mouse_event_tab_bar has cognitive complexity 75 (threshold 15). Drivers by points: if/else 19 (55 pts), match/switch 8 (18 pts), boolean chains 2 (nesting depth added 46). 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.
TermWindow::key_event_impl (cognitive 64) kaku-gui/src/termwindow/keyevent.rs:1061— TermWindow::key_event_impl has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 7, match/switch 3 (5 pts), loops 1 (4 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.
TermWindow::selection_text (cognitive 57) kaku-gui/src/termwindow/selection.rs:90— TermWindow::selection_text has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (47 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TermWindow::process_key (cognitive 52) kaku-gui/src/termwindow/keyevent.rs:371— TermWindow::process_key has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (40 pts), boolean chains 8, match/switch 2 (4 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TermWindow::show_launcher_impl (cognitive 51) kaku-gui/src/termwindow/mod.rs:4533— TermWindow::show_launcher_impl has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 4 (7 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::apply_dimensions (cognitive 50) kaku-gui/src/termwindow/resize.rs:481— TermWindow::apply_dimensions has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (33 pts), loops 4 (11 pts), boolean chains 6 (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.
TermWindow::compute_element (cognitive 49) kaku-gui/src/termwindow/box_model.rs:542— TermWindow::compute_element has cognitive complexity 49 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 9 (18 pts), loops 4 (8 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::paint_impl (cognitive 42) kaku-gui/src/termwindow/render/paint.rs:57— TermWindow::paint_impl has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (28 pts), match/switch 4 (13 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::dispatch_window_event (cognitive 40) kaku-gui/src/termwindow/mod.rs:2081— TermWindow::dispatch_window_event has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (31 pts), match/switch 6 (9 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.
TermWindow::build_fancy_tab_bar (cognitive 39) kaku-gui/src/termwindow/render/fancy_tab_bar.rs:58— TermWindow::build_fancy_tab_bar has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (26 pts), match/switch 6 (9 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TermWindow::compute_cell_fg_bg (cognitive 37) kaku-gui/src/termwindow/render/mod.rs:702— TermWindow::compute_cell_fg_bg has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 5, match/switch 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::build_line_element_shape (cognitive 35) kaku-gui/src/termwindow/render/screen_line.rs:820— TermWindow::build_line_element_shape has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (27 pts), match/switch 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::render_element (cognitive 33) kaku-gui/src/termwindow/box_model.rs:850— TermWindow::render_element has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 4 (7 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 19). 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.
TermWindow::new_window (cognitive 33) kaku-gui/src/termwindow/mod.rs:1626— TermWindow::new_window has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (19 pts), loops 3 (8 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TermWindow::selection_lines (cognitive 32) kaku-gui/src/termwindow/selection.rs:23— TermWindow::selection_lines has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 2 (5 pts), boolean chains 3 (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.
TermWindow::subscribe_to_pane_updates (cognitive 31) kaku-gui/src/termwindow/mod.rs:3058— TermWindow::subscribe_to_pane_updates has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (30 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.
TermWindow::update_title_impl (cognitive 31) kaku-gui/src/termwindow/mod.rs:3836— TermWindow::update_title_impl has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (26 pts), match/switch 4 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TermWindow::rejoin_wrapped_link (cognitive 30) kaku-gui/src/termwindow/mod.rs:5692— TermWindow::rejoin_wrapped_link has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5, loops 2 (3 pts), match/switch 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.
ClassTooLong: TermWindow kaku-gui/src/termwindow/mod.rs:1058— ClassTooLong — 3910 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 309 methods, 5 blocks, lines 1058-6973. The bar is 400 significant lines; this is 3510 over it, 9.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BlockKey kaku-gui/src/customglyph.rs:218— ClassTooLong — 2966 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 5 methods, 2 blocks, lines 218-5033. The bar is 400 significant lines; this is 2566 over it, 7.42× 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: WindowView window/src/os/macos/window.rs:4552— ClassTooLong — 1698 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 89 methods, 2 blocks, lines 4552-10386. The bar is 400 significant lines; this is 1298 over it, 4.25× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TerminalState term/src/terminalstate/mod.rs:302— ClassTooLong — 1602 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 116 methods, 2 blocks, lines 302-2995. The bar is 400 significant lines; this is 1202 over it, 4.01× 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: App kaku-gui/src/overlay/ai_chat/state.rs:704— ClassTooLong — 1247 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 62 methods, 2 blocks, lines 704-2526. The bar is 400 significant lines; this is 847 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: Config config/src/config.rs:52— ClassTooLong — 1148 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 3 blocks, lines 52-2173. The bar is 400 significant lines; this is 748 over it, 2.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TabInner mux/src/tab.rs:93— ClassTooLong — 1043 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 47 methods, 2 blocks, lines 93-2584. The bar is 400 significant lines; this is 643 over it, 2.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WindowInner window/src/os/macos/window.rs:524— ClassTooLong — 863 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 3 blocks, lines 524-3798. The bar is 400 significant lines; this is 463 over it, 2.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: App kaku/src/config_tui/mod.rs:361— ClassTooLong — 848 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 47 methods, 2 blocks, lines 361-1611. The bar is 400 significant lines; this is 448 over it, 2.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: Performer term/src/terminalstate/performer.rs:36— ClassTooLong — 799 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 15 methods, 5 blocks, lines 36-1314. The bar is 400 significant lines; this is 399 over it, 2.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TabRenameModal kaku-gui/src/termwindow/tab_rename.rs:30— ClassTooLong — 791 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 3 blocks, lines 30-1136. The bar is 400 significant lines; this is 391 over it, 1.98× 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: BidiContext crates/bidi/src/lib.rs:75— ClassTooLong — 761 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 75-1729. The bar is 400 significant lines; this is 361 over it, 1.90× 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: CSIParser crates/wezterm-escape-parser/src/csi.rs:1702— ClassTooLong — 750 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 24 methods, 3 blocks, lines 1702-2989. The bar is 400 significant lines; this is 350 over it, 1.88× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CommandPalette kaku-gui/src/termwindow/palette.rs:71— ClassTooLong — 714 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods, 3 blocks, lines 71-1257. The bar is 400 significant lines; this is 314 over it, 1.79× 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: Mux mux/src/lib.rs:151— ClassTooLong — 702 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 68 methods, 2 blocks, lines 151-1908. The bar is 400 significant lines; this is 302 over it, 1.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SessionInner crates/wezterm-ssh/src/sessioninner.rs:41— ClassTooLong — 694 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 27 methods, 3 blocks, lines 41-1045. The bar is 400 significant lines; this is 294 over it, 1.74× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Line crates/wezterm-surface/src/line/line.rs:46— ClassTooLong — 682 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 70 methods, 5 blocks, lines 46-1257. The bar is 400 significant lines; this is 282 over it, 1.71× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Face crates/wezterm-font/src/ftwrap.rs:98— ClassTooLong — 678 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 30 methods, 3 blocks, lines 98-1155. The bar is 400 significant lines; this is 278 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Screen term/src/screen.rs:15— ClassTooLong — 657 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 39 methods, 2 blocks, lines 15-1221. The bar is 400 significant lines; this is 257 over it, 1.64× 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: CommandDef kaku-gui/src/commands.rs:58— ClassTooLong — 653 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 8 methods, 3 blocks, lines 58-1065. The bar is 400 significant lines; this is 253 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CopyRenderable kaku-gui/src/overlay/copy.rs:63— ClassTooLong — 652 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 56 methods, 2 blocks, lines 63-1192. The bar is 400 significant lines; this is 252 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: LocalPane mux/src/localpane.rs:132— ClassTooLong — 628 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 5 methods, 4 blocks, lines 132-1302. The bar is 400 significant lines; this is 228 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SessionHandler crates/wezterm-mux-server-impl/src/sessionhandler.rs:198— ClassTooLong — 584 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 4 methods, 3 blocks, lines 198-1021. The bar is 400 significant lines; this is 184 over it, 1.46× 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: GuiFrontEnd kaku-gui/src/frontend.rs:94— ClassTooLong — 579 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 27 methods, 3 blocks, lines 94-1520. The bar is 400 significant lines; this is 179 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: GlyphCache kaku-gui/src/glyphcache.rs:560— ClassTooLong — 549 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 4 blocks, lines 560-1403. The bar is 400 significant lines; this is 149 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Hotspot: kaku-gui/src/termwindow/mod.rs kaku-gui/src/termwindow/mod.rs:4845— kaku-gui/src/termwindow/mod.rs changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 175 in TermWindow::perform_key_assignment at line 4845. 25 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/mod.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.
Hotspot: crates/kaku-remote/src/web.rs crates/kaku-remote/src/web.rs:2818— crates/kaku-remote/src/web.rs changed 61 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in kaku_remote::web::run_session at line 2818. 19 of those changes were fix/bug commits, and the other 42 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/kaku-remote/src/web.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.
Hotspot: crates/kaku-remote/assets/web/index.html crates/kaku-remote/assets/web/index.html:4092— crates/kaku-remote/assets/web/index.html changed 109 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in index.html.connect at line 4092. 48 of those changes were fix/bug commits, and the other 61 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/kaku-remote/assets/web/index.html`: 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: kaku-gui/src/termwindow/mouseevent.rs kaku-gui/src/termwindow/mouseevent.rs:1893— kaku-gui/src/termwindow/mouseevent.rs changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in TermWindow::mouse_event_terminal at line 1893. 17 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/mouseevent.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.
Hotspot: kaku-gui/src/commands.rs kaku-gui/src/commands.rs:1108— kaku-gui/src/commands.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 167 in kaku_gui::commands::derive_command_from_key_assignment at line 1108. 6 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/commands.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.
Hotspot: crates/kaku-remote/assets/web/desktop.js crates/kaku-remote/assets/web/desktop.js:99— crates/kaku-remote/assets/web/desktop.js changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in desktop.init at line 99. 6 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-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/kaku-remote/assets/web/desktop.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/kaku-remote/src/share.rs crates/kaku-remote/src/share.rs:877— crates/kaku-remote/src/share.rs changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in kaku_remote::share::serve at line 877. 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-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/kaku-remote/src/share.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.
Hotspot: crates/kaku-relay/src/main.rs crates/kaku-relay/src/main.rs:1112— crates/kaku-relay/src/main.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in kaku_relay::serve_browser at line 1112. 15 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/kaku-relay/src/main.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: kaku-gui/src/tabbar.rs kaku-gui/src/tabbar.rs:1006— kaku-gui/src/tabbar.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in TabBarState::new at line 1006. 8 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/tabbar.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.
Hotspot: window/src/os/macos/window.rs window/src/os/macos/window.rs:9463— window/src/os/macos/window.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in WindowView::did_resize at line 9463. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- window/src/os/macos/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.
Hotspot: term/src/terminalstate/performer.rs term/src/terminalstate/performer.rs:856— term/src/terminalstate/performer.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in Performer::osc_dispatch at line 856. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- term/src/terminalstate/performer.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.
Hotspot: kaku-gui/src/overlay/ai_chat/state.rs kaku-gui/src/overlay/ai_chat/state.rs:1823— kaku-gui/src/overlay/ai_chat/state.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in App::drain_tokens at line 1823. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/overlay/ai_chat/state.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.
Hotspot: kaku/src/ai_config/tui.rs kaku/src/ai_config/tui.rs:2757— kaku/src/ai_config/tui.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in kaku::ai_config::tui::save_field at line 2757. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku/src/ai_config/tui.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.
Hotspot: kaku-gui/src/frontend.rs kaku-gui/src/frontend.rs:661— kaku-gui/src/frontend.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in GuiFrontEnd::try_new at line 661. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/frontend.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.
Hotspot: crates/wezterm-input-types/src/lib.rs crates/wezterm-input-types/src/lib.rs:1660— crates/wezterm-input-types/src/lib.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in KeyEvent::encode_kitty at line 1660. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/wezterm-input-types/src/lib.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.
Hotspot: kaku/src/config_tui/mod.rs kaku/src/config_tui/mod.rs:987— kaku/src/config_tui/mod.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in App::normalize_value at line 987. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku/src/config_tui/mod.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.
Hotspot: kaku-gui/src/termwindow/resize.rs kaku-gui/src/termwindow/resize.rs:481— kaku-gui/src/termwindow/resize.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in TermWindow::apply_dimensions at line 481. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/resize.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.
Hotspot: kaku-gui/src/remote_tabs.rs kaku-gui/src/remote_tabs.rs:21— kaku-gui/src/remote_tabs.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in kaku_gui::remote_tabs::perform at line 21. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/remote_tabs.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.
Hotspot: kaku-gui/src/termwindow/render/screen_line.rs kaku-gui/src/termwindow/render/screen_line.rs:108— kaku-gui/src/termwindow/render/screen_line.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 76 in TermWindow::render_screen_line at line 108. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/render/screen_line.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.
Hotspot: kaku-gui/src/termwindow/render/paint.rs kaku-gui/src/termwindow/render/paint.rs:261— kaku-gui/src/termwindow/render/paint.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in TermWindow::paint_pass at line 261. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/render/paint.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.
Hotspot: mux/src/localpane.rs mux/src/localpane.rs:775— mux/src/localpane.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in LocalPane::search at line 775. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- mux/src/localpane.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.
Hotspot: kaku-gui/src/termwindow/render/pane.rs kaku-gui/src/termwindow/render/pane.rs:152— kaku-gui/src/termwindow/render/pane.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in TermWindow::paint_pane at line 152. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/render/pane.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.
Hotspot: kaku-gui/src/main.rs kaku-gui/src/main.rs:350— kaku-gui/src/main.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in kaku_gui::async_run_terminal_gui at line 350. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/main.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: kaku-gui/src/termwindow/render/fancy_tab_bar.rs kaku-gui/src/termwindow/render/fancy_tab_bar.rs:58— kaku-gui/src/termwindow/render/fancy_tab_bar.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in TermWindow::build_fancy_tab_bar at line 58. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/render/fancy_tab_bar.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.
Hotspot: kaku-gui/src/session_restore.rs kaku-gui/src/session_restore.rs:987— kaku-gui/src/session_restore.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in kaku_gui::session_restore::save_session_snapshot_impl at line 987. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/session_restore.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.
TermWindow::perform_key_assignment (cyclomatic 175) kaku-gui/src/termwindow/mod.rs:4845— TermWindow::perform_key_assignment has cyclomatic complexity 175 (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.
TermWindow::mouse_event_terminal (cyclomatic 98) kaku-gui/src/termwindow/mouseevent.rs:1893— TermWindow::mouse_event_terminal has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TermWindow::win_key_code_to_termwiz_key_code (cyclomatic 94) kaku-gui/src/termwindow/keyevent.rs:1264— TermWindow::win_key_code_to_termwiz_key_code has cyclomatic complexity 94 (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.
TermWindow::mouse_event_impl (cyclomatic 80) kaku-gui/src/termwindow/mouseevent.rs:889— TermWindow::mouse_event_impl has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TermWindow::render_screen_line (cyclomatic 76) kaku-gui/src/termwindow/render/screen_line.rs:108— TermWindow::render_screen_line has cyclomatic complexity 76 (threshold 15). Of this number, 70 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.
TermWindow::dispatch_notif (cyclomatic 64) kaku-gui/src/termwindow/mod.rs:2447— TermWindow::dispatch_notif 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.
TermWindow::paint_pane (cyclomatic 54) kaku-gui/src/termwindow/render/pane.rs:152— TermWindow::paint_pane 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.
TermWindow::paint_pass (cyclomatic 45) kaku-gui/src/termwindow/render/paint.rs:261— TermWindow::paint_pass 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.
TermWindow::dispatch_window_event (cyclomatic 42) kaku-gui/src/termwindow/mod.rs:2081— TermWindow::dispatch_window_event has cyclomatic complexity 42 (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.
TermWindow::key_event_impl (cyclomatic 39) kaku-gui/src/termwindow/keyevent.rs:1061— TermWindow::key_event_impl 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.
TermWindow::mouse_event_tab_bar (cyclomatic 37) kaku-gui/src/termwindow/mouseevent.rs:1651— TermWindow::mouse_event_tab_bar 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.
TermWindow::build_fancy_tab_bar (cyclomatic 30) kaku-gui/src/termwindow/render/fancy_tab_bar.rs:58— TermWindow::build_fancy_tab_bar 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.
TermWindow::process_key (cyclomatic 29) kaku-gui/src/termwindow/keyevent.rs:371— TermWindow::process_key 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.
TermWindow::apply_dimensions (cyclomatic 27) kaku-gui/src/termwindow/resize.rs:481— TermWindow::apply_dimensions 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.
TermWindow::show_launcher_impl (cyclomatic 24) kaku-gui/src/termwindow/mod.rs:4533— TermWindow::show_launcher_impl 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.
TermWindow::compute_cell_fg_bg (cyclomatic 24) kaku-gui/src/termwindow/render/mod.rs:702— TermWindow::compute_cell_fg_bg 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.
TermWindow::render_background (cyclomatic 23) kaku-gui/src/termwindow/background.rs:428— TermWindow::render_background 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.
TermWindow::compute_element (cyclomatic 23) kaku-gui/src/termwindow/box_model.rs:542— TermWindow::compute_element 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.
TermWindow::new_window (cyclomatic 23) kaku-gui/src/termwindow/mod.rs:1626— TermWindow::new_window 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.
TermWindow::rejoin_wrapped_link (cyclomatic 23) kaku-gui/src/termwindow/mod.rs:5692— TermWindow::rejoin_wrapped_link 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.
TermWindow::paint_impl (cyclomatic 22) kaku-gui/src/termwindow/render/paint.rs:57— TermWindow::paint_impl 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.
TermWindow::resize (cyclomatic 21) kaku-gui/src/termwindow/resize.rs:191— TermWindow::resize 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.
TermWindow::render_element_background (cyclomatic 20) kaku-gui/src/termwindow/box_model.rs:1036— TermWindow::render_element_background 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.
TermWindow::maybe_handle_native_line_editor_shortcut (cyclomatic 20) kaku-gui/src/termwindow/keyevent.rs:738— TermWindow::maybe_handle_native_line_editor_shortcut has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
TermWindow::raw_key_event_impl (cyclomatic 19) kaku-gui/src/termwindow/keyevent.rs:528— TermWindow::raw_key_event_impl 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.
kaku_gui::commands::derive_command_from_key_assignment (cyclomatic 167) kaku-gui/src/commands.rs:1108— kaku_gui::commands::derive_command_from_key_assignment has cyclomatic complexity 167 (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.
kaku_gui::overlay::ai_chat::input::handle_key (cyclomatic 76) kaku-gui/src/overlay/ai_chat/input.rs:10— kaku_gui::overlay::ai_chat::input::handle_key has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku_gui::cli_chat::run_repl (cyclomatic 52) kaku-gui/src/cli_chat/mod.rs:548— kaku_gui::cli_chat::run_repl has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku_gui::ai_client::responses::parse_responses_sse (cyclomatic 35) kaku-gui/src/ai_client/responses.rs:205— kaku_gui::ai_client::responses::parse_responses_sse 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.
kaku_gui::remote_tabs::perform (cyclomatic 33) kaku-gui/src/remote_tabs.rs:21— kaku_gui::remote_tabs::perform 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.
kaku_gui::ai_chat_engine::run_agent (cyclomatic 32) kaku-gui/src/ai_chat_engine/mod.rs:387— kaku_gui::ai_chat_engine::run_agent 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.
kaku_gui::overlay::ai_chat::input::handle_mouse (cyclomatic 32) kaku-gui/src/overlay/ai_chat/input.rs:424— kaku_gui::overlay::ai_chat::input::handle_mouse 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.
kaku_gui::ai_tools::search::fallback_regex_search (cyclomatic 31) kaku-gui/src/ai_tools/search.rs:269— kaku_gui::ai_tools::search::fallback_regex_search 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.
kaku_gui::ai_tools::execute (cyclomatic 30) kaku-gui/src/ai_tools/mod.rs:54— kaku_gui::ai_tools::execute has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
kaku_gui::ai_tools::project::exec_project_summary (cyclomatic 28) kaku-gui/src/ai_tools/project.rs:6— kaku_gui::ai_tools::project::exec_project_summary 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.
kaku_gui::ai_tools::search::exec_grep_search (cyclomatic 27) kaku-gui/src/ai_tools/search.rs:734— kaku_gui::ai_tools::search::exec_grep_search 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.
kaku_gui::overlay::ai_chat::markdown::wrap_segments (cyclomatic 27) kaku-gui/src/overlay/ai_chat/markdown.rs:451— kaku_gui::overlay::ai_chat::markdown::wrap_segments 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.
kaku_gui::overlay::ai_chat::render::render_chat (cyclomatic 27) kaku-gui/src/overlay/ai_chat/render.rs:463— kaku_gui::overlay::ai_chat::render::render_chat 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.
kaku_gui::ai_chat_engine::approval::split_shell_segments (cyclomatic 26) kaku-gui/src/ai_chat_engine/approval.rs:117— kaku_gui::ai_chat_engine::approval::split_shell_segments 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.
kaku_gui::overlay::ai_chat::ai_chat_overlay (cyclomatic 26) kaku-gui/src/overlay/ai_chat/mod.rs:82— kaku_gui::overlay::ai_chat::ai_chat_overlay 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.
kaku_gui::termwindow::wrapped_link::rejoined_links (cyclomatic 26) kaku-gui/src/termwindow/wrapped_link.rs:96— kaku_gui::termwindow::wrapped_link::rejoined_links 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.
kaku_gui::tabbar::parse_status_text (cyclomatic 25) kaku-gui/src/tabbar.rs:1429— kaku_gui::tabbar::parse_status_text has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
kaku_gui::overlay::confirm::run_confirmation_impl (cyclomatic 23) kaku-gui/src/overlay/confirm.rs:43— kaku_gui::overlay::confirm::run_confirmation_impl 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.
kaku_gui::update::update_checker (cyclomatic 23) kaku-gui/src/update.rs:555— kaku_gui::update::update_checker 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.
kaku_gui::ai_tools::shell::exec_shell_exec (cyclomatic 22) kaku-gui/src/ai_tools/shell.rs:98— kaku_gui::ai_tools::shell::exec_shell_exec 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.
kaku_gui::overlay::ai_chat::markdown::parse_markdown_blocks (cyclomatic 22) kaku-gui/src/overlay/ai_chat/markdown.rs:17— kaku_gui::overlay::ai_chat::markdown::parse_markdown_blocks 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.
kaku_gui::overlay::ai_chat::state::emit_assistant_markdown (cyclomatic 22) kaku-gui/src/overlay/ai_chat/state.rs:476— kaku_gui::overlay::ai_chat::state::emit_assistant_markdown has cyclomatic complexity 22 (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.
kaku_gui::ai_tools::search::exec_symbol_search (cyclomatic 21) kaku-gui/src/ai_tools/search.rs:557— kaku_gui::ai_tools::search::exec_symbol_search 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.
kaku_gui::async_run_terminal_gui (cyclomatic 21) kaku-gui/src/main.rs:350— kaku_gui::async_run_terminal_gui 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.
kaku_gui::overlay::ai_chat::render::format_tool_suffix (cyclomatic 21) kaku-gui/src/overlay/ai_chat/render.rs:45— kaku_gui::overlay::ai_chat::render::format_tool_suffix 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.
FixmeComment window/src/os/macos/window.rs:729— // FIXME: CTRL-C is 0x3, should it be normalized to C here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment window/src/os/macos/window.rs:7982— // FIXME: docs say to insert the text here, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment window/src/os/macos/window.rs:7992— // FIXME: returns NSArray<NSAttributedStringKey> * — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment termwiz/src/render/terminfo.rs:397— // FIXME: this doesn't behave correctly for terminals without bce. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment termwiz/src/render/terminfo.rs:419— // FIXME: this doesn't behave correctly for terminals without bce. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment term/src/screen.rs:289— // FIXME: borrow bidi mode from line — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment term/src/screen.rs:333— // FIXME: borrow bidi mode from line — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment term/src/test/mod.rs:11— // mod selection; FIXME: port to render layer — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mux/src/lib.rs:1722— // FIXME: clipboard — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mux/src/lib.rs:1729— // FIXME: split pane pixel dimensions — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mux/src/lib.rs:1897— // FIXME: clipboard? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mux/src/ssh.rs:275— // FIXME: this isn't useful without a way to talk to the remote mux. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment mux/src/termwiztermtab.rs:144— // FIXME: connect to something? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/commands.rs:525— // FIXME: use domain_label here, but needs to be async — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/commands.rs:555— // FIXME: use domain_label here, but needs to be async — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/commands.rs:1373— // FIXME: find a new assignment — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/commands.rs:1384— // FIXME: find a new assignment — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/termwindow/render/fancy_tab_bar.rs:323— // FIXME: determine exact width of macos ... buttons — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/termwindow/render/mod.rs:1027— // FIXME: need more paragraph context — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment kaku-gui/src/scripting/guiwin.rs:134— // FIXME: expose other states here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/wezterm-surface/src/line/line.rs:539— // FIXME: let's build a string and a byte-to-cell map here, and — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/wezterm-surface/src/line/line.rs:1034— // FIXME: we can skip the look-back for second and subsequent iterations — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/wezterm-ssh/src/sessioninner.rs:183— // FIXME: overridden config path? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/wezterm-input-types/src/lib.rs:1874— // FIXME: ideally we'd get the correct unshifted key from — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment crates/wezterm-font/src/rasterizer/freetype.rs:545— // FIXME: gradient vectors are expressed as font units, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (9 lines × 2) config/derive/src/configmeta.rs:26— config/derive/src/configmeta.rs:26-35 | crates/wezterm-dynamic/derive/src/todynamic.rs:29-37 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) config/src/lua.rs:43— config/src/lua.rs:43-51 | config/src/lua.rs:65-73 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `config/src/lua.rs:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/wezterm-dynamic/derive/src/fromdynamic.rs:93— crates/wezterm-dynamic/derive/src/fromdynamic.rs:93-101 | crates/wezterm-dynamic/derive/src/fromdynamic.rs:157-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-dynamic/derive/src/fromdynamic.rs:93` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/wezterm-font/src/lib.rs:833— crates/wezterm-font/src/lib.rs:833-841 | crates/wezterm-font/src/lib.rs:853-861 — both copies are in the same file, so extract the 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 `crates/wezterm-font/src/lib.rs:833` 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) crates/wezterm-ssh/src/config.rs:255— crates/wezterm-ssh/src/config.rs:255-263 | crates/wezterm-ssh/src/config.rs:267-275 — both copies are in the same file, so extract the 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 `crates/wezterm-ssh/src/config.rs:255` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/wezterm-ssh/src/pty.rs:163— crates/wezterm-ssh/src/pty.rs:163-171 | crates/wezterm-ssh/src/pty.rs:189-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) kaku-gui/src/ai_chat_engine/approval.rs:523— kaku-gui/src/ai_chat_engine/approval.rs:523-531 | kaku-gui/src/ai_chat_engine/approval.rs:537-545 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_chat_engine/approval.rs:523` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) kaku-gui/src/ai_chat_engine/mod.rs:1100— kaku-gui/src/ai_chat_engine/mod.rs:1100-1108 | kaku-gui/src/overlay/ai_chat/state.rs:1795-1803 — 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 `kaku-gui/src/ai_chat_engine/mod.rs:1100` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) kaku-gui/src/ai_tools/search.rs:601— kaku-gui/src/ai_tools/search.rs:601-609 | kaku-gui/src/ai_tools/search.rs:744-752 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku-gui/src/ai_tools/search.rs:668— kaku-gui/src/ai_tools/search.rs:668-676 | kaku-gui/src/ai_tools/search.rs:820-828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/ai_tools/search.rs:668` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) kaku-gui/src/customglyph.rs:5523— kaku-gui/src/customglyph.rs:5523-5531 | kaku-gui/src/customglyph.rs:5598-5606 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5523` 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) kaku-gui/src/glyphcache.rs:329— kaku-gui/src/glyphcache.rs:329-337 | kaku-gui/src/glyphcache.rs:345-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) kaku-gui/src/overlay/ai_chat/markdown.rs:515— kaku-gui/src/overlay/ai_chat/markdown.rs:515-523 | kaku-gui/src/overlay/ai_chat/markdown.rs:534-542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku-gui/src/session_restore.rs:357— kaku-gui/src/session_restore.rs:357-365 | kaku-gui/src/session_restore.rs:895-903 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku-gui/src/session_restore.rs:1333— kaku-gui/src/session_restore.rs:1333-1341 | kaku-gui/src/session_restore.rs:1355-1363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku-gui/src/termwindow/tab_rename.rs:106— kaku-gui/src/termwindow/tab_rename.rs:106-114 | kaku-gui/src/termwindow/tab_rename.rs:115-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku/src/ai_config/tui.rs:2860— kaku/src/ai_config/tui.rs:2860-2868 | kaku/src/ai_config/tui.rs:2942-2950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku/src/cli/activate_tab.rs:53— kaku/src/cli/activate_tab.rs:53-61 | kaku/src/cli/zoom_pane.rs:36-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `kaku/src/cli/activate_tab.rs:53` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) kaku/src/reset.rs:458— kaku/src/reset.rs:458-466 | kaku/src/reset.rs:547-555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) lua-api-crates/mux/src/pane.rs:229— lua-api-crates/mux/src/pane.rs:229-237 | lua-api-crates/mux/src/pane.rs:265-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lua-api-crates/mux/src/pane.rs:229` 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) mux/src/tab.rs:1210— mux/src/tab.rs:1210-1218 | mux/src/tab.rs:1241-1249 — both copies are in the same file, so extract the 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 `mux/src/tab.rs:1210` 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) mux/src/tab.rs:1221— mux/src/tab.rs:1221-1229 | mux/src/tab.rs:1252-1260 — both copies are in the same file, so extract the 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 `mux/src/tab.rs:1221` 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) mux/src/tmux_commands.rs:663— mux/src/tmux_commands.rs:663-671 | mux/src/tmux_commands.rs:902-910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) kaku-gui/src/termwindow/tab_rename.rs:477— kaku-gui/src/termwindow/tab_rename.rs:477-485 | kaku-gui/src/termwindow/tab_rename.rs:508-516 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/tab_rename.rs:477` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/wezterm-ssh/src/pty.rs:215— crates/wezterm-ssh/src/pty.rs:215-223 | crates/wezterm-ssh/src/sessioninner.rs:902-910 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/wezterm-ssh/src/pty.rs:225` calls `request_pty` and `crates/wezterm-ssh/src/sessioninner.rs:912` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) REDACTED:204— REDACTED:204-210 | REDACTED:245-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:204` 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) crates/kaku-remote/src/share.rs:1171— crates/kaku-remote/src/share.rs:1171-1177 | crates/kaku-remote/src/share.rs:1191-1197 — both copies are in the same file, so extract the 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 `crates/kaku-remote/src/share.rs:1171` 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) crates/wezterm-client/src/domain.rs:447— crates/wezterm-client/src/domain.rs:447-453 | crates/wezterm-client/src/domain.rs:716-722 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/wezterm-client/src/pane/renderable.rs:537— crates/wezterm-client/src/pane/renderable.rs:537-543 | crates/wezterm-client/src/pane/renderable.rs:618-624 — both copies are in the same file, so extract the 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 `crates/wezterm-client/src/pane/renderable.rs:537` 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) crates/wezterm-escape-parser/src/csi.rs:2146— crates/wezterm-escape-parser/src/csi.rs:2146-2152 | crates/wezterm-escape-parser/src/csi.rs:2170-2176 — both copies are in the same file, so extract the 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 `crates/wezterm-escape-parser/src/csi.rs:2146` 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) crates/wezterm-escape-parser/src/osc.rs:798— crates/wezterm-escape-parser/src/osc.rs:798-804 | crates/wezterm-escape-parser/src/osc.rs:829-835 — both copies are in the same file, so extract the 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 `crates/wezterm-escape-parser/src/osc.rs:798` 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) crates/wezterm-font/src/ftwrap.rs:857— crates/wezterm-font/src/ftwrap.rs:857-863 | crates/wezterm-font/src/ftwrap.rs:874-880 — both copies are in the same file, so extract the 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 `crates/wezterm-font/src/ftwrap.rs:857` 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, `crates/wezterm-font/src/ftwrap.rs:881` calls `vector_x_y` and `crates/wezterm-font/src/ftwrap.rs:864` 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 (7 lines × 2) crates/wezterm-font/src/rasterizer/freetype.rs:133— crates/wezterm-font/src/rasterizer/freetype.rs:133-139 | crates/wezterm-font/src/rasterizer/freetype.rs:178-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-font/src/rasterizer/freetype.rs:133` 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) kaku-gui/src/ai_client/mod.rs:380— kaku-gui/src/ai_client/mod.rs:380-386 | kaku-gui/src/ai_client/transport.rs:304-310 — 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 `kaku-gui/src/ai_client/mod.rs:380` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/ai_client/transport.rs:303` calls `status` and `kaku-gui/src/ai_client/mod.rs:379` 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) kaku-gui/src/customglyph.rs:3403— kaku-gui/src/customglyph.rs:3403-3409 | kaku-gui/src/customglyph.rs:3510-3516 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3403` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) kaku-gui/src/customglyph.rs:3399— kaku-gui/src/customglyph.rs:3399-3405 | kaku-gui/src/customglyph.rs:3441-3447 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3399` 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) kaku-gui/src/customglyph.rs:3494— kaku-gui/src/customglyph.rs:3494-3500 | kaku-gui/src/customglyph.rs:3530-3536 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3494` 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) kaku-gui/src/customglyph.rs:3503— kaku-gui/src/customglyph.rs:3503-3509 | kaku-gui/src/customglyph.rs:3539-3545 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3503` 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) kaku-gui/src/customglyph.rs:3512— kaku-gui/src/customglyph.rs:3512-3518 | kaku-gui/src/customglyph.rs:3548-3554 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3512` 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) kaku-gui/src/overlay/copy.rs:972— kaku-gui/src/overlay/copy.rs:972-978 | kaku-gui/src/overlay/copy.rs:1004-1010 — both copies are in the same file, so extract the 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 `kaku-gui/src/overlay/copy.rs: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 (7 lines × 2) kaku-gui/src/termwindow/mod.rs:4171— kaku-gui/src/termwindow/mod.rs:4171-4177 | kaku-gui/src/termwindow/mod.rs:4823-4829 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) kaku-gui/src/termwindow/palette.rs:485— kaku-gui/src/termwindow/palette.rs:485-492 | kaku-gui/src/termwindow/palette.rs:1011-1017 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/palette.rs:485` 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 first that the copies are not typed on the same thing: the declarations holding them bind `term_window` to `&TermWindow` in one and `&mut TermWindow` 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 (7 lines × 2) kaku-gui/src/termwindow/palette.rs:636— kaku-gui/src/termwindow/palette.rs:636-642 | kaku-gui/src/termwindow/palette.rs:742-748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/termwindow/palette.rs:636` 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) kaku/src/ai_config/tui.rs:905— kaku/src/ai_config/tui.rs:905-911 | kaku/src/ai_config/tui/providers/mod.rs:573-579 — 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 `kaku/src/ai_config/tui.rs:905` 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) termwiz/src/lineedit/buffer.rs:98— termwiz/src/lineedit/buffer.rs:98-104 | termwiz/src/lineedit/buffer.rs:125-131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) kaku-gui/src/overlay/prompt.rs:81— kaku-gui/src/overlay/prompt.rs:81-87 | kaku-gui/src/overlay/selector.rs:387-393 — 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) kaku-gui/src/session_restore.rs:270— kaku-gui/src/session_restore.rs:270-276 | window/src/os/macos/window.rs:983-989 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) kaku/src/doctor.rs:1399— kaku/src/doctor.rs:1399-1405 | kaku/src/reset.rs:432-438 — 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) kaku/src/ai_config/tui/providers/mod.rs:1791— kaku/src/ai_config/tui/providers/mod.rs:1791-1797 | kaku/src/ai_config/tui/providers/mod.rs:1799-1805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku/src/ai_config/tui/providers/mod.rs:1791` 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) kaku/src/ai_config/tui/providers/mod.rs:585— kaku/src/ai_config/tui/providers/mod.rs:585-591 | kaku/src/ai_config/tui/providers/mod.rs:1449-1455 — both copies are in the same file, so extract the block into 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) config/src/lua.rs:931— config/src/lua.rs:931-936 | config/src/lua.rs:952-957 — both copies are in the same file, so extract the 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 `config/src/lua.rs:931` 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) kaku-gui/src/ai_tools/search.rs:68— kaku-gui/src/ai_tools/search.rs:68-73 | kaku-gui/src/ai_tools/search.rs:127-132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/ai_tools/search.rs:68` 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) kaku-gui/src/ai_tools/shell.rs:104— kaku-gui/src/ai_tools/shell.rs:104-109 | kaku-gui/src/ai_tools/shell.rs:245-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) kaku-gui/src/customglyph.rs:726— kaku-gui/src/customglyph.rs:726-731 | kaku-gui/src/customglyph.rs:735-740 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:726` 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) kaku-gui/src/customglyph.rs:1073— kaku-gui/src/customglyph.rs:1073-1078 | kaku-gui/src/customglyph.rs:1203-1208 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:1073` 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 (6 lines × 2) kaku-gui/src/customglyph.rs:1138— kaku-gui/src/customglyph.rs:1138-1143 | kaku-gui/src/customglyph.rs:1268-1273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:1138` 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 (6 lines × 2) kaku-gui/src/overlay/copy.rs:1569— kaku-gui/src/overlay/copy.rs:1569-1574 | kaku-gui/src/overlay/copy.rs:1671-1676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) kaku-gui/src/session_restore.rs:368— kaku-gui/src/session_restore.rs:368-373 | kaku-gui/src/session_restore.rs:909-914 — both copies are in the same file, so extract the 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 `kaku-gui/src/session_restore.rs:368` 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 (6 lines × 2) kaku-gui/src/termwindow/render/fancy_tab_bar.rs:172— kaku-gui/src/termwindow/render/fancy_tab_bar.rs:172-177 | kaku-gui/src/termwindow/render/fancy_tab_bar.rs:217-222 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/render/fancy_tab_bar.rs:172` 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) kaku-gui/src/termwindow/selection.rs:105— kaku-gui/src/termwindow/selection.rs:105-110 | lua-api-crates/mux/src/pane.rs:54-59 — 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 `kaku-gui/src/termwindow/selection.rs:105` 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) kaku-gui/src/update.rs:181— kaku-gui/src/update.rs:181-186 | kaku-gui/src/update.rs:357-365 — both copies are in the same file, so extract the 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 `kaku-gui/src/update.rs:181` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 2) kaku/src/ai_config/tui/ui.rs:322— kaku/src/ai_config/tui/ui.rs:322-327 | kaku/src/ai_config/tui/ui.rs:342-347 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui/ui.rs:322` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) lua-api-crates/mux/src/pane.rs:101— lua-api-crates/mux/src/pane.rs:101-106 | lua-api-crates/mux/src/pane.rs:111-116 — both copies are in the same file, so extract the 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 `lua-api-crates/mux/src/pane.rs:101` 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 (6 lines × 2) termwiz/src/render/terminfo.rs:390— termwiz/src/render/terminfo.rs:390-395 | termwiz/src/render/terminfo.rs:412-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) window/src/os/macos/window.rs:2435— window/src/os/macos/window.rs:2435-2440 | window/src/os/macos/window.rs:2451-2456 — both copies are in the same file, so extract the 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 `window/src/os/macos/window.rs:2435` 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) kaku-gui/src/overlay/ai_chat/state.rs:2148— kaku-gui/src/overlay/ai_chat/state.rs:2148-2153 | kaku-gui/src/overlay/ai_chat/state.rs:2470-2475 — both copies are in the same file, so extract the 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 `kaku-gui/src/overlay/ai_chat/state.rs:2148` 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) kaku-gui/src/cli_chat/mod.rs:850— kaku-gui/src/cli_chat/mod.rs:850-855 | kaku-gui/src/overlay/ai_chat/layout.rs:5-10 — 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) kaku-gui/src/overlay/launcher.rs:568— kaku-gui/src/overlay/launcher.rs:568-573 | kaku-gui/src/overlay/selector.rs:228-233 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) kaku-gui/src/overlay/launcher.rs:575— kaku-gui/src/overlay/launcher.rs:575-580 | kaku-gui/src/overlay/selector.rs:235-240 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) term/src/terminalstate/mod.rs:56— term/src/terminalstate/mod.rs:56-61 | term/src/terminalstate/performer.rs:47-52 — before extracting anything, compare `term/src/terminalstate/mod.rs` and `term/src/terminalstate/performer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) kaku/src/ai_config/tui/ui.rs:295— kaku/src/ai_config/tui/ui.rs:295-301 | kaku/src/ai_config/tui/ui.rs:322-327 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui/ui.rs:295` 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) kaku/src/ai_config/tui/providers/mod.rs:1687— kaku/src/ai_config/tui/providers/mod.rs:1687-1692 | kaku/src/ai_config/tui/providers/mod.rs:1903-1908 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui/providers/mod.rs:1687` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) config/src/lib.rs:1956— config/src/lib.rs:1956-1961 | config/src/lib.rs:1982-1987 — both copies are in the same file, so extract the 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 `config/src/lib.rs:1956` 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) kaku-gui/src/ai_tools/shell.rs:134— kaku-gui/src/ai_tools/shell.rs:134-139 | kaku-gui/src/ai_tools/shell.rs:256-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/ai_tools/shell.rs:134` 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) crates/wezterm-escape-parser/src/osc.rs:1535— crates/wezterm-escape-parser/src/osc.rs:1535-1540 | crates/wezterm-escape-parser/src/osc.rs:1545-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 `crates/wezterm-escape-parser/src/osc.rs:1535` 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.
kaku::ai_config::tui::run_loop (cognitive 152) kaku/src/ai_config/tui.rs:3115— kaku::ai_config::tui::run_loop has cognitive complexity 152 (threshold 15). Drivers by points: if/else 29 (116 pts), match/switch 6 (21 pts), boolean chains 9, loops 2 (6 pts) (nesting depth added 106). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::ai_config::tui::save_field (cognitive 112) kaku/src/ai_config/tui.rs:2757— kaku::ai_config::tui::save_field has cognitive complexity 112 (threshold 15). Drivers by points: if/else 37 (88 pts), loops 2 (10 pts), match/switch 4 (9 pts), boolean chains 5 (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku::ai_config::tui::ui::render_tools (cognitive 89) kaku/src/ai_config/tui/ui.rs:109— kaku::ai_config::tui::ui::render_tools has cognitive complexity 89 (threshold 15). Drivers by points: if/else 42 (79 pts), boolean chains 7, loops 2 (3 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.
kaku::utils::strip_jsonc_comments (cognitive 56) kaku/src/utils.rs:191— kaku::utils::strip_jsonc_comments has cognitive complexity 56 (threshold 15). Drivers by points: if/else 11 (38 pts), loops 3 (11 pts), match/switch 1 (6 pts), boolean chains 1 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku::ai_config::tui::extract_openclaw_fields (cognitive 46) kaku/src/ai_config/tui.rs:1757— kaku::ai_config::tui::extract_openclaw_fields has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 4 (12 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::ai_config::tui::providers::assistant::save_kaku_assistant_field_to_path (cognitive 46) kaku/src/ai_config/tui/providers/assistant.rs:438— kaku::ai_config::tui::providers::assistant::save_kaku_assistant_field_to_path has cognitive complexity 46 (threshold 15). Drivers by points: if/else 30 (41 pts), boolean chains 3, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::reset::imp::strip_legacy_inline_block (cognitive 46) kaku/src/reset.rs:712— kaku::reset::imp::strip_legacy_inline_block has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 3 (10 pts), boolean chains 2 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku::doctor::build_shell_integration_group (cognitive 45) kaku/src/doctor.rs:448— kaku::doctor::build_shell_integration_group has cognitive complexity 45 (threshold 15). Drivers by points: if/else 35 (42 pts), boolean chains 3 (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.
kaku::run_remote (cognitive 34) kaku/src/lib.rs:323— kaku::run_remote has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 4 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::doctor::build_environment_group (cognitive 33) kaku/src/doctor.rs:262— kaku::doctor::build_environment_group has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (27 pts), match/switch 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::update::imp::run (cognitive 30) kaku/src/update.rs:80— kaku::update::imp::run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 4 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::config_tui::run_app (cognitive 28) kaku/src/config_tui/mod.rs:65— kaku::config_tui::run_app has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 5 (12 pts), boolean chains 2, loops 1 (nesting depth added 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
kaku::config_tui::ui::render_fields (cognitive 28) kaku/src/config_tui/ui.rs:201— kaku::config_tui::ui::render_fields has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::select_main_menu_command (cognitive 23) kaku/src/lib.rs:789— kaku::select_main_menu_command has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 3 (6 pts), loops 2 (nesting depth added 13). Of this number, 18 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::ai_config::tui::providers::codex::codex_connection_is_configured_at (cognitive 23) kaku/src/ai_config/tui/providers/codex.rs:46— kaku::ai_config::tui::providers::codex::codex_connection_is_configured_at has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), match/switch 5 (6 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
kaku::ai_config::tui::providers::assistant::render_kaku_assistant_config (cognitive 20) kaku/src/ai_config/tui/providers/assistant.rs:246— kaku::ai_config::tui::providers::assistant::render_kaku_assistant_config has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 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.
kaku::utils::strip_jsonc_trailing_commas (cognitive 20) kaku/src/utils.rs:258— kaku::utils::strip_jsonc_trailing_commas has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::doctor::check_fish_conf_d_source_line (cognitive 18) kaku/src/doctor.rs:1126— kaku::doctor::check_fish_conf_d_source_line has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::ensure_relay_access (cognitive 17) kaku/src/lib.rs:612— kaku::ensure_relay_access has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku::ai_config::tui::summarize_tool_fields (cognitive 16) kaku/src/ai_config/tui.rs:367— kaku::ai_config::tui::summarize_tool_fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
kaku::ai_config::tui::save_kimi_field_at (cognitive 16) kaku/src/ai_config/tui.rs:2991— kaku::ai_config::tui::save_kimi_field_at has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1, 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.
kaku::ai_config::tui::providers::codex::extract_codex_fields (cognitive 16) kaku/src/ai_config/tui/providers/codex.rs:204— kaku::ai_config::tui::providers::codex::extract_codex_fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 2 (6 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.
kaku::ai_config::tui::providers::codex::save_codex_field_at (cognitive 16) kaku/src/ai_config/tui/providers/codex.rs:315— kaku::ai_config::tui::providers::codex::save_codex_field_at has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1, 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.
kaku::doctor::check_zshrc_source_line (cognitive 16) kaku/src/doctor.rs:1077— kaku::doctor::check_zshrc_source_line has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (8 lines × 2) config/derive/src/attr.rs:132— config/derive/src/attr.rs:132-139 | crates/wezterm-dynamic/derive/src/attr.rs:282-289 — before extracting anything, compare `config/derive/src/attr.rs` and `crates/wezterm-dynamic/derive/src/attr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire 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) crates/tabout/src/lib.rs:96— crates/tabout/src/lib.rs:96-103 | crates/tabout/src/lib.rs:202-209 — both copies are in the same file, so extract the 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 `crates/tabout/src/lib.rs:96` 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) crates/wezterm-escape-parser/src/csi.rs:1902— crates/wezterm-escape-parser/src/csi.rs:1902-1909 | crates/wezterm-escape-parser/src/csi.rs:1931-1938 — both copies are in the same file, so extract the 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 `crates/wezterm-escape-parser/src/csi.rs:1902` 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 (8 lines × 2) crates/wezterm-input-types/src/lib.rs:1974— crates/wezterm-input-types/src/lib.rs:1974-1981 | termwiz/src/input.rs:605-612 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) kaku-gui/src/ai_chat_engine/suggestion.rs:45— kaku-gui/src/ai_chat_engine/suggestion.rs:45-52 | kaku-gui/src/ai_chat_engine/title.rs:35-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) kaku-gui/src/ai_client/mod.rs:255— kaku-gui/src/ai_client/mod.rs:255-262 | kaku-gui/src/ai_client/mod.rs:774-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) kaku-gui/src/ai_client/mod.rs:654— kaku-gui/src/ai_client/mod.rs:654-661 | kaku-gui/src/ai_client/mod.rs:751-758 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_client/mod.rs:654` 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, `kaku-gui/src/ai_client/mod.rs:750` calls `Object` and `kaku-gui/src/ai_client/mod.rs:653` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) kaku-gui/src/ai_client/responses.rs:288— kaku-gui/src/ai_client/responses.rs:288-295 | kaku-gui/src/ai_client/responses.rs:308-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/ai_client/responses.rs:288` 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) kaku-gui/src/commands.rs:326— kaku-gui/src/commands.rs:326-333 | kaku-gui/src/commands.rs:986-994 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/commands.rs: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 lines × 2) kaku-gui/src/customglyph.rs:742— kaku-gui/src/customglyph.rs:742-749 | kaku-gui/src/customglyph.rs:751-758 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:742` 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) kaku-gui/src/customglyph.rs:5676— kaku-gui/src/customglyph.rs:5676-5683 | kaku-gui/src/customglyph.rs:5706-5713 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5676` 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 (8 lines × 2) kaku-gui/src/customglyph.rs:5691— kaku-gui/src/customglyph.rs:5691-5698 | kaku-gui/src/customglyph.rs:5721-5728 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5691` 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 (8 lines × 2) kaku-gui/src/overlay/copy.rs:856— kaku-gui/src/overlay/copy.rs:856-863 | kaku-gui/src/overlay/copy.rs:871-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 `kaku-gui/src/overlay/copy.rs:856` 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) kaku-gui/src/termwindow/palette.rs:587— kaku-gui/src/termwindow/palette.rs:587-594 | kaku-gui/src/termwindow/palette.rs:617-624 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/palette.rs:587` 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) kaku-gui/src/update.rs:379— kaku-gui/src/update.rs:379-386 | kaku/src/update.rs:611-618 — before extracting anything, compare `kaku-gui/src/update.rs` and `kaku/src/update.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku-gui/src/update.rs:379` 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) kaku/src/ai_config/tui/providers/mod.rs:1032— kaku/src/ai_config/tui/providers/mod.rs:1032-1039 | kaku/src/ai_config/tui/providers/mod.rs:1051-1058 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui/providers/mod.rs:1032` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) kaku/src/config_tui/mod.rs:876— kaku/src/config_tui/mod.rs:876-883 | kaku/src/config_tui/mod.rs:914-921 — both copies are in the same file, so extract the 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 `kaku/src/config_tui/mod.rs:876` 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 (8 lines × 2) window/src/os/macos/window.rs:7967— window/src/os/macos/window.rs:7967-7974 | window/src/os/macos/window.rs:9033-9040 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) config/src/lib.rs:321— config/src/lib.rs:321-328 | config/src/lib.rs:332-339 — both copies are in the same file, so extract the 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 `config/src/lib.rs:321` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) crates/wezterm-escape-parser/src/osc.rs:858— crates/wezterm-escape-parser/src/osc.rs:858-865 | crates/wezterm-escape-parser/src/osc.rs:867-874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) kaku-gui/src/stats.rs:368— kaku-gui/src/stats.rs:368-375 | kaku-gui/src/stats.rs:388-395 — both copies are in the same file, so extract the 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 `kaku-gui/src/stats.rs: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) kaku/src/reset.rs:345— kaku/src/reset.rs:345-352 | kaku/src/reset.rs:394-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.
Duplicated block (8 lines × 2) kaku/src/doctor.rs:555— kaku/src/doctor.rs:555-562 | kaku/src/doctor.rs:583-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 `kaku/src/doctor.rs:555` 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) crates/wezterm-dynamic/src/error.rs:264— crates/wezterm-dynamic/src/error.rs:264-273 | crates/wezterm-font/src/parser.rs:367-376 — 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 `crates/wezterm-dynamic/src/error.rs:264` 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) crates/wezterm-font/src/ftwrap.rs:1117— crates/wezterm-font/src/ftwrap.rs:1117-1126 | crates/wezterm-font/src/ftwrap.rs:1130-1139 — both copies are in the same file, so extract the 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 `crates/wezterm-font/src/ftwrap.rs:1117` 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) crates/wezterm-mux-server-impl/src/sessionhandler.rs:587— crates/wezterm-mux-server-impl/src/sessionhandler.rs:587-596 | crates/wezterm-mux-server-impl/src/sessionhandler.rs:613-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-mux-server-impl/src/sessionhandler.rs:587` 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) kaku-gui/src/ai_conversations.rs:229— kaku-gui/src/ai_conversations.rs:229-238 | kaku-gui/src/ai_conversations.rs:293-302 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_conversations.rs: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 (10 lines × 2) kaku-gui/src/overlay/launcher.rs:679— kaku-gui/src/overlay/launcher.rs:679-688 | kaku-gui/src/overlay/selector.rs:294-303 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:679` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/overlay/launcher.rs:676` calls `Some`, `close_tab_action`, `Ok` and `kaku-gui/src/overlay/selector.rs:293` 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) kaku-gui/src/termwindow/charselect.rs:393— kaku-gui/src/termwindow/charselect.rs:393-402 | kaku-gui/src/termwindow/paneselect.rs:62-71 — before extracting anything, compare `kaku-gui/src/termwindow/charselect.rs` and `kaku-gui/src/termwindow/paneselect.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) kaku-gui/src/termwindow/mod.rs:4402— kaku-gui/src/termwindow/mod.rs:4402-4411 | kaku-gui/src/termwindow/mod.rs:4426-4435 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/mod.rs:4402` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `args` to `&config::keyassignment::InputSelector` in one and `&PromptInputLine` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) kaku-gui/src/termwindow/mouseevent.rs:1811— kaku-gui/src/termwindow/mouseevent.rs:1811-1820 | kaku-gui/src/termwindow/mouseevent.rs:1837-1846 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/mouseevent.rs:1811` 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) kaku-gui/src/termwindow/selection.rs:26— kaku-gui/src/termwindow/selection.rs:26-35 | kaku-gui/src/termwindow/selection.rs:92-101 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/selection.rs:26` 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, `kaku-gui/src/termwindow/selection.rs:36` calls `get_dimensions` and `kaku-gui/src/termwindow/selection.rs:102` 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) kaku-gui/src/update.rs:350— kaku-gui/src/update.rs:350-359 | kaku/src/update.rs:570-579 — before extracting anything, compare `kaku-gui/src/update.rs` and `kaku/src/update.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire 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) kaku/src/ai_config/tui.rs:2994— kaku/src/ai_config/tui.rs:2994-3003 | kaku/src/ai_config/tui/providers/codex.rs:319-328 — 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 `kaku/src/ai_config/tui.rs:2994` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) kaku/src/cli/get_text.rs:47— kaku/src/cli/get_text.rs:47-56 | kaku/src/cli/get_text.rs:60-69 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku/src/cli/get_text.rs:47` 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) lua-api-crates/mux/src/pane.rs:414— lua-api-crates/mux/src/pane.rs:414-423 | lua-api-crates/mux/src/tab.rs:146-155 — 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 (10 lines × 2) lua-api-crates/share-data/src/lib.rs:379— lua-api-crates/share-data/src/lib.rs:379-388 | lua-api-crates/share-data/src/lib.rs:447-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lua-api-crates/share-data/src/lib.rs:379` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) mux/src/pane_encoding.rs:132— mux/src/pane_encoding.rs:132-141 | mux/src/pane_encoding.rs:239-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 `mux/src/pane_encoding.rs:132` 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) mux/src/renderable.rs:116— mux/src/renderable.rs:116-125 | mux/src/renderable.rs:139-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `mux/src/renderable.rs:116` 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) term/src/terminalstate/performer.rs:632— term/src/terminalstate/performer.rs:632-641 | term/src/terminalstate/performer.rs:649-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `term/src/terminalstate/performer.rs:632` 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) kaku-gui/src/termwindow/mod.rs:5943— kaku-gui/src/termwindow/mod.rs:5943-5952 | kaku-gui/src/termwindow/mod.rs:6066-6075 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/mod.rs:5943` 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) mux/src/localpane.rs:535— mux/src/localpane.rs:535-544 | mux/src/termwiztermtab.rs:337-346 — 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) crates/wezterm-font/src/rasterizer/freetype.rs:642— crates/wezterm-font/src/rasterizer/freetype.rs:642-651 | crates/wezterm-font/src/rasterizer/freetype.rs:667-676 — both copies are in the same file, so extract the block into 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) kaku-gui/src/update.rs:324— kaku-gui/src/update.rs:324-333 | kaku-gui/src/update.rs:351-360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/update.rs:334` calls `arg` and `kaku-gui/src/update.rs:361` 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 (10 lines × 2) crates/wezterm-escape-parser/src/apc.rs:671— crates/wezterm-escape-parser/src/apc.rs:671-680 | crates/wezterm-escape-parser/src/apc.rs:682-691 — both copies are in the same file, so extract the 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 `crates/wezterm-escape-parser/src/apc.rs:671` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) config/src/font.rs:401— config/src/font.rs:401-413 | config/src/font.rs:437-449 — both copies are in the same file, so extract the 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 `config/src/font.rs:401` 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) crates/wezterm-dynamic/derive/src/attr.rs:141— crates/wezterm-dynamic/derive/src/attr.rs:141-153 | crates/wezterm-dynamic/derive/src/attr.rs:168-180 — both copies are in the same file, so extract the 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 `crates/wezterm-dynamic/derive/src/attr.rs: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 (13 lines × 2) kaku-gui/src/ai_chat_engine/suggestion.rs:30— kaku-gui/src/ai_chat_engine/suggestion.rs:30-42 | kaku-gui/src/ai_chat_engine/title.rs:20-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/ai_chat_engine/suggestion.rs:30` 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) kaku-gui/src/ai_tools/search.rs:514— kaku-gui/src/ai_tools/search.rs:514-526 | kaku-gui/src/ai_tools/search.rs:543-555 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_tools/search.rs:514` 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) kaku-gui/src/ai_tools/search.rs:638— kaku-gui/src/ai_tools/search.rs:638-650 | kaku-gui/src/ai_tools/search.rs:783-795 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_tools/search.rs:638` 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) kaku-gui/src/ai_tools/search.rs:869— kaku-gui/src/ai_tools/search.rs:869-881 | kaku-gui/src/ai_tools/shell.rs:157-169 — 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 `kaku-gui/src/ai_tools/search.rs:869` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/ai_tools/shell.rs:170` calls `load` and `kaku-gui/src/ai_tools/search.rs:882` 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 (13 lines × 2) kaku-gui/src/overlay/ai_chat/render.rs:497— kaku-gui/src/overlay/ai_chat/render.rs:497-509 | kaku-gui/src/overlay/ai_chat/render.rs:768-780 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) kaku-gui/src/termwindow/box_model.rs:1168— kaku-gui/src/termwindow/box_model.rs:1168-1180 | kaku-gui/src/termwindow/box_model.rs:1182-1194 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/box_model.rs:1168` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) kaku-gui/src/termwindow/charselect.rs:507— kaku-gui/src/termwindow/charselect.rs:507-519 | kaku-gui/src/termwindow/paneselect.rs:110-122 — before extracting anything, compare `kaku-gui/src/termwindow/charselect.rs` and `kaku-gui/src/termwindow/paneselect.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/termwindow/charselect.rs:507` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) kaku-gui/src/termwindow/mouseevent.rs:1296— kaku-gui/src/termwindow/mouseevent.rs:1296-1308 | kaku-gui/src/termwindow/mouseevent.rs:1702-1714 — both copies are in the same file, so extract the 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, `kaku-gui/src/termwindow/mouseevent.rs:1295` calls `Some` and `kaku-gui/src/termwindow/mouseevent.rs:1701` 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 (13 lines × 2) kaku-gui/src/termwindow/tab_rename.rs:874— kaku-gui/src/termwindow/tab_rename.rs:874-886 | kaku-gui/src/termwindow/tab_rename.rs:905-917 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/tab_rename.rs:874` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) kaku-gui/src/update.rs:423— kaku-gui/src/update.rs:423-435 | kaku/src/update.rs:651-663 — before extracting anything, compare `kaku-gui/src/update.rs` and `kaku/src/update.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku-gui/src/update.rs:423` 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) kaku/src/ai_config/tui.rs:2512— kaku/src/ai_config/tui.rs:2512-2524 | kaku/src/ai_config/tui.rs:2572-2584 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui.rs:2512` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) mux/src/tab.rs:1807— mux/src/tab.rs:1807-1819 | mux/src/tab.rs:1846-1858 — both copies are in the same file, so extract the 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 `mux/src/tab.rs:1807` 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) mux/src/tmux_commands.rs:414— mux/src/tmux_commands.rs:414-426 | mux/src/tmux_commands.rs:448-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) mux/src/tmux_pty.rs:27— mux/src/tmux_pty.rs:27-39 | mux/src/tmux_pty.rs:48-60 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) kaku/src/ai_config/tui/ui.rs:390— kaku/src/ai_config/tui/ui.rs:390-402 | kaku/src/config_tui/ui.rs:468-480 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:390` 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) kaku-gui/src/termwindow/charselect.rs:250— kaku-gui/src/termwindow/charselect.rs:250-262 | kaku-gui/src/termwindow/palette.rs:248-260 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 2) kaku/src/ai_config/tui.rs:1090— kaku/src/ai_config/tui.rs:1090-1102 | kaku/src/ai_config/tui.rs:1262-1274 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui.rs:1090` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) crates/wezterm-escape-parser/src/csi.rs:2158— crates/wezterm-escape-parser/src/csi.rs:2158-2168 | crates/wezterm-escape-parser/src/csi.rs:2170-2180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) crates/wezterm-ssh/src/pty.rs:106— crates/wezterm-ssh/src/pty.rs:106-116 | crates/wezterm-ssh/src/pty.rs:143-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-ssh/src/pty.rs:106` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/wezterm-ssh/src/pty.rs:155` calls `process_id` and `crates/wezterm-ssh/src/pty.rs:117` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) kaku-gui/src/commands.rs:596— kaku-gui/src/commands.rs:596-606 | kaku-gui/src/commands.rs:616-626 — both copies are in the same file, so extract the 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 `kaku-gui/src/commands.rs:596` 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) kaku-gui/src/customglyph.rs:5563— kaku-gui/src/customglyph.rs:5563-5573 | kaku-gui/src/customglyph.rs:5599-5609 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5563` 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) kaku-gui/src/customglyph.rs:5581— kaku-gui/src/customglyph.rs:5581-5591 | kaku-gui/src/customglyph.rs:5617-5627 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5581` 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) kaku-gui/src/termwindow/render/mod.rs:709— kaku-gui/src/termwindow/render/mod.rs:709-721 | kaku-gui/src/termwindow/render/mod.rs:767-777 — both copies are in the same file, so extract the block into 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) mux/src/connui.rs:27— mux/src/connui.rs:27-37 | mux/src/ssh.rs:48-58 — 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 `mux/src/ssh.rs:48` 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, `mux/src/ssh.rs:44` calls `Text`, `to_string` and `mux/src/connui.rs:26` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) mux/src/connui.rs:373— mux/src/connui.rs:373-383 | mux/src/connui.rs:393-403 — both copies are in the same file, so extract the 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 `mux/src/connui.rs:373` 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) mux/src/ssh.rs:84— mux/src/ssh.rs:84-94 | mux/src/ssh.rs:616-626 — both copies are in the same file, so extract the 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 `mux/src/ssh.rs:84` 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) term/src/screen.rs:801— term/src/screen.rs:801-811 | term/src/screen.rs:875-885 — both copies are in the same file, so extract the 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 `term/src/screen.rs:801` 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, `term/src/screen.rs:813` calls `push_back` and `term/src/screen.rs:886` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) term/src/terminalstate/mod.rs:2667— term/src/terminalstate/mod.rs:2667-2677 | term/src/terminalstate/mod.rs:2724-2734 — both copies are in the same file, so extract the block into 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) termwiz/src/render/terminfo.rs:641— termwiz/src/render/terminfo.rs:641-651 | termwiz/src/render/terminfo.rs:671-681 — both copies are in the same file, so extract the 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 `termwiz/src/render/terminfo.rs:641` 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) term/src/terminalstate/mod.rs:87— term/src/terminalstate/mod.rs:87-97 | term/src/terminalstate/performer.rs:78-88 — before extracting anything, compare `term/src/terminalstate/mod.rs` and `term/src/terminalstate/performer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `term/src/terminalstate/mod.rs:87` 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) term/src/terminalstate/mod.rs:947— term/src/terminalstate/mod.rs:947-957 | term/src/terminalstate/performer.rs:140-150 — before extracting anything, compare `term/src/terminalstate/mod.rs` and `term/src/terminalstate/performer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) term/src/terminalstate/mod.rs:959— term/src/terminalstate/mod.rs:959-969 | term/src/terminalstate/performer.rs:152-162 — before extracting anything, compare `term/src/terminalstate/mod.rs` and `term/src/terminalstate/performer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) crates/wezterm-escape-parser/src/tmux_cc/mod.rs:270— crates/wezterm-escape-parser/src/tmux_cc/mod.rs:270-280 | crates/wezterm-escape-parser/src/tmux_cc/mod.rs:389-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) kaku/src/ai_config/tui.rs:1053— kaku/src/ai_config/tui.rs:1053-1063 | kaku/src/ai_config/tui.rs:1084-1094 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui.rs:1053` 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) crates/wezterm-escape-parser/src/tmux_cc/mod.rs:318— crates/wezterm-escape-parser/src/tmux_cc/mod.rs:318-328 | crates/wezterm-escape-parser/src/tmux_cc/mod.rs:485-495 — both copies are in the same file, so extract the block into 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) kaku/src/ai_config/tui.rs:1063— kaku/src/ai_config/tui.rs:1063-1073 | kaku/src/ai_config/tui/providers/mod.rs:2092-2102 — 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.
TooManyMethods: TermWindow kaku-gui/src/termwindow/mod.rs:1058— TooManyMethods — 309 methods, declared across 20 files: termwindow/mod.rs (153), termwindow/mouseevent.rs (30), termwindow/keyevent.rs (26), render/mod.rs (19), +16 more file(s). The bar is 30 methods; this is 279 over it, 10.30× 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: TerminalState term/src/terminalstate/mod.rs:302— TooManyMethods — 116 methods, declared across 7 files: terminalstate/mod.rs (83), terminalstate/kitty.rs (17), terminalstate/mouse.rs (8), terminalstate/keyboard.rs (4), +3 more file(s). The bar is 30 methods; this is 86 over it, 3.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: WindowView window/src/os/macos/window.rs:4552— TooManyMethods — 89 methods. The bar is 30 methods; this is 59 over it, 2.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Line crates/wezterm-surface/src/line/line.rs:46— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Mux mux/src/lib.rs:151— TooManyMethods — 68 methods. The bar is 30 methods; this is 38 over it, 2.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: App kaku-gui/src/overlay/ai_chat/state.rs:704— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CopyRenderable kaku-gui/src/overlay/copy.rs:63— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WindowInner window/src/os/macos/window.rs:524— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: App kaku/src/config_tui/mod.rs:361— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: TabInner mux/src/tab.rs:93— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Tab mux/src/tab.rs:105— TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BidiContext crates/bidi/src/lib.rs:75— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: App kaku/src/ai_config/tui.rs:1954— 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: Screen term/src/screen.rs:15— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: TabRenameModal kaku-gui/src/termwindow/tab_rename.rs:30— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Surface crates/wezterm-surface/src/lib.rs:107— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Config config/src/config.rs:52— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 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.
Duplicated block (5 lines × 2) kaku-gui/src/cli_chat/mod.rs:326— kaku-gui/src/cli_chat/mod.rs:326-330 | kaku-gui/src/cli_chat/mod.rs:333-337 — both copies are in the same file, so extract the 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 `kaku-gui/src/cli_chat/mod.rs:326` 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 × 2) kaku-gui/src/codex_connection.rs:220— kaku-gui/src/codex_connection.rs:220-224 | kaku-gui/src/codex_connection.rs:267-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/codex_connection.rs:220` 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) kaku-gui/src/customglyph.rs:3393— kaku-gui/src/customglyph.rs:3393-3397 | kaku-gui/src/customglyph.rs:3407-3411 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3393` 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) kaku-gui/src/customglyph.rs:3485— kaku-gui/src/customglyph.rs:3485-3491 | kaku-gui/src/customglyph.rs:3523-3527 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:3485` 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) kaku-gui/src/customglyph.rs:4812— kaku-gui/src/customglyph.rs:4812-4816 | kaku-gui/src/customglyph.rs:4846-4850 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:4812` 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 × 2) kaku-gui/src/customglyph.rs:5670— kaku-gui/src/customglyph.rs:5670-5674 | kaku-gui/src/customglyph.rs:5685-5689 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5670` 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) kaku-gui/src/customglyph.rs:5700— kaku-gui/src/customglyph.rs:5700-5704 | kaku-gui/src/customglyph.rs:5715-5719 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:5700` 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) kaku-gui/src/overlay/ai_chat/state.rs:1730— kaku-gui/src/overlay/ai_chat/state.rs:1730-1735 | kaku-gui/src/overlay/ai_chat/state.rs:2406-2410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/overlay/ai_chat/state.rs:1736` calls `build_api_messages` and `kaku-gui/src/overlay/ai_chat/state.rs:2411` 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 (5 lines × 2) kaku-gui/src/stats.rs:224— kaku-gui/src/stats.rs:224-228 | kaku-gui/src/stats.rs:259-263 — both copies are in the same file, so extract the 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 `kaku-gui/src/stats.rs:224` 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) mux/src/ssh.rs:100— mux/src/ssh.rs:100-104 | mux/src/ssh.rs:632-636 — both copies are in the same file, so extract the 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 `mux/src/ssh.rs:100` 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) lua-api-crates/mux/src/tab.rs:47— lua-api-crates/mux/src/tab.rs:47-51 | lua-api-crates/mux/src/window.rs:65-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `lua-api-crates/mux/src/tab.rs:47` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) kaku/src/ai_config/tui/providers/assistant.rs:517— kaku/src/ai_config/tui/providers/assistant.rs:517-521 | kaku/src/ai_config/tui/providers/assistant.rs:523-527 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui/providers/assistant.rs:517` 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) kaku-gui/src/termwindow/mod.rs:6080— kaku-gui/src/termwindow/mod.rs:6080-6084 | kaku-gui/src/termwindow/mod.rs:6094-6098 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/mod.rs:6080` 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 × 2) kaku-gui/src/overlay/mod.rs:56— kaku-gui/src/overlay/mod.rs:56-60 | kaku-gui/src/overlay/mod.rs:94-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/overlay/mod.rs:62` calls `pane_id` and `kaku-gui/src/overlay/mod.rs:100` 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 (5 lines × 2) term/src/screen.rs:1000— term/src/screen.rs:1000-1004 | term/src/screen.rs:1024-1028 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) window/src/os/macos/connection.rs:250— window/src/os/macos/connection.rs:250-254 | window/src/os/macos/connection.rs:261-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `window/src/os/macos/connection.rs:250` 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) window/src/os/macos/window.rs:3219— window/src/os/macos/window.rs:3219-3223 | window/src/os/macos/window.rs:3293-3297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) config/derive/src/bound.rs:5— config/derive/src/bound.rs:5-16 | crates/wezterm-dynamic/derive/src/bound.rs:5-16 — before extracting anything, compare `config/derive/src/bound.rs` and `crates/wezterm-dynamic/derive/src/bound.rs` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire 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) config/src/keyassignment.rs:364— config/src/keyassignment.rs:364-375 | mux/src/domain.rs:315-326 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cmd` to `&CommandBuilder` in one and `&mut CommandBuilder` 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 (12 lines × 2) crates/bintree/src/lib.rs:326— crates/bintree/src/lib.rs:326-337 | crates/bintree/src/lib.rs:340-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/bintree/src/lib.rs:362— crates/bintree/src/lib.rs:362-373 | crates/bintree/src/lib.rs:384-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/tabout/src/lib.rs:32— crates/tabout/src/lib.rs:32-43 | crates/tabout/src/lib.rs:147-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/wezterm-ssh/src/auth.rs:98— crates/wezterm-ssh/src/auth.rs:98-112 | crates/wezterm-ssh/src/auth.rs:292-303 — both copies are in the same file, so extract the 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 `crates/wezterm-ssh/src/auth.rs:98` 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) kaku-gui/src/ai_tools/search.rs:694— kaku-gui/src/ai_tools/search.rs:694-705 | kaku-gui/src/ai_tools/search.rs:877-888 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_tools/search.rs:694` 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) kaku-gui/src/overlay/launcher.rs:199— kaku-gui/src/overlay/launcher.rs:199-210 | kaku-gui/src/overlay/selector.rs:75-86 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) kaku-gui/src/termwindow/resize.rs:596— kaku-gui/src/termwindow/resize.rs:596-607 | kaku-gui/src/termwindow/resize.rs:682-693 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/resize.rs:596` 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) kaku/src/ai_config/tui.rs:2243— kaku/src/ai_config/tui.rs:2243-2254 | kaku/src/ai_config/tui.rs:2280-2291 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui.rs:2243` 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) kaku/src/cli/activate_tab.rs:73— kaku/src/cli/activate_tab.rs:73-84 | kaku/src/cli/set_tab_title.rs:37-48 — 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 `kaku/src/cli/activate_tab.rs:73` 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) mux/src/tab.rs:442— mux/src/tab.rs:442-453 | mux/src/tab.rs:512-523 — both copies are in the same file, so extract the 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 `mux/src/tab.rs:442` 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) term/src/screen.rs:683— term/src/screen.rs:683-694 | term/src/screen.rs:952-963 — both copies are in the same file, so extract the 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 `term/src/screen.rs:683` 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) crates/wezterm-font/src/rasterizer/colr.rs:113— crates/wezterm-font/src/rasterizer/colr.rs:113-124 | crates/wezterm-font/src/rasterizer/colr.rs:146-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-font/src/rasterizer/colr.rs:113` 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) kaku/src/ai_config/tui/ui.rs:79— kaku/src/ai_config/tui/ui.rs:79-90 | kaku/src/config_tui/ui.rs:158-169 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Off the main sequence: bintree — bintree: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: frecency — frecency: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Off the main sequence: promise — promise: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
Off the main sequence: rangeset — rangeset: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
Off the main sequence: umask — umask: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
Off the main sequence: wezterm-char-props — wezterm-char-props: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: wezterm-uds — wezterm-uds: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: luahelper — luahelper: abstractness 0.00, instability 0.05, distance 0.95 — zone of pain — concrete and depended on by 19 project(s), so it's rigid to change.
Off the main sequence: wezterm-bidi — wezterm-bidi: abstractness 0.00, instability 0.13, distance 0.88 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
Off the main sequence: wezterm-color-types — wezterm-color-types: abstractness 0.00, instability 0.13, distance 0.88 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
Off the main sequence: wezterm-input-types — wezterm-input-types: abstractness 0.00, instability 0.13, distance 0.88 — zone of pain — concrete and depended on by 7 project(s), so it's rigid to change.
Off the main sequence: vtparse — vtparse: abstractness 0.25, instability 0.00, distance 0.75 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
Off the main sequence: wezterm-blob-leases — wezterm-blob-leases: abstractness 0.25, instability 0.00, distance 0.75 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
Off the main sequence: wezterm-toast-notification — wezterm-toast-notification: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: config — config: abstractness 0.01, instability 0.28, distance 0.70 — zone of pain — concrete and depended on by 28 project(s), so it's rigid to change.
kaku::ai_config::tui::run_loop (cyclomatic 68) kaku/src/ai_config/tui.rs:3115— kaku::ai_config::tui::run_loop 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.
kaku::ai_config::tui::save_field (cyclomatic 47) kaku/src/ai_config/tui.rs:2757— kaku::ai_config::tui::save_field 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.
kaku::ai_config::tui::ui::render_tools (cyclomatic 36) kaku/src/ai_config/tui/ui.rs:109— kaku::ai_config::tui::ui::render_tools 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.
kaku::ai_config::tui::providers::assistant::save_kaku_assistant_field_to_path (cyclomatic 34) kaku/src/ai_config/tui/providers/assistant.rs:438— kaku::ai_config::tui::providers::assistant::save_kaku_assistant_field_to_path has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku::config_tui::run_app (cyclomatic 28) kaku/src/config_tui/mod.rs:65— kaku::config_tui::run_app has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
kaku::doctor::build_shell_integration_group (cyclomatic 27) kaku/src/doctor.rs:448— kaku::doctor::build_shell_integration_group 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.
kaku::run_remote (cyclomatic 25) kaku/src/lib.rs:323— kaku::run_remote 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.
kaku::ai_config::tui::providers::codex::codex_connection_is_configured_at (cyclomatic 23) kaku/src/ai_config/tui/providers/codex.rs:46— kaku::ai_config::tui::providers::codex::codex_connection_is_configured_at 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.
kaku::select_main_menu_command (cyclomatic 22) kaku/src/lib.rs:789— kaku::select_main_menu_command has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
kaku::update::imp::run (cyclomatic 19) kaku/src/update.rs:80— kaku::update::imp::run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku::doctor::build_environment_group (cyclomatic 18) kaku/src/doctor.rs:262— kaku::doctor::build_environment_group 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.
kaku::utils::strip_jsonc_comments (cyclomatic 18) kaku/src/utils.rs:191— kaku::utils::strip_jsonc_comments 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.
kaku::ai_config::tui::extract_openclaw_fields (cyclomatic 17) kaku/src/ai_config/tui.rs:1757— kaku::ai_config::tui::extract_openclaw_fields has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku::reset::imp::strip_legacy_inline_block (cyclomatic 17) kaku/src/reset.rs:712— kaku::reset::imp::strip_legacy_inline_block 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.
kaku_remote::web::run_session (cognitive 385) crates/kaku-remote/src/web.rs:2818— kaku_remote::web::run_session has cognitive complexity 385 (threshold 15). Drivers by points: if/else 89 (339 pts), match/switch 8 (24 pts), loops 4 (12 pts), boolean chains 10 (nesting depth added 274). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_remote::share::serve (cognitive 124) crates/kaku-remote/src/share.rs:877— kaku_remote::share::serve has cognitive complexity 124 (threshold 15). Drivers by points: if/else 23 (89 pts), match/switch 7 (23 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_remote::p2p::carry (cognitive 69) REDACTED:705— kaku_remote::p2p::carry has cognitive complexity 69 (threshold 15). Drivers by points: if/else 14 (52 pts), match/switch 3 (9 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_remote::p2p::wrap (cognitive 68) REDACTED:114— kaku_remote::p2p::wrap has cognitive complexity 68 (threshold 15). Drivers by points: if/else 14 (40 pts), match/switch 7 (18 pts), loops 5 (8 pts), boolean chains 2 (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.
kaku_remote::web::handle_input (cognitive 48) crates/kaku-remote/src/web.rs:2516— kaku_remote::web::handle_input has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (41 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_remote::web::handle_upload (cognitive 42) crates/kaku-remote/src/web.rs:1273— kaku_remote::web::handle_upload has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 20). 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.
kaku_remote::share::advance (cognitive 31) crates/kaku-remote/src/share.rs:367— kaku_remote::share::advance has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 4 (8 pts) (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
kaku_remote::web::find_in_rows (cognitive 24) crates/kaku-remote/src/web.rs:1469— kaku_remote::web::find_in_rows has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_remote::web::handle_download (cognitive 22) crates/kaku-remote/src/web.rs:1168— kaku_remote::web::handle_download has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 2 (3 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
kaku_remote::desktop::tap_with (cognitive 20) crates/kaku-remote/src/desktop.rs:132— kaku_remote::desktop::tap_with has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (3 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.
kaku_remote::web::search_pane (cognitive 20) crates/kaku-remote/src/web.rs:1521— kaku_remote::web::search_pane has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 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.
kaku_remote::web::image_placements (cognitive 18) crates/kaku-remote/src/web.rs:1701— kaku_remote::web::image_placements has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_remote::web::row_text (cognitive 17) crates/kaku-remote/src/web.rs:2209— kaku_remote::web::row_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (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.
TerminalState::perform_csi_edit (cognitive 54) term/src/terminalstate/mod.rs:2372— TerminalState::perform_csi_edit has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 4 (10 pts), boolean chains 5, match/switch 3 (5 pts) (nesting depth added 28). 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.
TerminalState::perform_csi_cursor (cognitive 44) term/src/terminalstate/mod.rs:2570— TerminalState::perform_csi_cursor has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (37 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TerminalState::resolve_kitty_placeholder_line (cognitive 28) term/src/terminalstate/kitty.rs:1122— TerminalState::resolve_kitty_placeholder_line has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 5, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TerminalState::set_image (cognitive 25) term/src/terminalstate/iterm.rs:10— TerminalState::set_image has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 5 (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.
TerminalState::sixel (cognitive 25) term/src/terminalstate/sixel.rs:10— TerminalState::sixel has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 3 (5 pts), match/switch 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.
TerminalState::assign_image_to_cells (cognitive 24) term/src/terminalstate/image.rs:96— TerminalState::assign_image_to_cells has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalState::kitty_frame_transmit (cognitive 21) term/src/terminalstate/kitty.rs:605— TerminalState::kitty_frame_transmit has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 8 (13 pts), if/else 5 (8 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
TerminalState::coalesce_kitty_accumulation (cognitive 21) term/src/terminalstate/kitty.rs:919— TerminalState::coalesce_kitty_accumulation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (8 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalState::set_cursor_pos (cognitive 20) term/src/terminalstate/mod.rs:1227— TerminalState::set_cursor_pos has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TerminalState::perform_csi_mode (cognitive 19) term/src/terminalstate/mod.rs:1683— TerminalState::perform_csi_mode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TerminalState::kitty_img (cognitive 18) term/src/terminalstate/kitty.rs:192— TerminalState::kitty_img has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalState::kitty_remove_placement (cognitive 16) term/src/terminalstate/kitty.rs:346— TerminalState::kitty_remove_placement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::drain_tokens (cognitive 72) kaku-gui/src/overlay/ai_chat/state.rs:1823— App::drain_tokens has cognitive complexity 72 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 12, loops 4 (10 pts), match/switch 3 (6 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
App::rebuild_display_cache (cognitive 48) kaku-gui/src/overlay/ai_chat/state.rs:1228— App::rebuild_display_cache has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 2 (6 pts), boolean chains 5, match/switch 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::load_window_decorations (cognitive 29) kaku/src/config_tui/mod.rs:700— App::load_window_decorations has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::submit (cognitive 28) kaku-gui/src/overlay/ai_chat/state.rs:1594— App::submit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (22 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
App::to_lua_value (cognitive 26) kaku/src/config_tui/mod.rs:1501— App::to_lua_value has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 3 (5 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
App::set_lua_config_line (cognitive 25) kaku/src/config_tui/mod.rs:1436— App::set_lua_config_line has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::normalize_value (cognitive 24) kaku/src/config_tui/mod.rs:987— App::normalize_value has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 3 (5 pts), boolean chains 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.
App::start_edit (cognitive 23) kaku/src/ai_config/tui.rs:2428— App::start_edit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6 (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.
App::extract_lua_value (cognitive 19) kaku/src/config_tui/mod.rs:795— App::extract_lua_value has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::activate_control (cognitive 19) kaku-gui/src/overlay/ai_chat/state.rs:1460— App::activate_control has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, 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.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×10
Edited copy of a member (10 corresponding lines) window/src/os/macos/connection.rs:249— window/src/os/macos/connection.rs:249-258 | window/src/os/macos/connection.rs:260-274 — 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) kaku/src/reset.rs:792— kaku/src/reset.rs:792-801 | kaku/src/reset.rs:807-816 — 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) kaku-gui/src/ai_conversations.rs:138— kaku-gui/src/ai_conversations.rs:138-148 | kaku-gui/src/ai_state.rs:60-69 — 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) kaku-gui/src/termwindow/tab_rename.rs:244— kaku-gui/src/termwindow/tab_rename.rs:244-257 | kaku-gui/src/termwindow/tab_rename.rs:303-312 — 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) kaku-gui/src/termwindow/paneselect.rs:281— kaku-gui/src/termwindow/paneselect.rs:281-290 | kaku-gui/src/termwindow/tab_rename.rs:1122-1131 — 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) kaku/src/config_tui/mod.rs:874— kaku/src/config_tui/mod.rs:874-883 | kaku/src/config_tui/mod.rs:910-921 — 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) crates/wezterm-surface/src/lib.rs:398— crates/wezterm-surface/src/lib.rs:398-407 | crates/wezterm-surface/src/lib.rs:409-418 — 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) kaku-gui/src/renderstate.rs:267— kaku-gui/src/renderstate.rs:267-278 | kaku-gui/src/renderstate.rs:306-315 — 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) crates/wezterm-font/src/shaper/harfbuzz.rs:793— crates/wezterm-font/src/shaper/harfbuzz.rs:793-802 | crates/wezterm-font/src/shaper/harfbuzz.rs:804-813 — 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) crates/wezterm-ssh/src/sftp/file.rs:282— crates/wezterm-ssh/src/sftp/file.rs:282-291 | crates/wezterm-ssh/src/sftp/file.rs:301-310 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×10
Edited copy of a member (12 corresponding lines) kaku-gui/src/ai_conversations.rs:351— kaku-gui/src/ai_conversations.rs:351-362 | kaku-gui/src/ai_conversations.rs:368-383 — 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) kaku-gui/src/ai_chat_engine/suggestion.rs:44— kaku-gui/src/ai_chat_engine/suggestion.rs:44-55 | kaku-gui/src/ai_chat_engine/title.rs:34-48 — 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) crates/filedescriptor/src/unix.rs:95— crates/filedescriptor/src/unix.rs:95-106 | crates/filedescriptor/src/unix.rs:269-280 — 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) crates/wezterm-dynamic/src/value.rs:59— crates/wezterm-dynamic/src/value.rs:59-70 | crates/wezterm-dynamic/src/value.rs:72-83 — 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) kaku-gui/src/renderstate.rs:280— kaku-gui/src/renderstate.rs:280-291 | kaku-gui/src/renderstate.rs:293-304 — 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) mux/src/connui.rs:26— mux/src/connui.rs:26-37 | mux/src/ssh.rs:42-59 — 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) kaku-gui/src/termwindow/mod.rs:2909— kaku-gui/src/termwindow/mod.rs:2909-2920 | kaku-gui/src/termwindow/mod.rs:2922-2933 — 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) term/src/color.rs:108— term/src/color.rs:108-119 | term/src/color.rs:120-131 — 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) kaku-gui/src/selection.rs:73— kaku-gui/src/selection.rs:73-84 | kaku-gui/src/selection.rs:110-121 — 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) mux/src/ssh.rs:1129— mux/src/ssh.rs:1129-1140 | mux/src/ssh.rs:1144-1155 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×10
Edited copy of a member (9 corresponding lines) crates/wezterm-ssh/src/sftpwrap.rs:71— crates/wezterm-ssh/src/sftpwrap.rs:71-79 | crates/wezterm-ssh/src/sftpwrap.rs:81-89 — 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) window/src/bitmaps/mod.rs:138— window/src/bitmaps/mod.rs:138-153 | window/src/bitmaps/mod.rs:157-165 — 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) crates/wezterm-escape-parser/src/csi.rs:2244— crates/wezterm-escape-parser/src/csi.rs:2244-2252 | crates/wezterm-escape-parser/src/csi.rs:2254-2262 — 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) term/src/terminalstate/mod.rs:1347— term/src/terminalstate/mod.rs:1347-1355 | term/src/terminalstate/mod.rs:1409-1417 — 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) crates/wezterm-ssh/src/channelwrap.rs:119— crates/wezterm-ssh/src/channelwrap.rs:119-127 | crates/wezterm-ssh/src/channelwrap.rs:129-137 — 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) crates/wezterm-ssh/src/sftp/dir.rs:28— crates/wezterm-ssh/src/sftp/dir.rs:28-36 | crates/wezterm-ssh/src/sftp/file.rs:66-74 — 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) config/src/lib.rs:594— config/src/lib.rs:594-602 | kaku/src/chat.rs:89-98 — 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) crates/wezterm-ssh/src/channelwrap.rs:72— crates/wezterm-ssh/src/channelwrap.rs:72-80 | crates/wezterm-ssh/src/filewrap.rs:13-21 — 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) crates/wezterm-font/src/shaper/harfbuzz.rs:37— crates/wezterm-font/src/shaper/harfbuzz.rs:37-45 | kaku-gui/src/customglyph.rs:712-720 — 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) crates/color-types/src/lib.rs:434— crates/color-types/src/lib.rs:434-442 | crates/wezterm-input-types/src/lib.rs:1163-1172 — 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.
TerminalState::perform_csi_mode (cyclomatic 113) term/src/terminalstate/mod.rs:1683— TerminalState::perform_csi_mode has cyclomatic complexity 113 (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.
TerminalState::perform_csi_cursor (cyclomatic 46) term/src/terminalstate/mod.rs:2570— TerminalState::perform_csi_cursor 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.
TerminalState::perform_csi_edit (cyclomatic 32) term/src/terminalstate/mod.rs:2372— TerminalState::perform_csi_edit 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.
TerminalState::sixel (cyclomatic 21) term/src/terminalstate/sixel.rs:10— TerminalState::sixel 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.
TerminalState::set_image (cyclomatic 20) term/src/terminalstate/iterm.rs:10— TerminalState::set_image 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.
TerminalState::kitty_img (cyclomatic 18) term/src/terminalstate/kitty.rs:192— TerminalState::kitty_img 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.
TerminalState::resolve_kitty_placeholder_line (cyclomatic 16) term/src/terminalstate/kitty.rs:1122— TerminalState::resolve_kitty_placeholder_line 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.
TerminalState::perform_device (cyclomatic 16) term/src/terminalstate/mod.rs:1488— TerminalState::perform_device 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.
TerminalState::mouse_wheel (cyclomatic 16) term/src/terminalstate/mouse.rs:76— TerminalState::mouse_wheel has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Repeated repair: window/src/os/macos/menu.rs window/src/os/macos/menu.rs:44— window/src/os/macos/menu.rs changed 7 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 2 (its worst body is Menu::set_row_height at line 44), 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(macos): rebuild the menubar in place on config reload”; “fix(menu): retain separator items instead of adopting them”; “fix(gui): harden launcher teardown and guard menubar init”; “fix(macos): make terminal context menu safe”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- window/src/os/macos/menu.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: kaku-gui/src/termwindow/render/agent_title.rs kaku-gui/src/termwindow/render/agent_title.rs:232— kaku-gui/src/termwindow/render/agent_title.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is TermWindow::paint_agent_title at line 232), 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(gui): do not repeat the agent topic its own border already shows”; “fix(gui): keep the agent title fitted and clear of the first row”; “fix(gui): keep complete words in agent topics”; “fix(gui): give the agent mark half a point more room before the topic”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/render/agent_title.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: window/src/lib.rs window/src/lib.rs:300— window/src/lib.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is WindowEventSender::dispatch at line 300), 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(window): recover when main thread tasks stop running”; “fix(window): give voice input tools a caret to find in the terminal view”; “fix(macos): #574 isolate hotkey sessions and recover display geometry”; “fix(macos): make terminal context menu safe”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- window/src/lib.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: kaku-gui/src/inline_ai.rs kaku-gui/src/inline_ai.rs:96— kaku-gui/src/inline_ai.rs changed 4 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 5 (its worst body is kaku_gui::inline_ai::job_paths at line 96), 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(ai): never run a fix that quits or kills apps on Cmd+Shift+E”; “fix(ai): keep file names whole in inline summaries”; “fix(ai): preserve inline explanations and command candidates”; “fix(ai): keep inline command requests valid and repeatable”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/inline_ai.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: crates/wezterm-surface/src/line/test.rs crates/wezterm-surface/src/line/test.rs:405— crates/wezterm-surface/src/line/test.rs 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 wezterm_surface::line::test::bold at line 405), 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(surface): #608 stop the link scan at the last cell instead of aborting”; “fix(links): keep hard-newline output out of hyperlink targets”; “fix(links): #547 rejoin rows a TUI wrapped without the wrap attribute”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/wezterm-surface/src/line/test.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: window/src/os/macos/app.rs window/src/os/macos/app.rs:1423— window/src/os/macos/app.rs 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 10 (its worst body is window::os::macos::app::first_service_path at line 1423), 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(macos): stop blocking log out, restart and shut down”; “fix(macos): #574 isolate hotkey sessions and recover display geometry”; “fix(macos): make terminal context menu safe”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- window/src/os/macos/app.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: kaku/src/diagnostics.rs kaku/src/diagnostics.rs:224— kaku/src/diagnostics.rs 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 6 (its worst body is kaku::diagnostics::collect_crash_reports at line 224), 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(doctor): redact committed input method text”; “fix(doctor): keep typed keys out of the diagnostics bundle”; “fix(doctor): redact URL credentials and fine-grained GitHub tokens”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku/src/diagnostics.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: kaku-gui/src/termwindow/tab_rename.rs kaku-gui/src/termwindow/tab_rename.rs:799— kaku-gui/src/termwindow/tab_rename.rs 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 TabRenameModal::compute at line 799), 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(gui): #576 center the rename editor when the tab bar is hidden”; “fix(gui): show the selection in the tab rename editor”; “fix(theme): use resolved colors for fancy tabs and renaming”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- kaku-gui/src/termwindow/tab_rename.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: crates/wezterm-surface/src/line/line.rs crates/wezterm-surface/src/line/line.rs:571— crates/wezterm-surface/src/line/line.rs 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 14 (its worst body is Line::apply_hyperlink_rules at line 571), 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(links): keep hard-newline output out of hyperlink targets”; “fix(links): drop needless borrows in the row continuity check”; “fix(links): #547 rejoin rows a TUI wrapped without the wrap attribute”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 16:47:41 +08:00' --until='2026-11-14 16:47:41 +08:00' --full-history --no-merges -- crates/wezterm-surface/src/line/line.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.
BidiContext::explicit_embedding_levels (cognitive 103) crates/bidi/src/lib.rs:1337— BidiContext::explicit_embedding_levels has cognitive complexity 103 (threshold 15). Drivers by points: if/else 29 (89 pts), boolean chains 7, loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BidiContext::reverse_levels (cognitive 39) crates/bidi/src/lib.rs:355— BidiContext::reverse_levels has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 2 (7 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BidiContext::resolve_paired_brackets (cognitive 27) crates/bidi/src/lib.rs:819— BidiContext::resolve_paired_brackets has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 3 (5 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.
BidiContext::resolve_terminators (cognitive 26) crates/bidi/src/lib.rs:718— BidiContext::resolve_terminators has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (11 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BidiContext::resolve_european_numbers (cognitive 25) crates/bidi/src/lib.rs:565— BidiContext::resolve_european_numbers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (8 pts), match/switch 1 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (BidiContext::resolve_en) 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.
BidiContext::resolve_en (cognitive 25) crates/bidi/src/lib.rs:773— BidiContext::resolve_en has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (8 pts), match/switch 1 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (BidiContext::resolve_european_numbers) 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.
BidiContext::reorder_non_spacing_marks (cognitive 18) crates/bidi/src/lib.rs:304— BidiContext::reorder_non_spacing_marks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BidiContext::resolve_one_pair (cognitive 18) crates/bidi/src/lib.rs:967— BidiContext::resolve_one_pair has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BidiContext::resolve_separators (cognitive 16) crates/bidi/src/lib.rs:676— BidiContext::resolve_separators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 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.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×9
Edited copy of a member (11 corresponding lines) kaku-gui/src/overlay/confirm.rs:293— kaku-gui/src/overlay/confirm.rs:293-303 | kaku-gui/src/overlay/prompt.rs:95-105 — 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) kaku-gui/src/stats.rs:52— kaku-gui/src/stats.rs:52-65 | kaku-gui/src/stats.rs:67-77 — 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) kaku-gui/src/overlay/ai_chat/layout.rs:14— kaku-gui/src/overlay/ai_chat/layout.rs:14-24 | kaku-gui/src/overlay/ai_chat/layout.rs:28-38 — 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) mux/src/connui.rs:102— mux/src/connui.rs:102-112 | mux/src/connui.rs:114-124 — 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) crates/vtparse/src/transitions.rs:234— crates/vtparse/src/transitions.rs:234-244 | crates/vtparse/src/transitions.rs:269-279 — 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) kaku-gui/src/tabbar.rs:524— kaku-gui/src/tabbar.rs:524-534 | kaku-gui/src/tabbar.rs:812-823 — 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) mux/src/tab.rs:632— mux/src/tab.rs:632-643 | mux/src/window.rs:40-50 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/wezterm-font/src/shaper/mod.rs:96— crates/wezterm-font/src/shaper/mod.rs:96-109 | kaku-gui/src/termwindow/wrapped_link.rs:79-89 — 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) kaku-gui/src/overlay/copy.rs:666— kaku-gui/src/overlay/copy.rs:666-677 | kaku-gui/src/termwindow/tab_rename.rs:159-169 — 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.
Duplicated block (15 lines × 2) crates/filedescriptor/src/unix.rs:310— crates/filedescriptor/src/unix.rs:310-324 | crates/filedescriptor/src/unix.rs:336-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 `crates/filedescriptor/src/unix.rs:310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/wezterm-font/src/ftwrap.rs:267— crates/wezterm-font/src/ftwrap.rs:267-281 | crates/wezterm-font/src/ftwrap.rs:766-780 — both copies are in the same file, so extract the 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 `crates/wezterm-font/src/ftwrap.rs:267` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/wezterm-ssh/src/sessioninner.rs:111— crates/wezterm-ssh/src/sessioninner.rs:111-125 | crates/wezterm-ssh/src/sessioninner.rs:262-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) kaku-gui/src/glyphcache.rs:1219— kaku-gui/src/glyphcache.rs:1219-1233 | kaku-gui/src/glyphcache.rs:1241-1255 — both copies are in the same file, so extract the 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 `kaku-gui/src/glyphcache.rs:1219` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15 lines × 2) kaku-gui/src/overlay/ai_chat/state.rs:416— kaku-gui/src/overlay/ai_chat/state.rs:416-430 | kaku-gui/src/overlay/ai_chat/state.rs:439-453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/ai_chat/state.rs:416` 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) kaku-gui/src/termwindow/mod.rs:4419— kaku-gui/src/termwindow/mod.rs:4419-4433 | kaku-gui/src/termwindow/mod.rs:4443-4457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `args` to `&PromptInputLine` in one and `&Confirmation` 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 (15 lines × 2) kaku-gui/src/update.rs:821— kaku-gui/src/update.rs:821-835 | kaku/src/update.rs:694-708 — before extracting anything, compare `kaku-gui/src/update.rs` and `kaku/src/update.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (15 lines × 2) termwiz/src/input.rs:741— termwiz/src/input.rs:741-757 | termwiz/src/input.rs:790-804 — both copies are in the same file, so extract the 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 `termwiz/src/input.rs:741` 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) kaku-gui/src/update.rs:289— kaku-gui/src/update.rs:289-303 | kaku/src/update.rs:956-970 — before extracting anything, compare `kaku-gui/src/update.rs` and `kaku/src/update.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
mux::parse_buffered_data (cognitive 54) mux/src/lib.rs:336— mux::parse_buffered_data has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (38 pts), match/switch 4 (12 pts), boolean chains 3, loops 1 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mux::ssh::connect_ssh_session (cognitive 48) mux/src/ssh.rs:430— mux::ssh::connect_ssh_session has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 4 (9 pts), match/switch 3 (9 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mux::read_from_pane_pty (cognitive 39) mux/src/lib.rs:613— mux::read_from_pane_pty has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (29 pts), match/switch 5 (9 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mux::ssh::ssh_connect_with_ui (cognitive 37) mux/src/ssh.rs:62— mux::ssh::ssh_connect_with_ui has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (8 pts), match/switch 2 (6 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mux::tab::adjust_x_size (cognitive 23) mux/src/tab.rs:440— mux::tab::adjust_x_size has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (16 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (mux::tab::adjust_y_size) 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.
mux::tab::adjust_y_size (cognitive 23) mux/src/tab.rs:510— mux::tab::adjust_y_size has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (16 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (mux::tab::adjust_x_size) 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.
mux::pane::impl_get_logical_lines_via_get_lines (cognitive 18) mux/src/pane.rs:567— mux::pane::impl_get_logical_lines_via_get_lines has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mux::pane_encoding::advance_escape (cognitive 17) mux/src/pane_encoding.rs:34— mux::pane_encoding::advance_escape has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3 (5 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Config::load_color_schemes (cognitive 37) config/src/config.rs:1969— Config::load_color_schemes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (26 pts), match/switch 1 (7 pts), loops 2 (4 pts) (nesting depth added 27). Of this number, 35 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Config::expand_tokens (cognitive 26) crates/wezterm-ssh/src/config.rs:677— Config::expand_tokens has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::compute_extra_defaults (cognitive 22) config/src/config.rs:1817— Config::compute_extra_defaults has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::enumerate_hosts (cognitive 22) crates/wezterm-ssh/src/config.rs:778— Config::enumerate_hosts has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 2 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Config::apply_cmd_defaults (cognitive 20) config/src/config.rs:2089— Config::apply_cmd_defaults has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::for_host (cognitive 19) crates/wezterm-ssh/src/config.rs:514— Config::for_host has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::try_load (cognitive 17) config/src/config.rs:1428— Config::try_load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, match/switch 3 (5 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Config::load_with_window_overrides (cognitive 16) config/src/config.rs:1217— Config::load_with_window_overrides has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (3 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.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×8
Edited copy of a member (8 corresponding lines) kaku-gui/src/ai_tools/soul.rs:15— kaku-gui/src/ai_tools/soul.rs:15-25 | kaku-gui/src/soul.rs:38-45 — 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) window/src/os/macos/window.rs:3103— window/src/os/macos/window.rs:3103-3110 | window/src/os/macos/window.rs:3332-3344 — 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) crates/filedescriptor/src/unix.rs:179— crates/filedescriptor/src/unix.rs:179-186 | crates/filedescriptor/src/unix.rs:190-197 — 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) kaku-gui/src/overlay/ai_chat/state.rs:464— kaku-gui/src/overlay/ai_chat/state.rs:464-471 | kaku-gui/src/termwindow/mod.rs:496-503 — 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) kaku-gui/src/ai_auth.rs:191— kaku-gui/src/ai_auth.rs:191-198 | kaku-gui/src/ai_auth.rs:221-233 — 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) kaku-gui/src/ai_auth.rs:42— kaku-gui/src/ai_auth.rs:42-50 | kaku-gui/src/ai_auth.rs:180-187 — 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) window/src/os/macos/window.rs:2135— window/src/os/macos/window.rs:2135-2142 | window/src/os/macos/window.rs:2219-2231 — 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) crates/wezterm-ssh/src/sessioninner.rs:891— crates/wezterm-ssh/src/sessioninner.rs:891-899 | crates/wezterm-ssh/src/pty.rs:316-323 — 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.
kaku_remote::web::run_session (cyclomatic 119) crates/kaku-remote/src/web.rs:2818— kaku_remote::web::run_session has cyclomatic complexity 119 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku_remote::share::serve (cyclomatic 55) crates/kaku-remote/src/share.rs:877— kaku_remote::share::serve has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
kaku_remote::web::handle_input (cyclomatic 40) crates/kaku-remote/src/web.rs:2516— kaku_remote::web::handle_input 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.
kaku_remote::p2p::wrap (cyclomatic 31) REDACTED:114— kaku_remote::p2p::wrap 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.
kaku_remote::p2p::carry (cyclomatic 31) REDACTED:705— kaku_remote::p2p::carry 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.
kaku_remote::web::handle_upload (cyclomatic 26) crates/kaku-remote/src/web.rs:1273— kaku_remote::web::handle_upload 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.
kaku_remote::share::advance (cyclomatic 21) crates/kaku-remote/src/share.rs:367— kaku_remote::share::advance 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.
App::drain_tokens (cyclomatic 48) kaku-gui/src/overlay/ai_chat/state.rs:1823— App::drain_tokens has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App::normalize_value (cyclomatic 23) kaku/src/config_tui/mod.rs:987— App::normalize_value 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.
App::submit (cyclomatic 23) kaku-gui/src/overlay/ai_chat/state.rs:1594— App::submit 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.
App::rebuild_display_cache (cyclomatic 22) kaku-gui/src/overlay/ai_chat/state.rs:1228— App::rebuild_display_cache 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.
App::start_edit (cyclomatic 20) kaku/src/ai_config/tui.rs:2428— App::start_edit 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.
App::to_lua_value (cyclomatic 20) kaku/src/config_tui/mod.rs:1501— App::to_lua_value 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.
App::activate_control (cyclomatic 19) kaku-gui/src/overlay/ai_chat/state.rs:1460— App::activate_control 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.
SessionInner::request_loop (cognitive 48) crates/wezterm-ssh/src/sessioninner.rs:426— SessionInner::request_loop has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 2 (10 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionInner::authenticate (cognitive 35) crates/wezterm-ssh/src/auth.rs:255— SessionInner::authenticate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionInner::tick_io (cognitive 31) crates/wezterm-ssh/src/sessioninner.rs:533— SessionInner::tick_io has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionInner::pubkey_auth (cognitive 21) crates/wezterm-ssh/src/auth.rs:57— SessionInner::pubkey_auth has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (7 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionInner::authenticate_libssh (cognitive 21) crates/wezterm-ssh/src/auth.rs:132— SessionInner::authenticate_libssh has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 3 (10 pts), if/else 4 (7 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
SessionInner::new_pty (cognitive 19) crates/wezterm-ssh/src/pty.rs:208— SessionInner::new_pty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionInner::run_impl_libssh (cognitive 18) crates/wezterm-ssh/src/sessioninner.rs:110— SessionInner::run_impl_libssh has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 4). Of this number, 16 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, 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.
TabInner::remove_pane_if (cognitive 41) mux/src/tab.rs:2077— TabInner::remove_pane_if has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 2 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TabInner::iter_panes_impl (cognitive 32) mux/src/tab.rs:1362— TabInner::iter_panes_impl has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TabInner::get_pane_direction (cognitive 31) mux/src/tab.rs:1940— TabInner::get_pane_direction has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 3 (6 pts), boolean chains 4, 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.
TabInner::split_and_insert (cognitive 31) mux/src/tab.rs:2446— TabInner::split_and_insert has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 5 (8 pts), boolean chains 2 (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.
TabInner::iter_splits (cognitive 30) mux/src/tab.rs:1440— TabInner::iter_splits has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 2 (6 pts), 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.
TabInner::toggle_pane_split_direction (cognitive 22) mux/src/tab.rs:1265— TabInner::toggle_pane_split_direction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 4 (6 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.
TabInner::adjust_pane_size (cognitive 21) mux/src/tab.rs:1860— TabInner::adjust_pane_size has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 4 (6 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×7
Edited copy of a member (16 corresponding lines) crates/wezterm-ssh/src/channelwrap.rs:96— crates/wezterm-ssh/src/channelwrap.rs:96-117 | crates/wezterm-ssh/src/channelwrap.rs:164-179 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) kaku-gui/src/ai_chat_engine/suggestion.rs:27— kaku-gui/src/ai_chat_engine/suggestion.rs:27-42 | kaku-gui/src/ai_chat_engine/title.rs:17-32 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/wezterm-open-url/src/lib.rs:5— crates/wezterm-open-url/src/lib.rs:5-22 | crates/wezterm-open-url/src/lib.rs:24-39 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) config/src/lua.rs:38— config/src/lua.rs:38-58 | config/src/lua.rs:63-78 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/filedescriptor/src/unix.rs:108— crates/filedescriptor/src/unix.rs:108-123 | crates/filedescriptor/src/unix.rs:125-141 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) kaku/src/kaku_theme.rs:405— kaku/src/kaku_theme.rs:405-429 | kaku/src/tui_core/theme.rs:58-73 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) kaku-gui/src/termwindow/tab_rename.rs:353— kaku-gui/src/termwindow/tab_rename.rs:353-368 | kaku-gui/src/termwindow/tab_rename.rs:370-386 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×7
Edited copy of a member (13 corresponding lines) kaku-gui/src/overlay/copy.rs:623— kaku-gui/src/overlay/copy.rs:623-638 | kaku-gui/src/overlay/copy.rs:642-654 — 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) kaku-gui/src/termwindow/mod.rs:6040— kaku-gui/src/termwindow/mod.rs:6040-6052 | kaku/src/utils.rs:108-120 — 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) window/src/os/macos/window.rs:2434— window/src/os/macos/window.rs:2434-2446 | window/src/os/macos/window.rs:2450-2462 — 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) kaku-gui/src/overlay/copy.rs:886— kaku-gui/src/overlay/copy.rs:886-898 | kaku-gui/src/overlay/copy.rs:900-914 — 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) crates/procinfo/src/macos.rs:236— crates/procinfo/src/macos.rs:236-248 | kaku-gui/src/main.rs:968-982 — 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) crates/bintree/src/lib.rs:403— crates/bintree/src/lib.rs:403-415 | crates/bintree/src/lib.rs:423-435 — 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) kaku-gui/src/ai_chat_engine/approval.rs:238— kaku-gui/src/ai_chat_engine/approval.rs:238-251 | kaku-gui/src/ai_tools/search.rs:242-254 — 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.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×6
Focus outline removed in CSS without a :focus replacement crates/kaku-remote/assets/web/index.html:58— `.mobile-row input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement crates/kaku-remote/assets/web/index.html:108— `#bar .tab input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement crates/kaku-remote/assets/web/index.html:168— `#find input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement crates/kaku-remote/assets/web/index.html:219— `#dialog` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement crates/kaku-remote/assets/web/index.html:233— `#dialog button:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement crates/kaku-remote/assets/web/xterm.css:48— `.xterm.focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Performer::osc_dispatch (cyclomatic 89) term/src/terminalstate/performer.rs:856— Performer::osc_dispatch has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Performer::remap_grapheme (cyclomatic 41) term/src/terminalstate/performer.rs:165— Performer::remap_grapheme has cyclomatic complexity 41 (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.
Performer::csi_dispatch (cyclomatic 31) term/src/terminalstate/performer.rs:599— Performer::csi_dispatch has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Performer::control (cyclomatic 28) term/src/terminalstate/performer.rs:483— Performer::control 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.
Performer::flush_print (cyclomatic 16) term/src/terminalstate/performer.rs:215— Performer::flush_print has cyclomatic complexity 16 (threshold 15). 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, separate the cases: extract each independent 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: Performer::esc_dispatch (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 function is counted neither in this dimension's figures nor in its score.
Performer::perform (cyclomatic 16) term/src/terminalstate/performer.rs:353— Performer::perform has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Performer::esc_dispatch (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 function is counted neither in this dimension's figures nor in its score.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×6
Edited copy of a member (14 corresponding lines) kaku-gui/src/update.rs:273— kaku-gui/src/update.rs:273-286 | kaku/src/update.rs:940-953 — 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) kaku-gui/src/overlay/copy.rs:855— kaku-gui/src/overlay/copy.rs:855-868 | kaku-gui/src/overlay/copy.rs:870-884 — 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) config/src/lua.rs:930— config/src/lua.rs:930-943 | config/src/lua.rs:951-964 — 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) kaku/src/ai_config/tui/providers/mod.rs:286— kaku/src/ai_config/tui/providers/mod.rs:286-299 | kaku/src/ai_config/tui/providers/mod.rs:345-361 — 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) crates/kaku-remote/src/lib.rs:569— crates/kaku-remote/src/lib.rs:569-582 | crates/kaku-remote/src/lib.rs:584-597 — 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) crates/kaku-remote/src/web.rs:2428— crates/kaku-remote/src/web.rs:2428-2441 | crates/kaku-remote/src/web.rs:2445-2458 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (16 lines × 2) crates/bidi/src/lib.rs:1162— crates/bidi/src/lib.rs:1162-1177 | crates/bidi/src/lib.rs:1186-1201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/bidi/src/lib.rs:1162` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/color-types/src/lib.rs:673— crates/color-types/src/lib.rs:673-688 | crates/color-types/src/lib.rs:693-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) kaku-gui/src/termwindow/mod.rs:6101— kaku-gui/src/termwindow/mod.rs:6101-6116 | kaku/src/utils.rs:171-186 — 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 (16 lines × 2) mux/src/termwiztermtab.rs:495— mux/src/termwiztermtab.rs:495-510 | mux/src/termwiztermtab.rs:544-559 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) term/src/terminalstate/mod.rs:64— term/src/terminalstate/mod.rs:64-79 | term/src/terminalstate/performer.rs:55-70 — before extracting anything, compare `term/src/terminalstate/mod.rs` and `term/src/terminalstate/performer.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) crates/wezterm-ssh/src/host.rs:46— crates/wezterm-ssh/src/host.rs:46-61 | crates/wezterm-ssh/src/host.rs:160-175 — both copies are in the same file, so extract the 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 `crates/wezterm-ssh/src/host.rs:46` 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) crates/wezterm-dynamic/derive/src/attr.rs:220— crates/wezterm-dynamic/derive/src/attr.rs:220-233 | crates/wezterm-dynamic/derive/src/attr.rs:240-253 — both copies are in the same file, so extract the 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 `crates/wezterm-dynamic/derive/src/attr.rs:220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/wezterm-escape-parser/src/csi.rs:1887— crates/wezterm-escape-parser/src/csi.rs:1887-1900 | crates/wezterm-escape-parser/src/csi.rs:1916-1929 — both copies are in the same file, so extract the 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 `crates/wezterm-escape-parser/src/csi.rs:1887` 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) mux/src/tab.rs:1319— mux/src/tab.rs:1319-1332 | mux/src/tab.rs:1341-1354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `mux/src/tab.rs:1319` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) kaku/src/ai_config/tui/ui.rs:370— kaku/src/ai_config/tui/ui.rs:370-383 | kaku/src/config_tui/ui.rs:448-461 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:370` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) termwiz/src/render/terminfo.rs:656— termwiz/src/render/terminfo.rs:656-669 | termwiz/src/render/terminfo.rs:686-699 — both copies are in the same file, so extract the 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 `termwiz/src/render/terminfo.rs:656` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) kaku-gui/src/termwindow/mod.rs:5281— kaku-gui/src/termwindow/mod.rs:5281-5294 | kaku-gui/src/termwindow/mod.rs:5331-5344 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/mod.rs:5281` 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.
CommandDef::recreate_menubar::command_rank_for_menu (cyclomatic 58) kaku-gui/src/commands.rs:722— CommandDef::recreate_menubar::command_rank_for_menu has cyclomatic complexity 58 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: 2 other methods here (CommandDef::recreate_menubar, CommandDef::recreate_menubar::separator_group_for_menu) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CommandDef::actions_for_palette_only (cyclomatic 34) kaku-gui/src/commands.rs:208— CommandDef::actions_for_palette_only has cyclomatic complexity 34 (threshold 15). Of this number, 18 points are the body's own statements and 16 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CommandDef::recreate_menubar (cyclomatic 24) kaku-gui/src/commands.rs:666— CommandDef::recreate_menubar has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: 2 other methods here (CommandDef::recreate_menubar::command_rank_for_menu, CommandDef::recreate_menubar::separator_group_for_menu) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CommandDef::actions_for_palette_and_menubar (cyclomatic 23) kaku-gui/src/commands.rs:483— CommandDef::actions_for_palette_and_menubar 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.
CommandDef::recreate_menubar::separator_group_for_menu (cyclomatic 20) kaku-gui/src/commands.rs:803— CommandDef::recreate_menubar::separator_group_for_menu has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: 2 other methods here (CommandDef::recreate_menubar, CommandDef::recreate_menubar::command_rank_for_menu) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mux::parse_buffered_data (cyclomatic 25) mux/src/lib.rs:336— mux::parse_buffered_data 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.
mux::read_from_pane_pty (cyclomatic 22) mux/src/lib.rs:613— mux::read_from_pane_pty 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.
mux::ssh::connect_ssh_session (cyclomatic 22) mux/src/ssh.rs:430— mux::ssh::connect_ssh_session 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.
mux::pane_encoding::advance_escape (cyclomatic 17) mux/src/pane_encoding.rs:34— mux::pane_encoding::advance_escape 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.
mux::ssh::ssh_connect_with_ui (cyclomatic 16) mux/src/ssh.rs:62— mux::ssh::ssh_connect_with_ui 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.
Performer::osc_dispatch (cognitive 127) term/src/terminalstate/performer.rs:856— Performer::osc_dispatch has cognitive complexity 127 (threshold 15). Drivers by points: if/else 36 (84 pts), match/switch 13 (29 pts), loops 5 (14 pts) (nesting depth added 73). 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.
Performer::flush_print (cognitive 32) term/src/terminalstate/performer.rs:215— Performer::flush_print has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 14). Of this number, 28 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.
Performer::control (cognitive 29) term/src/terminalstate/performer.rs:483— Performer::control has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 3, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Performer::csi_dispatch (cognitive 25) term/src/terminalstate/performer.rs:599— Performer::csi_dispatch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 6 (10 pts), loops 2 (4 pts) (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.
Performer::device_control (cognitive 18) term/src/terminalstate/performer.rs:390— Performer::device_control has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), match/switch 4 (8 pts) (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.
WindowView::key_common (cognitive 116) window/src/os/macos/window.rs:8752— WindowView::key_common has cognitive complexity 116 (threshold 15). Drivers by points: if/else 54 (78 pts), match/switch 8 (22 pts), boolean chains 16 (nesting depth added 38). Of this number, 111 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowView::did_resize (cognitive 112) window/src/os/macos/window.rs:9463— WindowView::did_resize has cognitive complexity 112 (threshold 15). Drivers by points: if/else 40 (90 pts), boolean chains 11, match/switch 4 (9 pts), loops 1 (2 pts) (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WindowView::scroll_wheel (cognitive 33) window/src/os/macos/window.rs:8609— WindowView::scroll_wheel has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowView::did_exit_fullscreen (cognitive 27) window/src/os/macos/window.rs:9380— WindowView::did_exit_fullscreen has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (27 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WindowView::window_will_close (cognitive 16) window/src/os/macos/window.rs:8388— WindowView::window_will_close has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_client::domain::mux_notify_client_domain (cognitive 36) crates/wezterm-client/src/domain.rs:269— wezterm_client::domain::mux_notify_client_domain has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 5 (6 pts) (nesting depth added 20). 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.
wezterm_client::discovery::discover_gui_socks (cognitive 35) crates/wezterm-client/src/discovery.rs:78— wezterm_client::discovery::discover_gui_socks has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 21). Of this number, 30 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wezterm_client::client::unix_connect_with_retry (cognitive 19) crates/wezterm-client/src/client.rs:435— wezterm_client::client::unix_connect_with_retry has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (6 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
wezterm_client::pane::renderable::hydrate_lines (cognitive 19) crates/wezterm-client/src/pane/renderable.rs:641— wezterm_client::pane::renderable::hydrate_lines has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_client::client::client_thread_async (cognitive 18) crates/wezterm-client/src/client.rs:346— wezterm_client::client::client_thread_async has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (5 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Screen::scroll_up (cognitive 36) term/src/screen.rs:710— Screen::scroll_up has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (23 pts), loops 6 (9 pts), boolean chains 4 (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.
Screen::rewrap_lines (cognitive 32) term/src/screen.rs:109— Screen::rewrap_lines has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (5 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Screen::resize (cognitive 28) term/src/screen.rs:202— Screen::resize has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Screen::for_each_logical_line_in_stable_range_mut (cognitive 28) term/src/screen.rs:1067— Screen::for_each_logical_line_in_stable_range_mut has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Screen::for_each_logical_line_in_stable_range) 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.
Screen::for_each_logical_line_in_stable_range (cognitive 28) term/src/screen.rs:1146— Screen::for_each_logical_line_in_stable_range has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Screen::for_each_logical_line_in_stable_range_mut) 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.
CopyRenderable::move_to_end_of_word (cognitive 34) kaku-gui/src/overlay/copy.rs:1003— CopyRenderable::move_to_end_of_word has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 2 (8 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CopyRenderable::move_by_zone (cognitive 24) kaku-gui/src/overlay/copy.rs:1047— CopyRenderable::move_by_zone has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 4 (9 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.
CopyRenderable::move_forward_one_word (cognitive 20) kaku-gui/src/overlay/copy.rs:971— CopyRenderable::move_forward_one_word has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (20 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.
CopyRenderable::move_backward_one_word (cognitive 18) kaku-gui/src/overlay/copy.rs:916— CopyRenderable::move_backward_one_word has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CopyRenderable::perform_jump (cognitive 17) kaku-gui/src/overlay/copy.rs:1099— CopyRenderable::perform_jump has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×5
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×5
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×5
Edited copy of a member (19 corresponding lines) term/src/screen.rs:998— term/src/screen.rs:998-1017 | term/src/screen.rs:1022-1040 — 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) kaku-gui/src/termwindow/charselect.rs:109— kaku-gui/src/termwindow/charselect.rs:109-129 | kaku-gui/src/termwindow/palette.rs:108-126 — 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) kaku-gui/src/termwindow/mouseevent.rs:1810— kaku-gui/src/termwindow/mouseevent.rs:1810-1828 | kaku-gui/src/termwindow/mouseevent.rs:1836-1858 — 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) mux/src/connui.rs:372— mux/src/connui.rs:372-390 | mux/src/connui.rs:392-410 — 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) crates/tabout/src/lib.rs:30— crates/tabout/src/lib.rs:30-54 | crates/tabout/src/lib.rs:145-163 — 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 (4 corresponding lines) · ×5
Edited copy of a member (4 corresponding lines) kaku/src/doctor.rs:1169— kaku/src/doctor.rs:1169-1172 | kaku/src/reset.rs:444-447 — 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) crates/wezterm-cell/src/image.rs:27— crates/wezterm-cell/src/image.rs:27-30 | crates/wezterm-surface/src/hyperlink.rs:99-102 — 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) kaku-gui/src/ai_client/transport.rs:138— kaku-gui/src/ai_client/transport.rs:138-141 | kaku-gui/src/ai_tools/web.rs:15-18 — 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) crates/kaku-remote/src/lib.rs:400— crates/kaku-remote/src/lib.rs:400-403 | crates/kaku-remote/src/share.rs:140-143 — 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) crates/wezterm-dynamic/src/array.rs:42— crates/wezterm-dynamic/src/array.rs:42-45 | crates/wezterm-dynamic/src/object.rs:133-136 — 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 (7–9 lines × 2) crates/bidi/src/lib.rs:568— crates/bidi/src/lib.rs:568-576 | crates/bidi/src/lib.rs:776-782 — both copies are in the same file, so extract the 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 `crates/bidi/src/lib.rs:568` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–9 lines × 2) crates/kaku-remote/src/lib.rs:233— crates/kaku-remote/src/lib.rs:233-239 | kaku-gui/src/inline_ai_control.rs:55-63 — 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. 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–9 lines × 2) crates/luahelper/src/lib.rs:139— crates/luahelper/src/lib.rs:139-147 | crates/luahelper/src/lib.rs:157-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/luahelper/src/lib.rs:139` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–9 lines × 2) kaku-gui/src/customglyph.rs:5094— kaku-gui/src/customglyph.rs:5094-5100 | kaku-gui/src/customglyph.rs:5199-5207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–9 lines × 2) lua-api-crates/share-data/src/lib.rs:129— lua-api-crates/share-data/src/lib.rs:129-137 | lua-api-crates/share-data/src/lib.rs:147-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lua-api-crates/share-data/src/lib.rs:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 3) crates/luahelper/src/lib.rs:208— crates/luahelper/src/lib.rs:208-215 | lua-api-crates/serde-funcs/src/lib.rs:244-251 | lua-api-crates/share-data/src/lib.rs:198-205 — before extracting anything, compare `crates/luahelper/src/lib.rs` and `lua-api-crates/share-data/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `crates/luahelper/src/lib.rs:208` 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, `crates/luahelper/src/lib.rs:216` calls `ValuePrinter` and `lua-api-crates/share-data/src/lib.rs:206` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) kaku-gui/src/customglyph.rs:1556— kaku-gui/src/customglyph.rs:1556-1563 | kaku-gui/src/customglyph.rs:1698-1705 | kaku-gui/src/customglyph.rs:1840-1847 — 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 `kaku-gui/src/customglyph.rs:1556` 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) kaku/src/cli/activate_tab.rs:54— kaku/src/cli/activate_tab.rs:54-61 | kaku/src/cli/set_tab_title.rs:28-35 | kaku/src/cli/zoom_pane.rs:37-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `kaku/src/cli/activate_tab.rs:54` 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, `kaku/src/cli/zoom_pane.rs:46` calls `insert` and `kaku/src/cli/set_tab_title.rs:36` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) kaku-gui/src/overlay/ai_chat/types.rs:29— kaku-gui/src/overlay/ai_chat/types.rs:29-36 | kaku/src/kaku_theme.rs:48-55 | kaku/src/tui_core/theme.rs:27-34 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. 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 (8 lines × 3) kaku/src/ai_config/tui/providers/mod.rs:1400— kaku/src/ai_config/tui/providers/mod.rs:1400-1407 | kaku/src/ai_config/tui/providers/mod.rs:1807-1814 | kaku/src/ai_config/tui/providers/mod.rs:2069-2076 — 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.
Low cohesion: Element (LCOM4 13) kaku-gui/src/termwindow/box_model.rs:223— Element's methods fall into 13 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 13 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Config (LCOM4 9) config/src/config.rs:52— Config's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Connection (LCOM4 9) window/src/os/macos/connection.rs:39— Connection's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Window (LCOM4 5) window/src/os/macos/window.rs:757— Window's methods fall into 5 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 5 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: KakuAssistantConfig (LCOM4 4) kaku/src/ai_config/tui.rs:653— KakuAssistantConfig'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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×4
Animation without a prefers-reduced-motion guard crates/kaku-remote/assets/web/index.html:46— `body.phone #mobile-tabs` moves (`transition: transform 0.2s ease-out, visibility 0s 0.2s`) 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 crates/kaku-remote/assets/web/index.html:47— `body.phone #mobile-tabs.show` moves (`transition: transform 0.2s ease-out`) 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 crates/kaku-remote/assets/web/index.html:94— `#bar .dot.in` moves (`animation: dot-in 0.25s ease-out`) 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 crates/kaku-remote/assets/web/index.html:95— `#bar .dot.out` moves (`animation: dot-out 0.3s ease-in forwards`) 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.
GlyphCache::block_sprite (cyclomatic 73) kaku-gui/src/customglyph.rs:5175— GlyphCache::block_sprite 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. This is NOT this file's highest cyclomatic complexity: BlockKey::from_char (cyclomatic 371) 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 function is counted neither in this dimension's figures nor in its score.
GlyphCache::load_glyph (cyclomatic 26) kaku-gui/src/glyphcache.rs:702— GlyphCache::load_glyph 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.
GlyphCache::line_sprite (cyclomatic 24) kaku-gui/src/glyphcache.rs:1184— GlyphCache::line_sprite 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.
GlyphCache::cached_image_impl (cyclomatic 17) kaku-gui/src/glyphcache.rs:931— GlyphCache::cached_image_impl 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.
GlyphCache::block_sprite (cognitive 97) kaku-gui/src/customglyph.rs:5175— GlyphCache::block_sprite has cognitive complexity 97 (threshold 15). Drivers by points: if/else 47 (76 pts), loops 6 (14 pts), match/switch 4 (7 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlyphCache::load_glyph (cognitive 40) kaku-gui/src/glyphcache.rs:702— GlyphCache::load_glyph has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (29 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GlyphCache::cached_image_impl (cognitive 36) kaku-gui/src/glyphcache.rs:931— GlyphCache::cached_image_impl has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (31 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 20). 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.
GlyphCache::line_sprite (cognitive 36) kaku-gui/src/glyphcache.rs:1184— GlyphCache::line_sprite has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 10 (13 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Face::compute_cap_height (cognitive 75) crates/wezterm-font/src/ftwrap.rs:973— Face::compute_cap_height has cognitive complexity 75 (threshold 15). Drivers by points: if/else 11 (48 pts), loops 9 (24 pts), match/switch 2, 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.
Face::compute_coverage (cognitive 23) crates/wezterm-font/src/ftwrap.rs:386— Face::compute_coverage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), 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.
Face::cell_metrics (cognitive 20) crates/wezterm-font/src/ftwrap.rs:1107— Face::cell_metrics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Face::set_font_size (cognitive 19) crates/wezterm-font/src/ftwrap.rs:451— Face::set_font_size has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TmuxDomainState::advance (cognitive 55) mux/src/tmux.rs:87— TmuxDomainState::advance has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (45 pts), match/switch 2 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TmuxDomainState::sync_window_state (cognitive 50) mux/src/tmux_commands.rs:373— TmuxDomainState::sync_window_state has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 6 (17 pts), loops 4 (9 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TmuxDomainState::sync_pane_state (cognitive 43) mux/src/tmux_commands.rs:304— TmuxDomainState::sync_pane_state has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (35 pts), match/switch 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TmuxDomainState::subscribe_notification (cognitive 19) mux/src/tmux_commands.rs:569— TmuxDomainState::subscribe_notification has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 5 (8 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.
TooManyFields: Config config/src/config.rs:52— TooManyFields — 252 stored fields beside 32 methods. The bar is 30 stored fields; this is 222 over it, 8.40× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: TermWindow kaku-gui/src/termwindow/mod.rs:1058— TooManyFields — 88 stored fields beside 309 methods. The bar is 30 stored fields; this is 58 over it, 2.93× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: TerminalState term/src/terminalstate/mod.rs:302— TooManyFields — 74 stored fields beside 116 methods. The bar is 30 stored fields; this is 44 over it, 2.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: App kaku-gui/src/overlay/ai_chat/state.rs:704— TooManyFields — 47 stored fields beside 62 methods. The bar is 30 stored fields; this is 17 over it, 1.57× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×4
Edited copy of a member (30 corresponding lines) kaku-gui/src/session_restore.rs:342— kaku-gui/src/session_restore.rs:342-373 | kaku-gui/src/session_restore.rs:885-914 — 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) kaku/src/ai_config/tui.rs:1049— kaku/src/ai_config/tui.rs:1049-1078 | kaku/src/ai_config/tui.rs:1080-1111 — 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) mux/src/tab.rs:1201— mux/src/tab.rs:1201-1230 | mux/src/tab.rs:1232-1262 — 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) kaku/src/doctor.rs:1407— kaku/src/doctor.rs:1407-1436 | kaku/src/init.rs:320-355 — 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 (33 corresponding lines) · ×4
Edited copy of a member (33 corresponding lines) crates/wezterm-escape-parser/src/csi.rs:2109— crates/wezterm-escape-parser/src/csi.rs:2109-2141 | crates/wezterm-escape-parser/src/csi.rs:2185-2221 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/wezterm-font/src/ftwrap.rs:1514— crates/wezterm-font/src/ftwrap.rs:1514-1548 | crates/wezterm-font/src/rasterizer/harfbuzz.rs:376-408 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) kaku-gui/src/update.rs:376— kaku-gui/src/update.rs:376-414 | kaku/src/update.rs:610-642 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/wezterm-font/src/rasterizer/freetype.rs:132— crates/wezterm-font/src/rasterizer/freetype.rs:132-169 | crates/wezterm-font/src/rasterizer/freetype.rs:177-209 — 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 (22 corresponding lines) · ×4
Edited copy of a member (22 corresponding lines) mux/src/tab.rs:361— mux/src/tab.rs:361-382 | mux/src/tab.rs:392-413 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) kaku-gui/src/overlay/ai_chat/state.rs:414— kaku-gui/src/overlay/ai_chat/state.rs:414-436 | kaku-gui/src/overlay/ai_chat/state.rs:438-459 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) kaku-gui/src/termwindow/mod.rs:4170— kaku-gui/src/termwindow/mod.rs:4170-4197 | kaku-gui/src/termwindow/mod.rs:4822-4843 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) config/src/font.rs:333— config/src/font.rs:333-354 | config/src/keyassignment.rs:90-111 — 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 copy of a member (17 corresponding lines) · ×4
Edited copy of a member (17 corresponding lines) term/src/terminalstate/mod.rs:1630— term/src/terminalstate/mod.rs:1630-1646 | term/src/terminalstate/mod.rs:1648-1681 — 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) config/src/config.rs:4122— config/src/config.rs:4122-4139 | config/src/config.rs:4259-4275 — 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) kaku/src/ai_config/tui.rs:599— kaku/src/ai_config/tui.rs:599-616 | kaku/src/ai_config/tui.rs:629-645 — 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) kaku/src/update.rs:569— kaku/src/update.rs:569-585 | kaku/src/update.rs:592-608 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×4
Edited copy of a member (26 corresponding lines) crates/wezterm-cell/src/lib.rs:230— crates/wezterm-cell/src/lib.rs:230-255 | crates/wezterm-cell/src/lib.rs:266-291 — 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) crates/bidi/src/lib.rs:565— crates/bidi/src/lib.rs:565-594 | crates/bidi/src/lib.rs:773-798 — 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) kaku-gui/src/termwindow/box_model.rs:978— kaku-gui/src/termwindow/box_model.rs:978-1003 | kaku-gui/src/termwindow/box_model.rs:1009-1034 — 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) kaku-gui/src/termwindow/mod.rs:2935— kaku-gui/src/termwindow/mod.rs:2935-2966 | kaku-gui/src/termwindow/mod.rs:6702-6727 — 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 (21 corresponding lines) · ×4
Edited copy of a member (21 corresponding lines) crates/vtparse/src/transitions.rs:27— crates/vtparse/src/transitions.rs:27-47 | crates/vtparse/src/transitions.rs:68-91 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) kaku/src/ai_config/tui.rs:3310— kaku/src/ai_config/tui.rs:3310-3332 | kaku/src/config_tui/mod.rs:208-228 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/bidi/src/lib.rs:1091— crates/bidi/src/lib.rs:1091-1117 | crates/bidi/src/lib.rs:1157-1177 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) kaku-gui/src/tabbar.rs:194— kaku-gui/src/tabbar.rs:194-214 | kaku-gui/src/tabbar.rs:252-272 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×4
Edited copy of a member (7 corresponding lines) kaku-gui/src/termwindow/charselect.rs:101— kaku-gui/src/termwindow/charselect.rs:101-107 | kaku-gui/src/termwindow/palette.rs:95-106 — 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) kaku-gui/src/termwindow/mod.rs:6078— kaku-gui/src/termwindow/mod.rs:6078-6084 | kaku-gui/src/termwindow/mod.rs:6092-6098 — 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) kaku-gui/src/termwindow/mod.rs:6054— kaku-gui/src/termwindow/mod.rs:6054-6060 | kaku/src/utils.rs:122-128 — 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) crates/kaku-remote/src/pairing.rs:305— crates/kaku-remote/src/pairing.rs:305-311 | crates/kaku-remote/src/share.rs:160-166 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (17 lines × 2) kaku-gui/src/ai_client/mod.rs:272— kaku-gui/src/ai_client/mod.rs:272-288 | kaku-gui/src/ai_client/mod.rs:793-809 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_client/mod.rs:272` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) kaku-gui/src/customglyph.rs:5403— kaku-gui/src/customglyph.rs:5403-5419 | kaku-gui/src/customglyph.rs:5421-5437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (17 lines × 2) term/src/terminalstate/mod.rs:2645— term/src/terminalstate/mod.rs:2645-2661 | term/src/terminalstate/mod.rs:2741-2757 — both copies are in the same file, so extract the block into 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) kaku-gui/src/ai_tools/registry.rs:191— kaku-gui/src/ai_tools/registry.rs:191-207 | kaku-gui/src/ai_tools/registry.rs:254-270 — both copies are in the same file, so extract the 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 `kaku-gui/src/ai_tools/registry.rs:191` 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 × 3) config/derive/src/attr.rs:21— config/derive/src/attr.rs:21-31 | crates/wezterm-dynamic/derive/src/attr.rs:17-27 | crates/wezterm-dynamic/derive/src/attr.rs:292-302 — before extracting anything, compare `config/derive/src/attr.rs` and `crates/wezterm-dynamic/derive/src/attr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `config/derive/src/attr.rs:21` 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 × 3) crates/wezterm-escape-parser/src/csi.rs:2447— crates/wezterm-escape-parser/src/csi.rs:2447-2457 | crates/wezterm-escape-parser/src/csi.rs:2466-2476 | crates/wezterm-escape-parser/src/csi.rs:2484-2494 — 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 `crates/wezterm-escape-parser/src/csi.rs:2447` 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, `crates/wezterm-escape-parser/src/csi.rs:2446` calls `Integer` and `crates/wezterm-escape-parser/src/csi.rs:2465` 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 (11 lines × 3) kaku-gui/src/termwindow/tab_rename.rs:876— kaku-gui/src/termwindow/tab_rename.rs:876-886 | kaku-gui/src/termwindow/tab_rename.rs:907-917 | kaku-gui/src/termwindow/tab_rename.rs:934-944 — 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 `kaku-gui/src/termwindow/tab_rename.rs:934` 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 × 3) kaku/src/ai_config/tui/providers/mod.rs:471— kaku/src/ai_config/tui/providers/mod.rs:471-481 | kaku/src/ai_config/tui/providers/mod.rs:1545-1556 | kaku/src/ai_config/tui/providers/mod.rs:1598-1608 — 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 `kaku/src/ai_config/tui/providers/mod.rs:471` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 2) kaku-gui/src/commands.rs:1717— kaku-gui/src/commands.rs:1717-1725 | kaku-gui/src/commands.rs:1753-1760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/commands.rs:1717` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) kaku-gui/src/glyphcache.rs:1185— kaku-gui/src/glyphcache.rs:1185-1192 | kaku-gui/src/utilsprites.rs:187-195 — 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) kaku/src/ai_config/tui/ui.rs:510— kaku/src/ai_config/tui/ui.rs:510-517 | kaku/src/config_tui/ui.rs:415-423 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:510` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) config/src/color.rs:301— config/src/color.rs:301-309 | config/src/color.rs:353-360 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `config/src/color.rs:301` 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 (6 lines × 3) kaku-gui/src/customglyph.rs:1411— kaku-gui/src/customglyph.rs:1411-1416 | kaku-gui/src/customglyph.rs:1553-1558 | kaku-gui/src/customglyph.rs:1695-1700 — 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 `kaku-gui/src/customglyph.rs:1411` 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 (6 lines × 3) kaku-gui/src/overlay/ai_chat/render.rs:842— kaku-gui/src/overlay/ai_chat/render.rs:842-847 | kaku-gui/src/overlay/ai_chat/render.rs:851-856 | kaku-gui/src/overlay/ai_chat/render.rs:866-871 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) lua-api-crates/mux/src/pane.rs:219— lua-api-crates/mux/src/pane.rs:219-224 | lua-api-crates/mux/src/pane.rs:241-246 | lua-api-crates/mux/src/pane.rs:255-260 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/wezterm-client/src/pane/clientpane.rs:360— crates/wezterm-client/src/pane/clientpane.rs:360-365 | kaku-gui/src/overlay/copy.rs:1216-1221 | mux/src/termwiztermtab.rs:235-240 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
WindowView::key_common (cyclomatic 67) window/src/os/macos/window.rs:8752— WindowView::key_common has cyclomatic complexity 67 (threshold 15). Of this number, 65 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.
WindowView::did_resize (cyclomatic 51) window/src/os/macos/window.rs:9463— WindowView::did_resize 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.
WindowView::scroll_wheel (cyclomatic 21) window/src/os/macos/window.rs:8609— WindowView::scroll_wheel 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.
LauncherState::run_loop (cyclomatic 34) kaku-gui/src/overlay/launcher.rs:624— LauncherState::run_loop 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.
LauncherState::build_entries (cyclomatic 24) kaku-gui/src/overlay/launcher.rs:218— LauncherState::build_entries 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.
LauncherState::render (cyclomatic 20) kaku-gui/src/overlay/launcher.rs:406— LauncherState::render has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionInner::dispatch_one_request (cyclomatic 32) crates/wezterm-ssh/src/sessioninner.rs:623— SessionInner::dispatch_one_request has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SessionInner::request_loop (cyclomatic 20) crates/wezterm-ssh/src/sessioninner.rs:426— SessionInner::request_loop 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.
SessionInner::authenticate (cyclomatic 16) crates/wezterm-ssh/src/auth.rs:255— SessionInner::authenticate 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.
kaku_relay::device (cyclomatic 30) crates/kaku-relay/src/main.rs:527— kaku_relay::device has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
kaku_relay::serve_browser (cyclomatic 29) crates/kaku-relay/src/main.rs:1112— kaku_relay::serve_browser 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.
kaku_relay::serve_host (cyclomatic 26) crates/kaku-relay/src/main.rs:760— kaku_relay::serve_host 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.
GuiFrontEnd::try_new (cyclomatic 28) kaku-gui/src/frontend.rs:661— GuiFrontEnd::try_new has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GuiFrontEnd::app_event_handler (cyclomatic 23) kaku-gui/src/frontend.rs:1130— GuiFrontEnd::app_event_handler has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GuiFrontEnd::reconcile_workspace (cyclomatic 16) kaku-gui/src/frontend.rs:1273— GuiFrontEnd::reconcile_workspace 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.
ParsedFont::lua_fallback (cyclomatic 24) crates/wezterm-font/src/parser.rs:292— ParsedFont::lua_fallback 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.
ParsedFont::best_matching_index (cyclomatic 18) crates/wezterm-font/src/parser.rs:612— ParsedFont::best_matching_index 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.
ParsedFont::from_face (cyclomatic 17) crates/wezterm-font/src/parser.rs:385— ParsedFont::from_face 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.
TabInner::get_pane_direction (cyclomatic 20) mux/src/tab.rs:1940— TabInner::get_pane_direction 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.
TabInner::remove_pane_if (cyclomatic 17) mux/src/tab.rs:2077— TabInner::remove_pane_if 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.
TabInner::split_and_insert (cyclomatic 17) mux/src/tab.rs:2446— TabInner::split_and_insert 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.
CommandDef::recreate_menubar (cognitive 103) kaku-gui/src/commands.rs:666— CommandDef::recreate_menubar has cognitive complexity 103 (threshold 15). Drivers by points: if/else 17 (61 pts), match/switch 15 (29 pts), loops 6 (13 pts) (nesting depth added 65). Of this number, 75 points are the body's own statements and 28 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.
CommandDef::actions_for_palette_and_menubar (cognitive 57) kaku-gui/src/commands.rs:483— CommandDef::actions_for_palette_and_menubar has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 7 (11 pts), match/switch 2 (5 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CommandDef::actions_for_palette_only (cognitive 43) kaku-gui/src/commands.rs:208— CommandDef::actions_for_palette_only has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 6 (8 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 15). Of this number, 31 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConfigInner::watch_path (cognitive 65) config/src/lib.rs:1864— ConfigInner::watch_path has cognitive complexity 65 (threshold 15). Drivers by points: if/else 14 (38 pts), match/switch 6 (18 pts), loops 2 (9 pts) (nesting depth added 43). Of this number, 58 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConfigInner::unwatch_stale_paths (cognitive 32) config/src/lib.rs:1998— ConfigInner::unwatch_stale_paths has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConfigInner::apply_loaded (cognitive 20) config/src/lib.rs:2052— ConfigInner::apply_loaded has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 1 (3 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.
kaku_relay::serve_host (cognitive 58) crates/kaku-relay/src/main.rs:760— kaku_relay::serve_host has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (47 pts), match/switch 4 (8 pts), loops 2, boolean chains 1 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
kaku_relay::serve_browser (cognitive 54) crates/kaku-relay/src/main.rs:1112— kaku_relay::serve_browser has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (32 pts), match/switch 6 (16 pts), boolean chains 4, loops 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
kaku_relay::device (cognitive 16) crates/kaku-relay/src/main.rs:527— kaku_relay::device has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, 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.
LauncherState::run_loop (cognitive 52) kaku-gui/src/overlay/launcher.rs:624— LauncherState::run_loop has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (44 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LauncherState::render (cognitive 47) kaku-gui/src/overlay/launcher.rs:406— LauncherState::render has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 2, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LauncherState::build_entries (cognitive 44) kaku-gui/src/overlay/launcher.rs:218— LauncherState::build_entries has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 7 (12 pts), match/switch 3 (10 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowInner::refresh_after_display_change (cognitive 52) window/src/os/macos/window.rs:2925— WindowInner::refresh_after_display_change has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (49 pts), boolean chains 3 (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.
WindowInner::update_window_shadow (cognitive 28) window/src/os/macos/window.rs:2716— WindowInner::update_window_shadow has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowInner::toggle_simple_fullscreen (cognitive 19) window/src/os/macos/window.rs:2598— WindowInner::toggle_simple_fullscreen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParsedFont::lua_fallback (cognitive 50) crates/wezterm-font/src/parser.rs:292— ParsedFont::lua_fallback has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (39 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParsedFont::from_face (cognitive 27) crates/wezterm-font/src/parser.rs:385— ParsedFont::from_face has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (4 pts), match/switch 4, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParsedFont::best_matching_index (cognitive 23) crates/wezterm-font/src/parser.rs:612— ParsedFont::best_matching_index has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (12 pts), match/switch 5 (9 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FontConfigInner::match_style (cognitive 43) crates/wezterm-font/src/lib.rs:1131— FontConfigInner::match_style has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FontConfigInner::resolve_font_helper_impl (cognitive 32) crates/wezterm-font/src/lib.rs:780— FontConfigInner::resolve_font_helper_impl has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 6 (12 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FontConfigInner::resolve_font (cognitive 27) crates/wezterm-font/src/lib.rs:931— FontConfigInner::resolve_font has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 3, match/switch 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.
CellCluster::make_cluster (cognitive 43) crates/wezterm-surface/src/cellcluster.rs:50— CellCluster::make_cluster has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 4, loops 2 (3 pts), 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.
CellCluster::resolve_bidi (cognitive 21) crates/wezterm-surface/src/cellcluster.rs:169— CellCluster::resolve_bidi has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 3 (9 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
CellCluster::add (cognitive 16) crates/wezterm-surface/src/cellcluster.rs:275— CellCluster::add has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 4 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
LocalPane::search (cognitive 36) mux/src/localpane.rs:775— LocalPane::search has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6 (13 pts), match/switch 5 (7 pts) (nesting depth added 15). Of this number, 31 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalPane::is_dead (cognitive 32) mux/src/localpane.rs:288— LocalPane::is_dead has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 6 (12 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalPane::can_close_without_prompting (cognitive 16) mux/src/localpane.rs:661— LocalPane::can_close_without_prompting has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 4 (6 pts) (nesting depth added 7). Of this number, 10 points are the body's own statements and 6 belong to one function item 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GuiFrontEnd::reconcile_workspace (cognitive 31) kaku-gui/src/frontend.rs:1273— GuiFrontEnd::reconcile_workspace has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GuiFrontEnd::try_new (cognitive 23) kaku-gui/src/frontend.rs:661— GuiFrontEnd::try_new has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), match/switch 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.
GuiFrontEnd::app_event_handler (cognitive 22) kaku-gui/src/frontend.rs:1130— GuiFrontEnd::app_event_handler has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (18 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
window::os::macos::app::application_open_untitled_file (cognitive 30) window/src/os/macos/app.rs:1278— window::os::macos::app::application_open_untitled_file has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 1 (4 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
window::os::macos::window::on_app_terminating (cognitive 26) window/src/os/macos/window.rs:1684— window::os::macos::window::on_app_terminating has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (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.
window::os::macos::app::flush_pending_service_opens (cognitive 16) window/src/os/macos/app.rs:1548— window::os::macos::app::flush_pending_service_opens has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 5 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Line::changes (cognitive 29) crates/wezterm-surface/src/line/line.rs:1187— Line::changes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Line::compute_zones (cognitive 17) crates/wezterm-surface/src/line/line.rs:426— Line::compute_zones has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Line::apply_hyperlink_rules (cognitive 17) crates/wezterm-surface/src/line/line.rs:571— Line::apply_hyperlink_rules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Reconnectable::tls_connect (cognitive 28) crates/wezterm-client/src/client.rs:791— Reconnectable::tls_connect has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 3 (9 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.
Reconnectable::unix_connect (cognitive 24) crates/wezterm-client/src/client.rs:712— Reconnectable::unix_connect has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Reconnectable::try_connect (cognitive 17) crates/wezterm-client/src/client.rs:924— Reconnectable::try_connect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandPalette::compute (cognitive 24) kaku-gui/src/termwindow/palette.rs:543— CommandPalette::compute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (23 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.
CommandPalette::mouse_event (cognitive 17) kaku-gui/src/termwindow/palette.rs:1008— CommandPalette::mouse_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandPalette::computed_element (cognitive 17) kaku-gui/src/termwindow/palette.rs:1138— CommandPalette::computed_element has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×3
Edited copy of a member (23 corresponding lines) crates/wezterm-font/src/rasterizer/colr.rs:96— crates/wezterm-font/src/rasterizer/colr.rs:96-124 | crates/wezterm-font/src/rasterizer/colr.rs:135-157 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/filedescriptor/src/unix.rs:305— crates/filedescriptor/src/unix.rs:305-327 | crates/filedescriptor/src/unix.rs:331-353 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) window/src/os/macos/window.rs:9933— window/src/os/macos/window.rs:9933-9955 | window/src/os/macos/window.rs:9957-9979 — 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 (20 corresponding lines) · ×3
Edited copy of a member (20 corresponding lines) kaku-gui/src/ai_tools/search.rs:503— kaku-gui/src/ai_tools/search.rs:503-526 | kaku-gui/src/ai_tools/search.rs:536-555 — 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) kaku/src/ai_config/tui/providers/mod.rs:301— kaku/src/ai_config/tui/providers/mod.rs:301-322 | kaku/src/ai_config/tui/providers/mod.rs:324-343 — 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) kaku-gui/src/update.rs:416— kaku-gui/src/update.rs:416-435 | kaku/src/update.rs:644-663 — 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 copies of one member (3 members, 16+ corresponding lines) · ×3
Edited copies of one member (3 members, 16+ corresponding lines) crates/wezterm-ssh/src/pty.rs:101— crates/wezterm-ssh/src/pty.rs:101-116 | crates/wezterm-ssh/src/pty.rs:120-136 | crates/wezterm-ssh/src/pty.rs:138-153 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) config/derive/src/configmeta.rs:6— config/derive/src/configmeta.rs:6-21 | crates/wezterm-dynamic/derive/src/fromdynamic.rs:8-24 | crates/wezterm-dynamic/derive/src/todynamic.rs:8-24 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) config/src/font.rs:398— config/src/font.rs:398-413 | config/src/font.rs:415-430 | config/src/font.rs:434-449 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×3
Edited copy of a member (5 corresponding lines) crates/wezterm-surface/src/lib.rs:368— crates/wezterm-surface/src/lib.rs:368-376 | crates/wezterm-surface/src/lib.rs:387-391 — 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) crates/wezterm-escape-parser/src/parser/mod.rs:166— crates/wezterm-escape-parser/src/parser/mod.rs:166-170 | termwiz/src/input.rs:1215-1219 — 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) config/derive/src/lib.rs:9— config/derive/src/lib.rs:9-13 | crates/wezterm-dynamic/derive/src/lib.rs:10-14 — 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 (29 lines × 2) crates/wezterm-font/src/ftwrap.rs:1517— crates/wezterm-font/src/ftwrap.rs:1517-1545 | crates/wezterm-font/src/rasterizer/harfbuzz.rs:378-406 — 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 `crates/wezterm-font/src/ftwrap.rs:1517` 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 `mode` to `FT_Composite_Mode` in one and `hb_paint_composite_mode_t` 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 (29 lines × 2) kaku-gui/src/overlay/copy.rs:1605— kaku-gui/src/overlay/copy.rs:1605-1633 | kaku-gui/src/overlay/copy.rs:1697-1725 — both copies are in the same file, so extract the 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 `kaku-gui/src/overlay/copy.rs:1605` 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) mux/src/tab.rs:980— mux/src/tab.rs:980-1008 | mux/src/tab.rs:1037-1065 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `mux/src/tab.rs:1067` calls `is_none` and `mux/src/tab.rs:1010` 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 (23 lines × 2) kaku-gui/src/inputmap.rs:179— kaku-gui/src/inputmap.rs:179-201 | kaku-gui/src/inputmap.rs:251-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/inputmap.rs:179` 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) kaku-gui/src/overlay/launcher.rs:415— kaku-gui/src/overlay/launcher.rs:415-437 | kaku-gui/src/overlay/selector.rs:102-124 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) kaku/src/ai_config/tui/ui.rs:408— kaku/src/ai_config/tui/ui.rs:408-430 | kaku/src/config_tui/ui.rs:491-513 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:408` 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) kaku-gui/src/overlay/ai_chat/state.rs:878— kaku-gui/src/overlay/ai_chat/state.rs:878-899 | kaku-gui/src/overlay/ai_chat/state.rs:2489-2510 — both copies are in the same file, so extract the 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 `kaku-gui/src/overlay/ai_chat/state.rs: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 (22 lines × 2) kaku-gui/src/overlay/launcher.rs:521— kaku-gui/src/overlay/launcher.rs:521-542 | kaku-gui/src/overlay/selector.rs:184-205 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:521` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) kaku-gui/src/termwindow/box_model.rs:982— kaku-gui/src/termwindow/box_model.rs:982-1003 | kaku-gui/src/termwindow/box_model.rs:1013-1034 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/box_model.rs:982` 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 (18 lines × 2) crates/wezterm-surface/src/line/clusterline.rs:207— crates/wezterm-surface/src/line/clusterline.rs:207-224 | crates/wezterm-surface/src/line/clusterline.rs:252-269 — both copies are in the same file, so extract the 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 `crates/wezterm-surface/src/line/clusterline.rs:207` 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 (18 lines × 2) kaku-gui/src/customglyph.rs:5630— kaku-gui/src/customglyph.rs:5630-5647 | kaku-gui/src/customglyph.rs:5799-5816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) window/src/os/macos/window.rs:9934— window/src/os/macos/window.rs:9934-9951 | window/src/os/macos/window.rs:9958-9975 — both copies are in the same file, so extract the 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 `window/src/os/macos/window.rs:9934` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) kaku-gui/src/main.rs:622— kaku-gui/src/main.rs:622-638 | kaku/src/cli/spawn_command.rs:65-82 — 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 `kaku/src/cli/spawn_command.rs:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17–18 lines × 2) mux/src/pane_encoding.rs:144— mux/src/pane_encoding.rs:144-161 | mux/src/pane_encoding.rs:251-267 — both copies are in the same file, so extract the 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 `mux/src/pane_encoding.rs:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) kaku-gui/src/overlay/copy.rs:349— kaku-gui/src/overlay/copy.rs:349-365 | kaku-gui/src/overlay/copy.rs:416-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/copy.rs:349` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 3) mux/src/tab.rs:1791— mux/src/tab.rs:1791-1804 | mux/src/tab.rs:1833-1844 | mux/src/tab.rs:2091-2104 — 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 `mux/src/tab.rs:1791` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) mux/src/tmux_commands.rs:1003— mux/src/tmux_commands.rs:1003-1014 | mux/src/tmux_commands.rs:1087-1098 | mux/src/tmux_commands.rs:1201-1212 — 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 `mux/src/tmux_commands.rs:1003` 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 × 3) crates/wezterm-font/src/rasterizer/freetype.rs:654— crates/wezterm-font/src/rasterizer/freetype.rs:654-665 | crates/wezterm-font/src/rasterizer/freetype.rs:679-690 | crates/wezterm-font/src/rasterizer/freetype.rs:708-719 — 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 `crates/wezterm-font/src/rasterizer/freetype.rs:654` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 3) crates/luahelper/src/lib.rs:196— crates/luahelper/src/lib.rs:196-204 | lua-api-crates/serde-funcs/src/lib.rs:232-240 | lua-api-crates/share-data/src/lib.rs:186-194 — before extracting anything, compare `crates/luahelper/src/lib.rs` and `lua-api-crates/share-data/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `crates/luahelper/src/lib.rs:196` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 3) kaku-gui/src/termwindow/mod.rs:5347— kaku-gui/src/termwindow/mod.rs:5347-5355 | kaku-gui/src/termwindow/mod.rs:5360-5368 | kaku-gui/src/termwindow/mod.rs:5376-5384 — 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 `kaku-gui/src/termwindow/mod.rs:5347` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) kaku/src/cli/rename_workspace.rs:27— kaku/src/cli/rename_workspace.rs:27-35 | kaku/src/cli/set_tab_title.rs:26-34 | kaku/src/cli/set_window_title.rs:27-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `kaku/src/cli/rename_workspace.rs:27` 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 × 4) kaku-gui/src/customglyph.rs:749— kaku-gui/src/customglyph.rs:749-755 | kaku-gui/src/customglyph.rs:3417-3423 | kaku-gui/src/customglyph.rs:3431-3437 | kaku-gui/src/customglyph.rs:3492-3498 — 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 `kaku-gui/src/customglyph.rs:749` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 4) kaku-gui/src/customglyph.rs:1076— kaku-gui/src/customglyph.rs:1076-1083 | kaku-gui/src/customglyph.rs:1271-1278 | kaku-gui/src/customglyph.rs:3546-3552 | kaku-gui/src/customglyph.rs:4848-4854 — 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 `kaku-gui/src/customglyph.rs:1076` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/customglyph.rs:1085` calls `LineTo`, `Frac` and `kaku-gui/src/customglyph.rs:3554` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 4) kaku/src/ai_config/tui/ui.rs:390— kaku/src/ai_config/tui/ui.rs:390-396 | kaku/src/ai_config/tui/ui.rs:478-484 | kaku/src/config_tui/ui.rs:400-406 | kaku/src/config_tui/ui.rs:468-474 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:390` 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.
KeyCode::encode (cyclomatic 112) termwiz/src/input.rs:235— KeyCode::encode has cyclomatic complexity 112 (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.
KeyCode::try_from (cyclomatic 77) crates/wezterm-input-types/src/lib.rs:341— KeyCode::try_from has cyclomatic complexity 77 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: PhysKeyCode::to_key_code (cyclomatic 117) 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 function is counted neither in this dimension's figures nor in its score.
TerminfoRenderer::render_to (cyclomatic 79) termwiz/src/render/terminfo.rs:337— TerminfoRenderer::render_to has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TerminfoRenderer::flush_pending_attr (cyclomatic 38) termwiz/src/render/terminfo.rs:55— TerminfoRenderer::flush_pending_attr 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.
CSIParser::sgr (cyclomatic 77) crates/wezterm-escape-parser/src/csi.rs:2686— CSIParser::sgr has cyclomatic complexity 77 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
CSIParser::window (cyclomatic 40) crates/wezterm-escape-parser/src/csi.rs:2583— CSIParser::window has cyclomatic complexity 40 (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: CSIParser::parse_next (cyclomatic 74) 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 function is counted neither in this dimension's figures nor in its score.
BidiContext::explicit_embedding_levels (cyclomatic 47) crates/bidi/src/lib.rs:1337— BidiContext::explicit_embedding_levels 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.
BidiContext::reverse_levels (cyclomatic 19) crates/bidi/src/lib.rs:355— BidiContext::reverse_levels 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.
OperatingSystemCommand::internal_parse (cyclomatic 35) crates/wezterm-escape-parser/src/osc.rs:257— OperatingSystemCommand::internal_parse has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
OperatingSystemCommand::fmt (cyclomatic 32) crates/wezterm-escape-parser/src/osc.rs:558— OperatingSystemCommand::fmt has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
wezterm_mux_server_impl::dispatch::process_async (cyclomatic 31) crates/wezterm-mux-server-impl/src/dispatch.rs:37— wezterm_mux_server_impl::dispatch::process_async has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
wezterm_mux_server_impl::update_mux_domains_impl (cyclomatic 16) crates/wezterm-mux-server-impl/src/lib.rs:45— wezterm_mux_server_impl::update_mux_domains_impl 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.
SelectorState::run_loop (cyclomatic 31) kaku-gui/src/overlay/selector.rs:242— SelectorState::run_loop 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.
SelectorState::render (cyclomatic 16) kaku-gui/src/overlay/selector.rs:94— SelectorState::render 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.
TmuxDomainState::advance (cyclomatic 31) mux/src/tmux.rs:87— TmuxDomainState::advance 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.
TmuxDomainState::sync_window_state (cyclomatic 20) mux/src/tmux_commands.rs:373— TmuxDomainState::sync_window_state 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.
wezterm_font::rasterizer::colr::apply_sweep_gradient_patches (cyclomatic 28) crates/wezterm-font/src/rasterizer/colr.rs:298— wezterm_font::rasterizer::colr::apply_sweep_gradient_patches 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.
wezterm_font::rasterizer::harfbuzz::record_to_cairo_surface (cyclomatic 16) crates/wezterm-font/src/rasterizer/harfbuzz.rs:104— wezterm_font::rasterizer::harfbuzz::record_to_cairo_surface has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: wezterm_font::rasterizer::harfbuzz::hb_paint_mode_to_operator (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 function is counted neither in this dimension's figures nor in its score.
LocalPane::is_dead (cyclomatic 23) mux/src/localpane.rs:288— LocalPane::is_dead 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.
LocalPane::search (cyclomatic 22) mux/src/localpane.rs:775— LocalPane::search has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Screen::scroll_up (cyclomatic 22) term/src/screen.rs:710— Screen::scroll_up 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.
Screen::resize (cyclomatic 16) term/src/screen.rs:202— Screen::resize 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.
TerminfoRenderer::render_to (cognitive 163) termwiz/src/render/terminfo.rs:337— TerminfoRenderer::render_to has cognitive complexity 163 (threshold 15). Drivers by points: if/else 33 (112 pts), loops 5 (26 pts), match/switch 7 (23 pts), boolean chains 2 (nesting depth added 116). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TerminfoRenderer::flush_pending_attr (cognitive 96) termwiz/src/render/terminfo.rs:55— TerminfoRenderer::flush_pending_attr has cognitive complexity 96 (threshold 15). Drivers by points: if/else 37 (74 pts), match/switch 6 (20 pts), boolean chains 2 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_config_derive::attr::field_info (cognitive 101) config/derive/src/attr.rs:131— wezterm_config_derive::attr::field_info has cognitive complexity 101 (threshold 15). Drivers by points: if/else 18 (75 pts), match/switch 8 (22 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_config_derive::attr::container_info (cognitive 28) config/derive/src/attr.rs:15— wezterm_config_derive::attr::container_info has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (20 pts), match/switch 2 (5 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.
TabBarState::new (cognitive 77) kaku-gui/src/tabbar.rs:1006— TabBarState::new has cognitive complexity 77 (threshold 15). Drivers by points: if/else 40 (56 pts), loops 6 (11 pts), boolean chains 7, match/switch 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TabBarState::integrated_title_buttons (cognitive 19) kaku-gui/src/tabbar.rs:914— TabBarState::integrated_title_buttons has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_dynamic_derive::attr::field_info (cognitive 76) crates/wezterm-dynamic/derive/src/attr.rs:281— wezterm_dynamic_derive::attr::field_info has cognitive complexity 76 (threshold 15). Drivers by points: if/else 16 (68 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_dynamic_derive::attr::container_info (cognitive 28) crates/wezterm-dynamic/derive/src/attr.rs:11— wezterm_dynamic_derive::attr::container_info has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (20 pts), match/switch 2 (5 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.
wezterm_font::rasterizer::colr::apply_sweep_gradient_patches (cognitive 73) crates/wezterm-font/src/rasterizer/colr.rs:298— wezterm_font::rasterizer::colr::apply_sweep_gradient_patches has cognitive complexity 73 (threshold 15). Drivers by points: if/else 25 (55 pts), loops 7 (17 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.
wezterm_font::rasterizer::crop_to_non_transparent (cognitive 28) crates/wezterm-font/src/rasterizer/mod.rs:69— wezterm_font::rasterizer::crop_to_non_transparent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (14 pts), match/switch 2 (8 pts), loops 4 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SelectorState::run_loop (cognitive 47) kaku-gui/src/overlay/selector.rs:242— SelectorState::run_loop has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (40 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SelectorState::render (cognitive 36) kaku-gui/src/overlay/selector.rs:94— SelectorState::render has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 1, 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.
CoreTextFontLocator::locate_fallback_for_codepoints (cognitive 40) crates/wezterm-font/src/locator/core_text.rs:151— CoreTextFontLocator::locate_fallback_for_codepoints has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CoreTextFontLocator::load_fonts (cognitive 20) crates/wezterm-font/src/locator/core_text.rs:91— CoreTextFontLocator::load_fonts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wezterm_mux_server_impl::dispatch::process_async (cognitive 37) crates/wezterm-mux-server-impl/src/dispatch.rs:37— wezterm_mux_server_impl::dispatch::process_async has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (25 pts), match/switch 4 (11 pts), loops 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.
wezterm_mux_server_impl::update_mux_domains_impl (cognitive 30) crates/wezterm-mux-server-impl/src/lib.rs:45— wezterm_mux_server_impl::update_mux_domains_impl has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 4 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Surface::repaint_all (cognitive 36) crates/wezterm-surface/src/lib.rs:580— Surface::repaint_all has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 5 (13 pts), loops 3, 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.
Surface::print_text (cognitive 21) crates/wezterm-surface/src/lib.rs:430— Surface::print_text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputParser::process_bytes (cognitive 34) termwiz/src/input.rs:1070— InputParser::process_bytes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 3 (10 pts), boolean chains 3, 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.
InputParser::build_basic_key_map (cognitive 33) termwiz/src/input.rs:646— InputParser::build_basic_key_map has cognitive complexity 33 (threshold 15). Drivers by points: loops 17 (26 pts), match/switch 1 (4 pts), if/else 1 (3 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
CopyOverlay::with_lines_mut (cognitive 32) kaku-gui/src/overlay/copy.rs:1522— CopyOverlay::with_lines_mut has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (8 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CopyOverlay::get_lines (cognitive 29) kaku-gui/src/overlay/copy.rs:1645— CopyOverlay::get_lines has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (8 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RenderableInner::apply_changes_to_surface (cognitive 26) crates/wezterm-client/src/pane/renderable.rs:303— RenderableInner::apply_changes_to_surface has cognitive complexity 26 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 7 (10 pts), match/switch 1 (3 pts), boolean chains 1 (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.
RenderableInner::apply_lines (cognitive 18) crates/wezterm-client/src/pane/renderable.rs:531— RenderableInner::apply_lines has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (10 pts), match/switch 2 (7 pts), if/else 1 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
MuxPane::get_text_from_semantic_zone (cognitive 25) lua-api-crates/mux/src/pane.rs:22— MuxPane::get_text_from_semantic_zone has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). Of this number, 16 points are the body's own statements and 9 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.
MuxPane::add_methods (cognitive 16) lua-api-crates/mux/src/pane.rs:88— MuxPane::add_methods has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (8 pts), loops 4 (6 pts), if/else 2 (nesting depth added 4). Of this number, 10 points are the body's own statements and 6 belong to one function item 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SerializedLines::extract_data (cognitive 22) crates/codec/src/lib.rs:991— SerializedLines::extract_data has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (11 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.
SerializedLines::from (cognitive 20) crates/codec/src/lib.rs:1020— SerializedLines::from has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts), match/switch 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config::collect_user_color_schemes (cognitive 20) config/src/lib.rs:225— config::collect_user_color_schemes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config::lua::config_builder_new_index (cognitive 19) config/src/lua.rs:103— config::lua::config_builder_new_index has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (7 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
Tui::drain_stream (cognitive 20) kaku-gui/src/cli_chat/mod.rs:357— Tui::drain_stream has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tui::all_display_lines (cognitive 18) kaku-gui/src/cli_chat/mod.rs:314— Tui::all_display_lines has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
tabout::tabulate_output (cognitive 16) crates/tabout/src/lib.rs:62— tabout::tabulate_output has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (tabout::tabulate_for_terminal) 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.
tabout::tabulate_for_terminal (cognitive 16) crates/tabout/src/lib.rs:165— tabout::tabulate_for_terminal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (tabout::tabulate_output) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication· Edited copy of a member (69 corresponding lines) · ×2
Edited copy of a member (69 corresponding lines) mux/src/tab.rs:440— mux/src/tab.rs:440-508 | mux/src/tab.rs:510-581 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (69 corresponding lines) term/src/screen.rs:1073— term/src/screen.rs:1073-1144 | term/src/screen.rs:1152-1220 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (48 corresponding lines) · ×2
Edited copy of a member (48 corresponding lines) kaku/src/ai_config/tui.rs:2991— kaku/src/ai_config/tui.rs:2991-3038 | kaku/src/ai_config/tui/providers/codex.rs:315-365 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (48 corresponding lines) crates/tabout/src/lib.rs:66— crates/tabout/src/lib.rs:66-113 | crates/tabout/src/lib.rs:170-217 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (50 corresponding lines) · ×2
Edited copy of a member (50 corresponding lines) kaku/src/ai_config/tui.rs:2505— kaku/src/ai_config/tui.rs:2505-2560 | kaku/src/ai_config/tui.rs:2567-2616 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (50 corresponding lines) kaku/src/init.rs:162— kaku/src/init.rs:162-211 | kaku/src/init.rs:213-268 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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) config/src/lib.rs:118— config/src/lib.rs:118-144 | config/src/lib.rs:146-181 — 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) crates/luahelper/src/lib.rs:75— crates/luahelper/src/lib.rs:75-101 | lua-api-crates/serde-funcs/src/lib.rs:87-120 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×2
Edited copy of a member (28 corresponding lines) kaku-gui/src/update.rs:811— kaku-gui/src/update.rs:811-838 | kaku/src/update.rs:684-711 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) mux/src/tab.rs:1674— mux/src/tab.rs:1674-1705 | mux/src/tab.rs:1707-1734 — 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 (15 corresponding lines) · ×2
Edited copy of a member (15 corresponding lines) crates/procinfo/src/lib.rs:69— crates/procinfo/src/lib.rs:69-83 | crates/procinfo/src/lib.rs:89-105 — 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) term/src/terminalstate/mod.rs:1287— term/src/terminalstate/mod.rs:1287-1301 | term/src/terminalstate/mod.rs:1303-1317 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 14+ corresponding lines) · ×2
Edited copies of one member (4 members, 14+ corresponding lines) crates/vtparse/src/transitions.rs:170— crates/vtparse/src/transitions.rs:170-186 | crates/vtparse/src/transitions.rs:188-204 | crates/vtparse/src/transitions.rs:206-219 | crates/vtparse/src/transitions.rs:246-267 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 14+ corresponding lines) crates/wezterm-ssh/src/sftp/mod.rs:169— crates/wezterm-ssh/src/sftp/mod.rs:169-182 | crates/wezterm-ssh/src/sftp/mod.rs:240-253 | crates/wezterm-ssh/src/sftp/mod.rs:262-275 | crates/wezterm-ssh/src/sftp/mod.rs:323-337 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 13+ corresponding lines) · ×2
Edited copies of one member (5 members, 13+ corresponding lines) crates/vtparse/src/transitions.rs:49— crates/vtparse/src/transitions.rs:49-66 | crates/vtparse/src/transitions.rs:93-105 | crates/vtparse/src/transitions.rs:125-139 | crates/vtparse/src/transitions.rs:141-154 | crates/vtparse/src/transitions.rs:156-168 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 13+ corresponding lines) crates/wezterm-font/src/lib.rs:710— crates/wezterm-font/src/lib.rs:710-722 | crates/wezterm-font/src/lib.rs:724-736 | crates/wezterm-font/src/lib.rs:738-750 | crates/wezterm-font/src/lib.rs:752-764 | crates/wezterm-font/src/lib.rs:766-778 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×2
Edited copies of one member (3 members, 9+ corresponding lines) crates/wezterm-ssh/src/filewrap.rs:49— crates/wezterm-ssh/src/filewrap.rs:49-60 | crates/wezterm-ssh/src/sftpwrap.rs:147-157 | crates/wezterm-ssh/src/sftpwrap.rs:159-167 — 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) kaku-gui/src/overlay/ai_chat/types.rs:28— kaku-gui/src/overlay/ai_chat/types.rs:28-36 | kaku/src/kaku_theme.rs:47-55 | kaku/src/tui_core/theme.rs:26-34 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) crates/wezterm-escape-parser/src/osc.rs:1104— crates/wezterm-escape-parser/src/osc.rs:1104-1109 | kaku-gui/src/inline_ai_control.rs:33-38 — 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) crates/rangeset/src/lib.rs:20— crates/rangeset/src/lib.rs:20-25 | term/src/lib.rs:83-89 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (61 lines × 2) config/derive/src/attr.rs:203— config/derive/src/attr.rs:203-263 | crates/wezterm-dynamic/derive/src/attr.rs:299-359 — before extracting anything, compare `config/derive/src/attr.rs` and `crates/wezterm-dynamic/derive/src/attr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `config/derive/src/attr.rs:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (61 lines × 2) crates/wezterm-font/src/rasterizer/freetype.rs:845— crates/wezterm-font/src/rasterizer/freetype.rs:845-905 | crates/wezterm-font/src/rasterizer/harfbuzz.rs:176-236 — 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 `crates/wezterm-font/src/rasterizer/freetype.rs:845` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20–21 lines × 2) kaku-gui/src/ai_tools/search.rs:101— kaku-gui/src/ai_tools/search.rs:101-120 | kaku-gui/src/ai_tools/web.rs:310-330 — 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 `kaku-gui/src/ai_tools/search.rs:101` 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 (20–21 lines × 2) kaku-gui/src/customglyph.rs:4160— kaku-gui/src/customglyph.rs:4160-4180 | kaku-gui/src/customglyph.rs:4183-4202 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:4160` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15–16 lines × 2) kaku/src/ai_config/tui/providers/mod.rs:1667— kaku/src/ai_config/tui/providers/mod.rs:1667-1682 | kaku/src/ai_config/tui/providers/mod.rs:1885-1899 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui/providers/mod.rs:1667` 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 (15–16 lines × 2) lua-api-crates/share-data/src/lib.rs:363— lua-api-crates/share-data/src/lib.rs:363-378 | lua-api-crates/share-data/src/lib.rs:389-403 — both copies are in the same file, so extract the 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 `lua-api-crates/share-data/src/lib.rs:363` 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 × 3) crates/wezterm-font/src/rasterizer/freetype.rs:194— crates/wezterm-font/src/rasterizer/freetype.rs:194-205 | crates/wezterm-font/src/rasterizer/freetype.rs:246-258 | crates/wezterm-font/src/rasterizer/freetype.rs:299-311 — 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 `crates/wezterm-font/src/rasterizer/freetype.rs: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 (12–13 lines × 3) kaku-gui/src/ai_chat_engine/mod.rs:566— kaku-gui/src/ai_chat_engine/mod.rs:566-578 | kaku-gui/src/ai_chat_engine/mod.rs:584-595 | kaku-gui/src/ai_chat_engine/mod.rs:601-612 — 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 `kaku-gui/src/ai_chat_engine/mod.rs:566` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–12 lines × 2) crates/codec/src/lib.rs:214— crates/codec/src/lib.rs:214-223 | crates/codec/src/lib.rs:260-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/codec/src/lib.rs:214` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–12 lines × 2) kaku-gui/src/overlay/ai_chat/render.rs:467— kaku-gui/src/overlay/ai_chat/render.rs:467-478 | kaku-gui/src/overlay/ai_chat/render.rs:751-760 — both copies are in the same file, so extract the block into 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 × 4) crates/wezterm-client/src/client.rs:216— crates/wezterm-client/src/client.rs:216-226 | crates/wezterm-client/src/client.rs:244-254 | crates/wezterm-client/src/client.rs:280-290 | crates/wezterm-client/src/client.rs:300-310 — 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 `crates/wezterm-client/src/client.rs: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 (11 lines × 4) kaku/src/ai_config/tui/ui.rs:372— kaku/src/ai_config/tui/ui.rs:372-382 | kaku/src/ai_config/tui/ui.rs:458-468 | kaku/src/config_tui/ui.rs:386-396 | kaku/src/config_tui/ui.rs:450-460 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:372` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–10 lines × 2) mux/src/lib.rs:1763— mux/src/lib.rs:1763-1770 | mux/src/lib.rs:1820-1829 — both copies are in the same file, so extract the 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 `mux/src/lib.rs:1763` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–10 lines × 2) mux/src/tmux_commands.rs:703— mux/src/tmux_commands.rs:703-712 | mux/src/tmux_commands.rs:813-820 — both copies are in the same file, so extract the 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 `mux/src/tmux_commands.rs:703` 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, `mux/src/tmux_commands.rs:715` calls `parse_sigil_number`, `next`, `ok_or_else` and `mux/src/tmux_commands.rs:822` 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–8 lines × 2) kaku-gui/src/commands.rs:286— kaku-gui/src/commands.rs:286-293 | kaku-gui/src/commands.rs:601-607 — both copies are in the same file, so extract the 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 `kaku-gui/src/commands.rs:286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) kaku-gui/src/stats.rs:53— kaku-gui/src/stats.rs:53-59 | kaku-gui/src/stats.rs:68-75 — both copies are in the same file, so extract the 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 `kaku-gui/src/stats.rs:53` 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) kaku-gui/src/termwindow/tab_rename.rs:864— kaku-gui/src/termwindow/tab_rename.rs:864-868 | kaku-gui/src/termwindow/tab_rename.rs:894-898 | kaku-gui/src/termwindow/tab_rename.rs:928-932 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/termwindow/tab_rename.rs:900` calls `selected_text_attrs` and `kaku-gui/src/termwindow/tab_rename.rs:870` 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 × 3) kaku/src/ai_config/tui/providers/assistant.rs:518— kaku/src/ai_config/tui/providers/assistant.rs:518-522 | kaku/src/ai_config/tui/providers/assistant.rs:524-528 | kaku/src/ai_config/tui/providers/assistant.rs:557-561 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku/src/ai_config/tui/providers/assistant.rs:518` 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.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark crates/kaku-remote/assets/web/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
PhysKeyCode::for_each_code (cyclomatic 321) crates/wezterm-input-types/src/lib.rs:1018— PhysKeyCode::for_each_code has cyclomatic complexity 321 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
KeyEvent::encode_kitty (cyclomatic 111) crates/wezterm-input-types/src/lib.rs:1660— KeyEvent::encode_kitty has cyclomatic complexity 111 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: PhysKeyCode::to_key_code (cyclomatic 117) 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 function is counted neither in this dimension's figures nor in its score.
init (cyclomatic 68) crates/kaku-remote/assets/web/desktop.js:99— init has cyclomatic complexity 68 (threshold 15). Most of this is not in the body itself: 8 of the 68 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 931, 1241, 894, …). 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.
SessionHandler::process_one (cyclomatic 58) crates/wezterm-mux-server-impl/src/sessionhandler.rs:246— SessionHandler::process_one has cyclomatic complexity 58 (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.
ITermProprietary::parse (cyclomatic 51) crates/wezterm-escape-parser/src/osc.rs:1467— ITermProprietary::parse 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.
Sgr::fmt (cyclomatic 50) crates/wezterm-escape-parser/src/csi.rs:1507— Sgr::fmt has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: CSIParser::parse_next (cyclomatic 74) 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 function is counted neither in this dimension's figures nor in its score.
TabBarState::new (cyclomatic 42) kaku-gui/src/tabbar.rs:1006— TabBarState::new 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.
Value::add_methods (cyclomatic 41) lua-api-crates/share-data/src/lib.rs:273— Value::add_methods has cyclomatic complexity 41 (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.
wezterm_config_derive::attr::field_info (cyclomatic 35) config/derive/src/attr.rs:131— wezterm_config_derive::attr::field_info 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.
index.html.handleTerminalKey (cyclomatic 34) crates/kaku-remote/assets/web/index.html:1265— index.html.handleTerminalKey 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.
AiClient::chat_step (cyclomatic 33) kaku-gui/src/ai_client/mod.rs:461— AiClient::chat_step 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.
Cursor::fmt (cyclomatic 31) crates/wezterm-escape-parser/src/csi.rs:1296— Cursor::fmt has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: CSIParser::parse_next (cyclomatic 74) 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 function is counted neither in this dimension's figures nor in its score.
index.html.onFile (cyclomatic 31) crates/kaku-remote/assets/web/index.html:3657— index.html.onFile 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.
MouseReport::fmt (cyclomatic 30) crates/wezterm-escape-parser/src/csi.rs:686— MouseReport::fmt has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: CSIParser::parse_next (cyclomatic 74) 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 function is counted neither in this dimension's figures nor in its score.
HarfbuzzShaper::do_shape (cyclomatic 30) crates/wezterm-font/src/shaper/harfbuzz.rs:203— HarfbuzzShaper::do_shape 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.
LineEditor::apply_action (cyclomatic 29) termwiz/src/lineedit/mod.rs:677— LineEditor::apply_action 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.
index.html.rejoinedPaths (cyclomatic 29) crates/kaku-remote/assets/web/index.html:898— index.html.rejoinedPaths has cyclomatic complexity 29 (threshold 15). Of this number, 23 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.
wezterm_escape_parser::tmux_cc::unvis_bytes::unvis_byte (cyclomatic 28) crates/wezterm-escape-parser/src/tmux_cc/mod.rs:538— wezterm_escape_parser::tmux_cc::unvis_bytes::unvis_byte has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: wezterm_escape_parser::tmux_cc::parse_line (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
desktop.init.ensureDecoder (cyclomatic 28) crates/kaku-remote/assets/web/desktop.js:591— desktop.init.ensureDecoder has cyclomatic complexity 28 (threshold 15). Of this number, 14 points are the body's own statements and 14 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.
ProgramStatus::parse (cyclomatic 27) crates/wezterm-escape-parser/src/osc.rs:985— ProgramStatus::parse has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Face::compute_cap_height (cyclomatic 27) crates/wezterm-font/src/ftwrap.rs:973— Face::compute_cap_height has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: wezterm_font::ftwrap::composite_mode_to_operator (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
index.html.onConfig (cyclomatic 27) crates/kaku-remote/assets/web/index.html:2928— index.html.onConfig 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.
VTParser::action (cyclomatic 26) crates/vtparse/src/lib.rs:526— VTParser::action 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.
ParsedConfigFile::parse_impl (cyclomatic 26) crates/wezterm-ssh/src/config.rs:228— ParsedConfigFile::parse_impl has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 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.
SrgbaTuple::from_str (cyclomatic 25) crates/color-types/src/lib.rs:778— SrgbaTuple::from_str has cyclomatic complexity 25 (threshold 15). Of this number, 21 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.
luahelper::lua_value_to_dynamic_impl (cyclomatic 25) crates/luahelper/src/lib.rs:108— luahelper::lua_value_to_dynamic_impl 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.
share_data::lua_value_to_gvalue_impl (cyclomatic 25) lua-api-crates/share-data/src/lib.rs:101— share_data::lua_value_to_gvalue_impl 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.
serde_funcs::lua_value_to_json_value (cyclomatic 25) lua-api-crates/serde-funcs/src/lib.rs:152— serde_funcs::lua_value_to_json_value 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.
index.html.fit (cyclomatic 24) crates/kaku-remote/assets/web/index.html:1106— index.html.fit 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.
index.html.renderTabs (cyclomatic 24) crates/kaku-remote/assets/web/index.html:2468— index.html.renderTabs has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ToolState::load_with_usage (cyclomatic 23) kaku/src/ai_config/tui.rs:194— ToolState::load_with_usage has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
InputParser::build_basic_key_map (cyclomatic 23) termwiz/src/input.rs:646— InputParser::build_basic_key_map has cyclomatic complexity 23 (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.
LineEditBuffer::eval_movement (cyclomatic 23) termwiz/src/lineedit/buffer.rs:83— LineEditBuffer::eval_movement 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.
desktop.init.endPointer (cyclomatic 23) crates/kaku-remote/assets/web/desktop.js:979— desktop.init.endPointer 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.
index.html.openDirect (cyclomatic 23) crates/kaku-remote/assets/web/index.html:4009— index.html.openDirect has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 4039, 4033, 4021). 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.
init.endPointer (cyclomatic 23) crates/kaku-remote/assets/web/desktop.js:979— init.endPointer 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.
ValuePrinterHelper::fmt (cyclomatic 22) crates/luahelper/src/lib.rs:344— ValuePrinterHelper::fmt has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
wezterm_dynamic_derive::attr::field_info (cyclomatic 22) crates/wezterm-dynamic/derive/src/attr.rs:281— wezterm_dynamic_derive::attr::field_info 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.
index.html.verify (cyclomatic 22) crates/kaku-remote/assets/web/index.html:1555— index.html.verify has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 1559). 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.
index.html.onTabs (cyclomatic 22) crates/kaku-remote/assets/web/index.html:2867— index.html.onTabs has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConfigInner::watch_path (cyclomatic 21) config/src/lib.rs:1864— ConfigInner::watch_path has cyclomatic complexity 21 (threshold 15). Of this number, 19 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.
FinalTermSemanticPrompt::parse (cyclomatic 21) crates/wezterm-escape-parser/src/osc.rs:767— FinalTermSemanticPrompt::parse 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.
Surface::repaint_all (cyclomatic 21) crates/wezterm-surface/src/lib.rs:580— Surface::repaint_all 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.
WebGpuState::new_impl (cyclomatic 21) kaku-gui/src/termwindow/webgpu.rs:225— WebGpuState::new_impl 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.
ClientDomain::process_pane_list (cyclomatic 20) crates/wezterm-client/src/domain.rs:504— ClientDomain::process_pane_list 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.
wezterm_client::domain::mux_notify_client_domain (cyclomatic 20) crates/wezterm-client/src/domain.rs:269— wezterm_client::domain::mux_notify_client_domain 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.
FontConfigInner::match_style (cyclomatic 20) crates/wezterm-font/src/lib.rs:1131— FontConfigInner::match_style 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.
Tui::drain_stream (cyclomatic 20) kaku-gui/src/cli_chat/mod.rs:357— Tui::drain_stream 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.
desktop.init.sendReport (cyclomatic 20) crates/kaku-remote/assets/web/desktop.js:151— desktop.init.sendReport 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.
desktop.init.onKey.<returned closure> (cyclomatic 20) crates/kaku-remote/assets/web/desktop.js:1215— desktop.init.onKey.<returned closure> 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.
index.html.rowElement (cyclomatic 20) crates/kaku-remote/assets/web/index.html:1721— index.html.rowElement has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (put). 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.
index.html.snapshot (cyclomatic 20) crates/kaku-remote/assets/web/index.html:2164— index.html.snapshot 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.
index.html.onFrame (cyclomatic 20) crates/kaku-remote/assets/web/index.html:3083— index.html.onFrame has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 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.
index.html.handle (cyclomatic 20) crates/kaku-remote/assets/web/index.html:3869— index.html.handle 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.
init.sendReport (cyclomatic 20) crates/kaku-remote/assets/web/desktop.js:151— init.sendReport 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.
init.onKey (cyclomatic 20) crates/kaku-remote/assets/web/desktop.js:1215— init.onKey has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1215, 1221). 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.
WcLookupTable::new (cyclomatic 19) crates/wezterm-char-props/src/widechar_width.rs:1603— WcLookupTable::new has cyclomatic complexity 19 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
desktop.init.onFrame (cyclomatic 19) crates/kaku-remote/assets/web/desktop.js:671— desktop.init.onFrame 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.
index.html.stage.addEventListener("contextmenu") (cyclomatic 19) crates/kaku-remote/assets/web/index.html:2832— index.html.stage.addEventListener("contextmenu") has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.html.connect::onMessage (cyclomatic 19) crates/kaku-remote/assets/web/index.html:4122— index.html.connect::onMessage 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.
init.onFrame (cyclomatic 19) crates/kaku-remote/assets/web/desktop.js:671— init.onFrame 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.
config::proxy::parse_scutil_proxy (cyclomatic 18) config/src/proxy.rs:47— config::proxy::parse_scutil_proxy 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.
Shown::update (cyclomatic 18) crates/kaku-remote/src/web.rs:2058— Shown::update 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.
CoreTextFontLocator::locate_fallback_for_codepoints (cyclomatic 18) crates/wezterm-font/src/locator/core_text.rs:151— CoreTextFontLocator::locate_fallback_for_codepoints 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.
CharSelector::key_down (cyclomatic 18) kaku-gui/src/termwindow/charselect.rs:604— CharSelector::key_down 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.
LocalDomain::fixup_command (cyclomatic 18) mux/src/domain.rs:313— LocalDomain::fixup_command 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.
ColorPalette::from (cyclomatic 18) config/src/color.rs:313— ColorPalette::from has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
desktop.init.onStatus (cyclomatic 18) crates/kaku-remote/assets/web/desktop.js:742— desktop.init.onStatus has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
init.onStatus (cyclomatic 18) crates/kaku-remote/assets/web/desktop.js:742— init.onStatus 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.
CellCluster::make_cluster (cyclomatic 17) crates/wezterm-surface/src/cellcluster.rs:50— CellCluster::make_cluster 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.
LayoutState::update_widget_constraint (cyclomatic 17) termwiz/src/widgets/layout.rs:309— LayoutState::update_widget_constraint 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.
WindowInner::refresh_after_display_change (cyclomatic 17) window/src/os/macos/window.rs:2925— WindowInner::refresh_after_display_change 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: window::os::macos::window::function_key_to_keycode (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
index.html.sendOnce (cyclomatic 17) crates/kaku-remote/assets/web/index.html:3769— index.html.sendOnce 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. This is NOT this file's highest cyclomatic complexity: index.html.receive (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.
init.ensureDecoder::output (cyclomatic 17) crates/kaku-remote/assets/web/desktop.js:607— init.ensureDecoder::output 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.
Config::expand_tokens (cyclomatic 16) crates/wezterm-ssh/src/config.rs:677— Config::expand_tokens 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.
ProbeCapabilities::screen_size (cyclomatic 16) termwiz/src/caps/probed.rs:108— ProbeCapabilities::screen_size 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.
Window::new_window (cyclomatic 16) window/src/os/macos/window.rs:1763— Window::new_window has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: window::os::macos::window::function_key_to_keycode (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
index.html.send (cyclomatic 16) crates/kaku-remote/assets/web/index.html:562— index.html.send has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: index.html.receive (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.
index.html.renderPast (cyclomatic 16) crates/kaku-remote/assets/web/index.html:1639— index.html.renderPast 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: index.html.receive (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.
index.html.maskWrite (cyclomatic 16) crates/kaku-remote/assets/web/index.html:2092— index.html.maskWrite has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.html.receive (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.
index.html.historySelection (cyclomatic 16) crates/kaku-remote/assets/web/index.html:3146— index.html.historySelection has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.html.receive (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.
No assertions: an upload waiting for relay authentication settles when its socket closes crates/kaku-remote/tests/web.test.cjs:1154— 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.
PhysKeyCode::for_each_code (cognitive 427) crates/wezterm-input-types/src/lib.rs:1018— PhysKeyCode::for_each_code has cognitive complexity 427 (threshold 15). Drivers by points: if/else 319 (426 pts), loops 1 (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init (cognitive 95) crates/kaku-remote/assets/web/desktop.js:99— init has cognitive complexity 95 (threshold 15). Drivers by points: if/else 40 (63 pts), ternaries 9 (14 pts), boolean chains 13, error handling 2, loops 2, other 1 (nesting depth added 28). Most of this is not in the body itself: 9 of the 95 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 931, 894, 1241, …). 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.
KeyCode::encode (cognitive 86) termwiz/src/input.rs:235— KeyCode::encode has cognitive complexity 86 (threshold 15). Drivers by points: if/else 32 (52 pts), match/switch 10 (19 pts), boolean chains 15 (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.
KeyEvent::encode_kitty (cognitive 76) crates/wezterm-input-types/src/lib.rs:1660— KeyEvent::encode_kitty has cognitive complexity 76 (threshold 15). Drivers by points: if/else 27 (44 pts), match/switch 11 (19 pts), boolean chains 10, loops 1 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HarfbuzzShaper::do_shape (cognitive 72) crates/wezterm-font/src/shaper/harfbuzz.rs:203— HarfbuzzShaper::do_shape has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (53 pts), loops 5 (8 pts), match/switch 4 (8 pts), boolean chains 3 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SessionHandler::process_one (cognitive 69) crates/wezterm-mux-server-impl/src/sessionhandler.rs:246— SessionHandler::process_one has cognitive complexity 69 (threshold 15). Drivers by points: if/else 13 (37 pts), loops 6 (17 pts), match/switch 8 (15 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.
ITermProprietary::parse (cognitive 66) crates/wezterm-escape-parser/src/osc.rs:1467— ITermProprietary::parse has cognitive complexity 66 (threshold 15). Drivers by points: if/else 32 (49 pts), boolean chains 16, 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.
AiClient::chat_step (cognitive 63) kaku-gui/src/ai_client/mod.rs:461— AiClient::chat_step has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (42 pts), loops 5 (10 pts), match/switch 3 (7 pts), boolean chains 4 (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.
Value::add_methods (cognitive 63) lua-api-crates/share-data/src/lib.rs:273— Value::add_methods has cognitive complexity 63 (threshold 15). Drivers by points: match/switch 16 (33 pts), if/else 9 (27 pts), loops 1 (3 pts) (nesting depth added 37). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
Publish::try_spawn (cognitive 57) kaku-gui/src/main.rs:559— Publish::try_spawn has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (34 pts), match/switch 3 (12 pts), loops 2 (11 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ParsedConfigFile::parse_impl (cognitive 53) crates/wezterm-ssh/src/config.rs:228— ParsedConfigFile::parse_impl has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 4 (11 pts), match/switch 1 (5 pts), boolean chains 3 (nesting depth added 31). Of this number, 34 points are the body's own statements and 19 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientDomain::process_pane_list (cognitive 47) crates/wezterm-client/src/domain.rs:504— ClientDomain::process_pane_list has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (29 pts), match/switch 3 (10 pts), loops 5 (8 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.
WebGpuState::new_impl (cognitive 46) kaku-gui/src/termwindow/webgpu.rs:225— WebGpuState::new_impl has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (42 pts), loops 1 (2 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.
SrgbaTuple::from_str (cognitive 45) crates/color-types/src/lib.rs:778— SrgbaTuple::from_str has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 18). Of this number, 31 points are the body's own statements and 14 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.
ValuePrinterHelper::fmt (cognitive 45) crates/luahelper/src/lib.rs:344— ValuePrinterHelper::fmt has cognitive complexity 45 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 6 (17 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 28). 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.
index.html.onFile (cognitive 44) crates/kaku-remote/assets/web/index.html:3657— index.html.onFile has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActivateTab::run (cognitive 42) kaku/src/cli/activate_tab.rs:48— ActivateTab::run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (36 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LineEditBuffer::eval_movement (cognitive 42) termwiz/src/lineedit/buffer.rs:83— LineEditBuffer::eval_movement has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 7 (17 pts), boolean chains 2, 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.
index.html.rejoinedPaths (cognitive 42) crates/kaku-remote/assets/web/index.html:898— index.html.rejoinedPaths has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 7 (10 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 17). Of this number, 35 points are the body's own statements and 7 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.
index.html.handleTerminalKey (cognitive 42) crates/kaku-remote/assets/web/index.html:1265— index.html.handleTerminalKey has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 8, ternaries 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.snapshot (cognitive 41) crates/kaku-remote/assets/web/index.html:2164— index.html.snapshot has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
serde_funcs::lua_value_to_json_value (cognitive 38) lua-api-crates/serde-funcs/src/lib.rs:152— serde_funcs::lua_value_to_json_value has cognitive complexity 38 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 8 (13 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
luahelper::lua_value_to_dynamic_impl (cognitive 37) crates/luahelper/src/lib.rs:108— luahelper::lua_value_to_dynamic_impl has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 6 (18 pts), if/else 5 (9 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
share_data::lua_value_to_gvalue_impl (cognitive 37) lua-api-crates/share-data/src/lib.rs:101— share_data::lua_value_to_gvalue_impl has cognitive complexity 37 (threshold 15). Drivers by points: match/switch 6 (18 pts), if/else 5 (9 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 22). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
desktop.init.endPointer (cognitive 36) crates/kaku-remote/assets/web/desktop.js:979— desktop.init.endPointer has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.renderTabs (cognitive 36) crates/kaku-remote/assets/web/index.html:2468— index.html.renderTabs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 15). Of this number, 18 points are the body's own statements and 18 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.
init.endPointer (cognitive 35) crates/kaku-remote/assets/web/desktop.js:979— init.endPointer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 3, ternaries 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.
LocalDomain::fixup_command (cognitive 33) mux/src/domain.rs:313— LocalDomain::fixup_command has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 7 (15 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.deviceName (cognitive 32) crates/kaku-remote/assets/web/index.html:368— index.html.deviceName has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 11 (32 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SpawnCommand::run (cognitive 29) kaku/src/cli/spawn_command.rs:54— SpawnCommand::run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (7 pts), match/switch 2 (7 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LineEditor::apply_action (cognitive 29) termwiz/src/lineedit/mod.rs:677— LineEditor::apply_action has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (4 pts), match/switch 2 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
env_bootstrap::ringlog::prune_old_logs (cognitive 28) crates/env-bootstrap/src/ringlog.rs:241— env_bootstrap::ringlog::prune_old_logs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandBuilder::search_path (cognitive 28) crates/pty/src/cmdbuilder.rs:331— CommandBuilder::search_path has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 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.
FinalTermSemanticPrompt::parse (cognitive 28) crates/wezterm-escape-parser/src/osc.rs:767— FinalTermSemanticPrompt::parse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 5 (10 pts), boolean chains 3, loops 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.
WcLookupTable::new (cognitive 27) crates/wezterm-char-props/src/widechar_width.rs:1603— WcLookupTable::new has cognitive complexity 27 (threshold 15). Drivers by points: loops 18 (27 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
Client::new (cognitive 27) crates/wezterm-client/src/client.rs:1022— Client::new has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 15). Of this number, 26 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.
MovePaneToNewTab::run (cognitive 27) kaku/src/cli/move_pane_to_new_tab.rs:33— MovePaneToNewTab::run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (7 pts), match/switch 2 (7 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Node::lookup (cognitive 27) termwiz/src/keymap.rs:40— Node::lookup has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 6 (12 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.
Clipboard::cleanup_runtime_image_dir_static (cognitive 27) window/src/os/macos/clipboard.rs:210— Clipboard::cleanup_runtime_image_dir_static has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.onTabs (cognitive 27) crates/kaku-remote/assets/web/index.html:2867— index.html.onTabs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, error handling 1 (2 pts), loops 2, ternaries 1 (nesting depth added 6). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Shown::update (cognitive 26) crates/kaku-remote/src/web.rs:2058— Shown::update has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ImageDataType::decode (cognitive 26) crates/wezterm-cell/src/image.rs:374— ImageDataType::decode has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 4 (8 pts) (nesting depth added 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Capabilities::new_with_hints (cognitive 26) termwiz/src/caps/mod.rs:194— Capabilities::new_with_hints has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), match/switch 4 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProbeCapabilities::screen_size (cognitive 26) termwiz/src/caps/probed.rs:108— ProbeCapabilities::screen_size has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UnixTerminal::poll_input (cognitive 26) termwiz/src/terminal/unix.rs:409— UnixTerminal::poll_input has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.maskWrite (cognitive 26) crates/kaku-remote/assets/web/index.html:2092— index.html.maskWrite has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (6 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 11). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.onConfig (cognitive 26) crates/kaku-remote/assets/web/index.html:2928— index.html.onConfig has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 9, ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wezterm_char_props_codegen::emit_variation_map (cognitive 25) crates/wezterm-char-props/codegen/src/main.rs:74— wezterm_char_props_codegen::emit_variation_map has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (5 pts), match/switch 1 (5 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.
init.ensureDecoder::output (cognitive 25) crates/kaku-remote/assets/web/desktop.js:607— init.ensureDecoder::output has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init.onStatus (cognitive 25) crates/kaku-remote/assets/web/desktop.js:742— init.onStatus has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GlState::with_egl_lib (cognitive 24) window/src/egl.rs:392— GlState::with_egl_lib has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 3 (12 pts), if/else 5 (9 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
index.html.verify (cognitive 24) crates/kaku-remote/assets/web/index.html:1555— index.html.verify has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 1559). 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.
index.html.stage.addEventListener("contextmenu") (cognitive 24) crates/kaku-remote/assets/web/index.html:2832— index.html.stage.addEventListener("contextmenu") has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (7 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 6). Of this number, 13 points are the body's own statements and 11 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.
Helper::spawn (cognitive 23) crates/kaku-remote/src/desktop.rs:203— Helper::spawn has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineThinkFilter::feed (cognitive 23) kaku-gui/src/ai_client/think_filter.rs:49— InlineThinkFilter::feed has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (22 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.
TabRenameModal::compute (cognitive 23) kaku-gui/src/termwindow/tab_rename.rs:799— TabRenameModal::compute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.sendOnce (cognitive 23) crates/kaku-remote/assets/web/index.html:3769— index.html.sendOnce has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Error::possible_matches (cognitive 22) crates/wezterm-dynamic/src/error.rs:238— Error::possible_matches has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 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.
FreeTypeRasterizer::rasterize_mono (cognitive 22) crates/wezterm-font/src/rasterizer/freetype.rs:126— FreeTypeRasterizer::rasterize_mono has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 4 (11 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.
PaneSelector::perform_selection (cognitive 22) kaku-gui/src/termwindow/paneselect.rs:160— PaneSelector::perform_selection has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 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.
Mux::remove_window_internal (cognitive 22) mux/src/lib.rs:1323— Mux::remove_window_internal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (9 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
termwiz::caps::version_ge (cognitive 22) termwiz/src/caps/mod.rs:364— termwiz::caps::version_ge has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (16 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
desktop.init.onStatus (cognitive 22) crates/kaku-remote/assets/web/desktop.js:742— desktop.init.onStatus has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.handle (cognitive 22) crates/kaku-remote/assets/web/index.html:3869— index.html.handle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19 (22 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.
VTParser::action (cognitive 21) crates/vtparse/src/lib.rs:526— VTParser::action has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (6 pts), loops 1 (3 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.
OperatingSystemCommand::internal_parse (cognitive 21) crates/wezterm-escape-parser/src/osc.rs:257— OperatingSystemCommand::internal_parse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SelectionRange::cols_for_row (cognitive 21) kaku-gui/src/selection.rs:363— SelectionRange::cols_for_row has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Inner::run (cognitive 21) kaku-gui/src/stats.rs:146— Inner::run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (10 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CachedGradient::compute (cognitive 21) kaku-gui/src/termwindow/background.rs:37— CachedGradient::compute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 8). Of this number, 19 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.
termwiz_funcs::permute_mods (cognitive 21) lua-api-crates/termwiz-funcs/src/lib.rs:205— termwiz_funcs::permute_mods has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 1 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
LayoutState::update_widget_constraint (cognitive 21) termwiz/src/widgets/layout.rs:309— LayoutState::update_widget_constraint has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (15 pts), if/else 4, loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Window::new_window (cognitive 21) window/src/os/macos/window.rs:1763— Window::new_window has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
index.html.fit (cognitive 21) crates/kaku-remote/assets/web/index.html:1106— index.html.fit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Logger::log (cognitive 20) crates/env-bootstrap/src/ringlog.rs:160— Logger::log has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ITermFileData::parse (cognitive 20) crates/wezterm-escape-parser/src/osc.rs:1262— ITermFileData::parse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 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.
LocalPaneDCSHandler::handle_device_control (cognitive 20) mux/src/localpane.rs:996— LocalPaneDCSHandler::handle_device_control has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ColorPalette::from (cognitive 20) config/src/color.rs:313— ColorPalette::from has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), loops 5 (7 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
desktop.init.onFrame (cognitive 20) crates/kaku-remote/assets/web/desktop.js:671— desktop.init.onFrame has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 2, 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.
index.html.styleOf (cognitive 20) crates/kaku-remote/assets/web/index.html:1700— index.html.styleOf has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init.onFrame (cognitive 20) crates/kaku-remote/assets/web/desktop.js:671— init.onFrame has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 2, 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.
wezterm_escape_parser::tmux_cc::unvis_bytes::unvis_byte (cognitive 19) crates/wezterm-escape-parser/src/tmux_cc/mod.rs:538— wezterm_escape_parser::tmux_cc::unvis_bytes::unvis_byte has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 2 (3 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Events::run (cognitive 19) kaku/src/cli/events.rs:62— Events::run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.onFrame (cognitive 19) crates/kaku-remote/assets/web/index.html:3083— index.html.onFrame has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, ternaries 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.html.historySelection (cognitive 19) crates/kaku-remote/assets/web/index.html:3146— index.html.historySelection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KittyImageData::load_data (cognitive 18) crates/wezterm-escape-parser/src/apc.rs:177— KittyImageData::load_data has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 7). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (looks_like_temp_path, read_from_file). 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.
ToolState::load_with_usage (cognitive 18) kaku/src/ai_config/tui.rs:194— ToolState::load_with_usage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.html.renderPast (cognitive 18) crates/kaku-remote/assets/web/index.html:1639— index.html.renderPast has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 2, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.rowElement::put (cognitive 18) crates/kaku-remote/assets/web/index.html:1736— index.html.rowElement::put has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.window.addEventListener("keydown") (cognitive 18) crates/kaku-remote/assets/web/index.html:3632— index.html.window.addEventListener("keydown") has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 6, if/else 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.
ColorSchemeRegistry::load_scheme (cognitive 17) config/src/lib.rs:306— ColorSchemeRegistry::load_scheme has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Base91Decoder::write (cognitive 17) crates/base91/src/lib.rs:176— Base91Decoder::write has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts) (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
ProgramStatus::parse (cognitive 17) crates/wezterm-escape-parser/src/osc.rs:985— ProgramStatus::parse has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 6 (7 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser::process_guarded_line (cognitive 17) crates/wezterm-escape-parser/src/tmux_cc/mod.rs:883— Parser::process_guarded_line has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ZoomPane::run (cognitive 17) kaku/src/cli/zoom_pane.rs:33— ZoomPane::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), match/switch 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.
ColorEase::intensity_one_shot (cognitive 17) kaku-gui/src/colorease.rs:60— ColorEase::intensity_one_shot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LauncherArgs::new (cognitive 17) kaku-gui/src/overlay/launcher.rs:81— LauncherArgs::new has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Element::with_line (cognitive 17) kaku-gui/src/termwindow/box_model.rs:268— Element::with_line has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KeyTableState::lookup_key (cognitive 17) kaku-gui/src/termwindow/keyevent.rs:139— KeyTableState::lookup_key has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaneInputEncoder::encode (cognitive 17) mux/src/pane_encoding.rs:124— PaneInputEncoder::encode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PaneOutputDecoder::decode) 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.
PaneOutputDecoder::decode (cognitive 17) mux/src/pane_encoding.rs:231— PaneOutputDecoder::decode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (PaneInputEncoder::encode) 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.
ClientInner::expire_stale_mappings (cognitive 16) crates/wezterm-client/src/domain.rs:37— ClientInner::expire_stale_mappings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (7 pts), loops 3 (7 pts), match/switch 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CSIParser::sgr (cognitive 16) crates/wezterm-escape-parser/src/csi.rs:2686— CSIParser::sgr has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (12 pts), if/else 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SixelBuilder::finish_command (cognitive 16) crates/wezterm-escape-parser/src/parser/sixel.rs:96— SixelBuilder::finish_command has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Blob::from_source (cognitive 16) crates/wezterm-font/src/hbwrap.rs:86— Blob::from_source has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FallbackResolveInfo::process (cognitive 16) crates/wezterm-font/src/lib.rs:337— FallbackResolveInfo::process has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), match/switch 4 (5 pts), boolean chains 3, loops 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelWrap::exit_status (cognitive 16) crates/wezterm-ssh/src/channelwrap.rs:23— ChannelWrap::exit_status has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
MatchGroup::is_match (cognitive 16) crates/wezterm-ssh/src/config.rs:101— MatchGroup::is_match has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 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.
ChangeSequence::add (cognitive 16) crates/wezterm-surface/src/change.rs:215— ChangeSequence::add has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 3 (5 pts), loops 1 (2 pts) (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.
ListAllWindows::process_result (cognitive 16) mux/src/tmux_commands.rs:805— ListAllWindows::process_result has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resize::get_command (cognitive 16) mux/src/tmux_commands.rs:901— Resize::get_command has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 6, boolean chains 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.
desktop.init.finishPaste (cognitive 16) crates/kaku-remote/assets/web/desktop.js:1098— desktop.init.finishPaste has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.html.sendFile (cognitive 16) crates/kaku-remote/assets/web/index.html:3816— index.html.sendFile has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 3 (5 pts), error handling 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.connect::onMessage (cognitive 16) crates/kaku-remote/assets/web/index.html:4122— index.html.connect::onMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
init.finishPaste (cognitive 16) crates/kaku-remote/assets/web/desktop.js:1098— init.finishPaste has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
init.onKey (cognitive 16) crates/kaku-remote/assets/web/desktop.js:1215— init.onKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 16 points belong to 2 function literals inside it that branch (lines 1215, 1221). 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.
TooManyFunctions: kaku_remote::pairing crates/kaku-remote/src/pairing.rs:41— TooManyFunctions — 33 free functions. The bar is 30 free functions; this is 3 over it, 1.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.
Near-duplicate member pair (67 shared lines) kaku-gui/src/overlay/launcher.rs:406— kaku-gui/src/overlay/launcher.rs:406-542 | kaku-gui/src/overlay/selector.rs:94-205 — 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 (50 shared lines) kaku/src/ai_config/tui/ui.rs:358— kaku/src/ai_config/tui/ui.rs:358-430 | kaku/src/config_tui/ui.rs:443-513 — 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 (48 shared lines) crates/luahelper/src/lib.rs:111— crates/luahelper/src/lib.rs:111-248 | lua-api-crates/share-data/src/lib.rs:101-240 — These two members are variants of one another: 48 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 (43 shared lines) kaku-gui/src/ai_tools/search.rs:564— kaku-gui/src/ai_tools/search.rs:564-731 | kaku-gui/src/ai_tools/search.rs:743-935 — These two members are variants of one another: 43 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 (36 shared lines) kaku/src/ai_config/tui/ui.rs:432— kaku/src/ai_config/tui/ui.rs:432-538 | kaku/src/config_tui/ui.rs:367-441 — These two members are variants of one another: 36 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 (33 shared lines) kaku-gui/src/termwindow/charselect.rs:388— kaku-gui/src/termwindow/charselect.rs:388-548 | kaku-gui/src/termwindow/paneselect.rs:57-158 — These two members are variants of one another: 33 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) kaku/src/cli/activate_tab.rs:48— kaku/src/cli/activate_tab.rs:48-158 | kaku/src/cli/rename_workspace.rs:26-63 | kaku/src/cli/set_tab_title.rs:25-67 | kaku/src/cli/set_window_title.rs:26-63 | kaku/src/cli/zoom_pane.rs:33-87 — 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· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) config/derive/src/attr.rs:15— config/derive/src/attr.rs:15-61 | config/derive/src/attr.rs:131-279 | crates/wezterm-dynamic/derive/src/attr.rs:11-57 | crates/wezterm-dynamic/derive/src/attr.rs:281-372 — 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 (143 corresponding lines) · ×1
Edited copy of a member (143 corresponding lines) kaku-gui/src/overlay/launcher.rs:624— kaku-gui/src/overlay/launcher.rs:624-772 | kaku-gui/src/overlay/selector.rs:242-384 — These two members are one piece of code written twice and then edited apart: 143 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (87 corresponding lines) · ×1
Edited copy of a member (87 corresponding lines) mux/src/tmux_commands.rs:695— mux/src/tmux_commands.rs:695-782 | mux/src/tmux_commands.rs:805-891 — These two members are one piece of code written twice and then edited apart: 87 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (66 corresponding lines) · ×1
Edited copy of a member (66 corresponding lines) term/src/screen.rs:621— term/src/screen.rs:621-694 | term/src/screen.rs:898-963 — These two members are one piece of code written twice and then edited apart: 66 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) kaku-gui/src/overlay/copy.rs:306— kaku-gui/src/overlay/copy.rs:306-371 | kaku-gui/src/overlay/copy.rs:378-433 — 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 (61 corresponding lines) · ×1
Edited copy of a member (61 corresponding lines) kaku/src/ai_config/tui/providers/mod.rs:1648— kaku/src/ai_config/tui/providers/mod.rs:1648-1712 | kaku/src/ai_config/tui/providers/mod.rs:1868-1928 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) kaku/src/ai_config/tui/ui.rs:17— kaku/src/ai_config/tui/ui.rs:17-77 | kaku/src/config_tui/ui.rs:97-156 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) crates/wezterm-font/src/rasterizer/freetype.rs:217— crates/wezterm-font/src/rasterizer/freetype.rs:217-262 | crates/wezterm-font/src/rasterizer/freetype.rs:270-315 — 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 (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) crates/wezterm-font/src/rasterizer/freetype.rs:467— crates/wezterm-font/src/rasterizer/freetype.rs:467-509 | crates/wezterm-font/src/rasterizer/harfbuzz.rs:41-101 — 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 (82 corresponding lines) · ×1
Edited copy of a member (82 corresponding lines) crates/wezterm-ssh/src/pty.rs:212— crates/wezterm-ssh/src/pty.rs:212-314 | crates/wezterm-ssh/src/sessioninner.rs:901-982 — These two members are one piece of code written twice and then edited apart: 82 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) mux/src/pane_encoding.rs:124— mux/src/pane_encoding.rs:124-166 | mux/src/pane_encoding.rs:231-272 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (51 corresponding lines) · ×1
Edited copy of a member (51 corresponding lines) kaku-gui/src/ai_client/mod.rs:344— kaku-gui/src/ai_client/mod.rs:344-405 | kaku-gui/src/ai_client/transport.rs:278-328 — 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 (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) crates/wezterm-surface/src/line/clusterline.rs:184— crates/wezterm-surface/src/line/clusterline.rs:184-224 | crates/wezterm-surface/src/line/clusterline.rs:226-269 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) kaku-gui/src/ai_chat_engine/mod.rs:1085— kaku-gui/src/ai_chat_engine/mod.rs:1085-1122 | kaku-gui/src/overlay/ai_chat/state.rs:1770-1817 — 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 (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) crates/codec/src/lib.rs:179— crates/codec/src/lib.rs:179-237 | crates/codec/src/lib.rs:241-284 — 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 (31 corresponding lines) · ×1
Edited copy of a member (31 corresponding lines) kaku/src/config_tui/mod.rs:1399— kaku/src/config_tui/mod.rs:1399-1429 | kaku/src/reset.rs:673-706 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) mux/src/tab.rs:973— mux/src/tab.rs:973-1019 | mux/src/tab.rs:1029-1080 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) mux/src/tab.rs:1502— mux/src/tab.rs:1502-1546 | mux/src/tab.rs:1548-1592 — 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 (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) mux/src/tab.rs:1780— mux/src/tab.rs:1780-1819 | mux/src/tab.rs:1823-1858 — 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 (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) config/src/lua.rs:673— config/src/lua.rs:673-709 | config/src/lua.rs:721-759 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) kaku-gui/src/session_restore.rs:1099— kaku-gui/src/session_restore.rs:1099-1134 | kaku-gui/src/session_restore.rs:1142-1173 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) kaku-gui/src/overlay/launcher.rs:182— kaku-gui/src/overlay/launcher.rs:182-216 | kaku-gui/src/overlay/selector.rs:57-92 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 33+ corresponding lines) · ×1
Edited copies of one member (3 members, 33+ corresponding lines) kaku-gui/src/termwindow/mod.rs:6148— kaku-gui/src/termwindow/mod.rs:6148-6187 | kaku-gui/src/termwindow/mod.rs:6290-6331 | kaku-gui/src/termwindow/mod.rs:6333-6365 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 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, 23+ corresponding lines) · ×1
Edited copies of one member (3 members, 23+ corresponding lines) crates/wezterm-ssh/src/sftp/file.rs:194— crates/wezterm-ssh/src/sftp/file.rs:194-225 | crates/wezterm-ssh/src/sftp/file.rs:227-254 | crates/wezterm-ssh/src/sftp/file.rs:256-278 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 24+ corresponding lines) · ×1
Edited copies of one member (3 members, 24+ corresponding lines) kaku-gui/src/update.rs:173— kaku-gui/src/update.rs:173-196 | kaku-gui/src/update.rs:321-346 | kaku-gui/src/update.rs:348-374 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×1
Edited copy of a member (24 corresponding lines) crates/wezterm-escape-parser/src/apc.rs:780— crates/wezterm-escape-parser/src/apc.rs:780-804 | crates/wezterm-escape-parser/src/apc.rs:861-884 — 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 copies of one member (4 members, 16+ corresponding lines) · ×1
Edited copies of one member (4 members, 16+ corresponding lines) kaku-gui/src/termwindow/mod.rs:4392— kaku-gui/src/termwindow/mod.rs:4392-4416 | kaku-gui/src/termwindow/mod.rs:4418-4440 | kaku-gui/src/termwindow/mod.rs:4442-4465 | kaku-gui/src/termwindow/mod.rs:4471-4486 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×1
Edited copies of one member (3 members, 20+ corresponding lines) kaku/src/ai_config/tui/providers/mod.rs:468— kaku/src/ai_config/tui/providers/mod.rs:468-490 | kaku/src/ai_config/tui/providers/mod.rs:1538-1564 | kaku/src/ai_config/tui/providers/mod.rs:1595-1614 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×1
Edited copy of a member (18 corresponding lines) kaku-gui/src/termwindow/tab_rename.rs:314— kaku-gui/src/termwindow/tab_rename.rs:314-332 | kaku-gui/src/termwindow/tab_rename.rs:334-351 — 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 copies of one member (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) mux/src/renderable.rs:112— mux/src/renderable.rs:112-128 | mux/src/renderable.rs:135-151 | mux/src/renderable.rs:157-173 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×1
Edited copies of one member (4 members, 15+ corresponding lines) window/src/os/macos/app.rs:1474— window/src/os/macos/app.rs:1474-1498 | window/src/os/macos/app.rs:1500-1514 | window/src/os/macos/app.rs:1516-1530 | window/src/os/macos/app.rs:1532-1546 — 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 (25 corresponding lines) · ×1
Edited copy of a member (25 corresponding lines) crates/bintree/src/lib.rs:473— crates/bintree/src/lib.rs:473-497 | crates/bintree/src/lib.rs:507-531 — 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 copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) termwiz/src/render/terminfo.rs:244— termwiz/src/render/terminfo.rs:244-253 | termwiz/src/render/terminfo.rs:255-264 | termwiz/src/render/terminfo.rs:274-283 | termwiz/src/render/terminfo.rs:285-294 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×1
Edited copies of one member (3 members, 19+ corresponding lines) crates/color-types/src/lib.rs:449— crates/color-types/src/lib.rs:449-467 | crates/wezterm-input-types/src/lib.rs:1183-1201 | crates/wezterm-input-types/src/lib.rs:1203-1221 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 9+ corresponding lines) · ×1
Edited copies of one member (4 members, 9+ corresponding lines) crates/wezterm-ssh/src/sftpwrap.rs:61— crates/wezterm-ssh/src/sftpwrap.rs:61-69 | crates/wezterm-ssh/src/sftpwrap.rs:91-99 | crates/wezterm-ssh/src/sftpwrap.rs:101-109 | crates/wezterm-ssh/src/sftpwrap.rs:169-180 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) crates/wezterm-escape-parser/src/csi.rs:1762— crates/wezterm-escape-parser/src/csi.rs:1762-1768 | crates/wezterm-escape-parser/src/lib.rs:568-578 | crates/wezterm-escape-parser/src/lib.rs:582-592 — 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 (4 members, 12+ corresponding lines) · ×1
Edited copies of one member (4 members, 12+ corresponding lines) crates/wezterm-ssh/src/sftp/dir.rs:59— crates/wezterm-ssh/src/sftp/dir.rs:59-71 | crates/wezterm-ssh/src/sftp/file.rs:93-110 | crates/wezterm-ssh/src/sftp/file.rs:115-126 | crates/wezterm-ssh/src/sftp/file.rs:132-144 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×1
Edited copies of one member (3 members, 13+ corresponding lines) crates/wezterm-surface/src/line/line.rs:76— crates/wezterm-surface/src/line/line.rs:76-88 | crates/wezterm-surface/src/line/line.rs:134-146 | crates/wezterm-surface/src/line/line.rs:660-675 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×1
Edited copies of one member (3 members, 14+ corresponding lines) crates/wezterm-escape-parser/src/tmux_cc/mod.rs:148— crates/wezterm-escape-parser/src/tmux_cc/mod.rs:148-161 | crates/wezterm-escape-parser/src/tmux_cc/mod.rs:163-179 | crates/wezterm-escape-parser/src/tmux_cc/mod.rs:181-197 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (8 members, 11+ corresponding lines) · ×1
Edited copies of one member (8 members, 11+ corresponding lines) crates/wezterm-ssh/src/sftp/mod.rs:128— crates/wezterm-ssh/src/sftp/mod.rs:128-139 | crates/wezterm-ssh/src/sftp/mod.rs:152-162 | crates/wezterm-ssh/src/sftp/mod.rs:189-199 | crates/wezterm-ssh/src/sftp/mod.rs:206-216 | crates/wezterm-ssh/src/sftp/mod.rs:223-233 | crates/wezterm-ssh/src/sftp/mod.rs:282-292 | crates/wezterm-ssh/src/sftp/mod.rs:299-309 | crates/wezterm-ssh/src/sftp/mod.rs:344-354 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) crates/wezterm-font/src/ftwrap.rs:636— crates/wezterm-font/src/ftwrap.rs:636-651 | crates/wezterm-font/src/ftwrap.rs:656-666 | crates/wezterm-font/src/ftwrap.rs:668-678 | crates/wezterm-font/src/ftwrap.rs:805-815 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) kaku-gui/src/ai_client/assistant_config.rs:322— kaku-gui/src/ai_client/assistant_config.rs:322-328 | kaku-gui/src/ai_conversations.rs:83-89 | kaku-gui/src/ai_state.rs:108-114 | kaku/src/assistant_config.rs:36-42 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Duplicated block (10–88 lines × 2) kaku-gui/src/customglyph.rs:756— kaku-gui/src/customglyph.rs:756-765 | kaku-gui/src/customglyph.rs:2150-2237 — both copies are in the same file, so extract the 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 `kaku-gui/src/customglyph.rs:756` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/customglyph.rs:2147` calls `MoveTo`, `Frac`, `LineTo` and `kaku-gui/src/customglyph.rs:754` 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 (83–87 lines × 5) kaku-gui/src/customglyph.rs:1283— kaku-gui/src/customglyph.rs:1283-1366 | kaku-gui/src/customglyph.rs:1426-1508 | kaku-gui/src/customglyph.rs:1567-1651 | kaku-gui/src/customglyph.rs:1709-1793 | kaku-gui/src/customglyph.rs:1851-1937 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:1283` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/customglyph.rs:1280` calls `MoveTo`, `Frac`, `LineTo` and `kaku-gui/src/customglyph.rs:1849` 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–85 lines × 3) kaku-gui/src/customglyph.rs:758— kaku-gui/src/customglyph.rs:758-765 | kaku-gui/src/customglyph.rs:2152-2234 | kaku-gui/src/customglyph.rs:3555-3639 — 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 `kaku-gui/src/customglyph.rs:758` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (67–69 lines × 3) kaku-gui/src/customglyph.rs:1628— kaku-gui/src/customglyph.rs:1628-1694 | kaku-gui/src/customglyph.rs:1770-1836 | kaku-gui/src/customglyph.rs:2080-2148 — 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 `kaku-gui/src/customglyph.rs:1628` 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–59 lines × 2) kaku-gui/src/customglyph.rs:4629— kaku-gui/src/customglyph.rs:4629-4687 | kaku-gui/src/customglyph.rs:4744-4771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/customglyph.rs:4773` calls `Triangles` and `kaku-gui/src/customglyph.rs:4689` 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 (50 lines × 4) kaku-gui/src/customglyph.rs:1022— kaku-gui/src/customglyph.rs:1022-1071 | kaku-gui/src/customglyph.rs:1087-1136 | kaku-gui/src/customglyph.rs:1152-1201 | kaku-gui/src/customglyph.rs:1217-1266 — 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 `kaku-gui/src/customglyph.rs:1022` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6–48 lines × 4) kaku-gui/src/customglyph.rs:1014— kaku-gui/src/customglyph.rs:1014-1019 | kaku-gui/src/customglyph.rs:1026-1073 | kaku-gui/src/customglyph.rs:1091-1138 | kaku-gui/src/customglyph.rs:3390-3396 — 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 `kaku-gui/src/customglyph.rs:1014` 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 (46–48 lines × 4) kaku-gui/src/customglyph.rs:1156— kaku-gui/src/customglyph.rs:1156-1203 | kaku-gui/src/customglyph.rs:1221-1268 | kaku-gui/src/customglyph.rs:1364-1409 | kaku-gui/src/customglyph.rs:1506-1551 — 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 `kaku-gui/src/customglyph.rs:1156` 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, `kaku-gui/src/customglyph.rs:1411` calls `LineTo`, `Frac` and `kaku-gui/src/customglyph.rs:1205` 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 (46 lines × 2) config/derive/src/attr.rs:16— config/derive/src/attr.rs:16-61 | crates/wezterm-dynamic/derive/src/attr.rs:12-57 — before extracting anything, compare `config/derive/src/attr.rs` and `crates/wezterm-dynamic/derive/src/attr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (44 lines × 3) kaku-gui/src/customglyph.rs:1020— kaku-gui/src/customglyph.rs:1020-1068 | kaku-gui/src/customglyph.rs:1150-1198 | kaku-gui/src/customglyph.rs:1281-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. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:1020` 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 (42 lines × 2) crates/wezterm-escape-parser/src/csi.rs:689— crates/wezterm-escape-parser/src/csi.rs:689-730 | crates/wezterm-escape-parser/src/csi.rs:732-773 — both copies are in the same file, so extract the 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 `crates/wezterm-escape-parser/src/csi.rs:689` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16–42 lines × 2) kaku-gui/src/customglyph.rs:4290— kaku-gui/src/customglyph.rs:4290-4305 | kaku-gui/src/customglyph.rs:4337-4378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41 lines × 2) crates/wezterm-font/src/rasterizer/freetype.rs:469— crates/wezterm-font/src/rasterizer/freetype.rs:469-509 | crates/wezterm-font/src/rasterizer/harfbuzz.rs:61-101 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-font/src/rasterizer/freetype.rs:469` 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 (39 lines × 2) kaku-gui/src/overlay/launcher.rs:701— kaku-gui/src/overlay/launcher.rs:701-739 | kaku-gui/src/overlay/selector.rs:314-352 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:701` 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 (36–37 lines × 2) term/src/screen.rs:643— term/src/screen.rs:643-679 | term/src/screen.rs:913-948 — both copies are in the same file, so extract the 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 `term/src/screen.rs:643` 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 (34 lines × 2) kaku-gui/src/overlay/launcher.rs:642— kaku-gui/src/overlay/launcher.rs:642-675 | kaku-gui/src/overlay/selector.rs:260-293 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:642` 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, `kaku-gui/src/overlay/launcher.rs:676` calls `Some`, `close_tab_action`, `Ok` and `kaku-gui/src/overlay/selector.rs: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 (33 lines × 2) crates/wezterm-font/src/rasterizer/freetype.rs:230— crates/wezterm-font/src/rasterizer/freetype.rs:230-262 | crates/wezterm-font/src/rasterizer/freetype.rs:283-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-font/src/rasterizer/freetype.rs:230` 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–31 lines × 2) kaku/src/ai_config/tui.rs:3007— kaku/src/ai_config/tui.rs:3007-3035 | kaku/src/ai_config/tui/providers/codex.rs:332-362 — 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 (27–29 lines × 2) mux/src/tab.rs:1511— mux/src/tab.rs:1511-1539 | mux/src/tab.rs:1557-1583 — both copies are in the same file, so extract the 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 `mux/src/tab.rs:1511` 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, `mux/src/tab.rs:1542` calls `apply_sizes_from_splits`, `as_mut`, `unwrap` and `mux/src/tab.rs:1589` 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 (24–28 lines × 2) mux/src/tab.rs:1675— mux/src/tab.rs:1675-1702 | mux/src/tab.rs:1708-1731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 4) kaku-gui/src/customglyph.rs:3752— kaku-gui/src/customglyph.rs:3752-3775 | kaku-gui/src/customglyph.rs:3881-3904 | kaku-gui/src/customglyph.rs:4072-4095 | kaku-gui/src/customglyph.rs:4201-4224 — 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 `kaku-gui/src/customglyph.rs:3752` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17–24 lines × 4) kaku-gui/src/customglyph.rs:4646— kaku-gui/src/customglyph.rs:4646-4662 | kaku-gui/src/customglyph.rs:4667-4690 | kaku-gui/src/customglyph.rs:4697-4719 | kaku-gui/src/customglyph.rs:4749-4765 — 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 `kaku-gui/src/customglyph.rs:4646` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/customglyph.rs:4664` calls `LineTo`, `Frac` and `kaku-gui/src/customglyph.rs:4746` 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 (22–24 lines × 2) kaku-gui/src/overlay/launcher.rs:497— kaku-gui/src/overlay/launcher.rs:497-518 | kaku-gui/src/overlay/selector.rs:159-182 — before extracting anything, compare `kaku-gui/src/overlay/launcher.rs` and `kaku-gui/src/overlay/selector.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 176 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/overlay/launcher.rs:497` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–23 lines × 2) mux/src/tab.rs:1782— mux/src/tab.rs:1782-1804 | mux/src/tab.rs:1824-1844 — both copies are in the same file, so extract the 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 `mux/src/tab.rs:1782` 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 (21–22 lines × 2) kaku-gui/src/customglyph.rs:4030— kaku-gui/src/customglyph.rs:4030-4051 | kaku-gui/src/customglyph.rs:4053-4073 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) kaku/src/ai_config/tui/ui.rs:449— kaku/src/ai_config/tui/ui.rs:449-469 | kaku/src/config_tui/ui.rs:377-397 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `kaku/src/ai_config/tui/ui.rs:449` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–21 lines × 2) kaku/src/doctor.rs:1079— kaku/src/doctor.rs:1079-1099 | kaku/src/doctor.rs:1130-1143 — both copies are in the same file, so extract the 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 `kaku/src/doctor.rs:1079` 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 (20 lines × 2) kaku-gui/src/glyphcache.rs:576— kaku-gui/src/glyphcache.rs:576-595 | kaku-gui/src/glyphcache.rs:605-624 — both copies are in the same file, so extract the 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 `kaku-gui/src/glyphcache.rs:576` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 8) kaku-gui/src/customglyph.rs:3727— kaku-gui/src/customglyph.rs:3727-3745 | kaku-gui/src/customglyph.rs:3749-3767 | kaku-gui/src/customglyph.rs:3856-3874 | kaku-gui/src/customglyph.rs:3878-3896 | kaku-gui/src/customglyph.rs:4047-4065 | kaku-gui/src/customglyph.rs:4069-4087 | kaku-gui/src/customglyph.rs:4176-4194 | kaku-gui/src/customglyph.rs:4198-4216 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:3727` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 6) kaku-gui/src/customglyph.rs:3753— kaku-gui/src/customglyph.rs:3753-3773 | kaku-gui/src/customglyph.rs:3882-3902 | kaku-gui/src/customglyph.rs:4073-4093 | kaku-gui/src/customglyph.rs:4202-4222 | kaku-gui/src/customglyph.rs:4648-4667 | kaku-gui/src/customglyph.rs:4751-4769 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:3753` 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, `kaku-gui/src/customglyph.rs:4773` calls `Triangles` and `kaku-gui/src/customglyph.rs:3777` 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 (18 lines × 6) kaku-gui/src/customglyph.rs:5833— kaku-gui/src/customglyph.rs:5833-5852 | kaku-gui/src/customglyph.rs:5863-5886 | kaku-gui/src/customglyph.rs:5897-5922 | kaku-gui/src/customglyph.rs:5933-5950 | kaku-gui/src/customglyph.rs:5961-5986 | kaku-gui/src/customglyph.rs:5995-6016 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:5833` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18 lines × 3) kaku-gui/src/customglyph.rs:3447— kaku-gui/src/customglyph.rs:3447-3464 | kaku-gui/src/customglyph.rs:4638-4657 | kaku-gui/src/customglyph.rs:4659-4685 — 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 `kaku-gui/src/customglyph.rs:3447` 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 (3–18 lines × 3) kaku-gui/src/overlay/copy.rs:290— kaku-gui/src/overlay/copy.rs:290-292 | kaku-gui/src/overlay/copy.rs:338-355 | kaku-gui/src/overlay/copy.rs:405-422 — 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 `kaku-gui/src/overlay/copy.rs:290` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 7) kaku-gui/src/customglyph.rs:3755— kaku-gui/src/customglyph.rs:3755-3773 | kaku-gui/src/customglyph.rs:3884-3902 | kaku-gui/src/customglyph.rs:4075-4093 | kaku-gui/src/customglyph.rs:4204-4222 | kaku-gui/src/customglyph.rs:4629-4646 | kaku-gui/src/customglyph.rs:4650-4667 | kaku-gui/src/customglyph.rs:4753-4769 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:3755` 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, `kaku-gui/src/customglyph.rs:4773` calls `Triangles` and `kaku-gui/src/customglyph.rs:3777` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 3) crates/wezterm-escape-parser/src/csi.rs:2506— crates/wezterm-escape-parser/src/csi.rs:2506-2522 | crates/wezterm-escape-parser/src/csi.rs:2523-2539 | crates/wezterm-escape-parser/src/csi.rs:2551-2567 — 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 `crates/wezterm-escape-parser/src/csi.rs:2506` 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, `crates/wezterm-escape-parser/src/csi.rs:2504` calls `P`, `Integer` and `crates/wezterm-escape-parser/src/csi.rs:2550` 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 (16 lines × 7) kaku-gui/src/customglyph.rs:3730— kaku-gui/src/customglyph.rs:3730-3745 | kaku-gui/src/customglyph.rs:3836-3852 | kaku-gui/src/customglyph.rs:3859-3874 | kaku-gui/src/customglyph.rs:4027-4043 | kaku-gui/src/customglyph.rs:4050-4065 | kaku-gui/src/customglyph.rs:4156-4172 | kaku-gui/src/customglyph.rs:4179-4194 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:3730` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–16 lines × 3) crates/wezterm-ssh/src/sftp/file.rs:156— crates/wezterm-ssh/src/sftp/file.rs:156-168 | crates/wezterm-ssh/src/sftp/file.rs:200-215 | crates/wezterm-ssh/src/sftp/file.rs:232-244 — 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 `crates/wezterm-ssh/src/sftp/file.rs:200` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) kaku-gui/src/termwindow/mod.rs:6316— kaku-gui/src/termwindow/mod.rs:6316-6331 | kaku-gui/src/termwindow/mod.rs:6352-6365 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/mod.rs:6316` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/termwindow/mod.rs:6312` calls `activate_tab`, `is_err` and `kaku-gui/src/termwindow/mod.rs:6348` 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 × 5) kaku-gui/src/customglyph.rs:3837— kaku-gui/src/customglyph.rs:3837-3852 | kaku-gui/src/customglyph.rs:3860-3874 | kaku-gui/src/customglyph.rs:4157-4172 | kaku-gui/src/customglyph.rs:4180-4194 | kaku-gui/src/customglyph.rs:4699-4719 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:3837` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 4) kaku-gui/src/customglyph.rs:3450— kaku-gui/src/customglyph.rs:3450-3464 | kaku-gui/src/customglyph.rs:4640-4657 | kaku-gui/src/customglyph.rs:4661-4685 | kaku-gui/src/customglyph.rs:4744-4760 — 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 `kaku-gui/src/customglyph.rs:3450` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `kaku-gui/src/customglyph.rs:4742` calls `Triangles` and `kaku-gui/src/customglyph.rs:3447` 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 (13–15 lines × 2) kaku-gui/src/termwindow/mod.rs:4182— kaku-gui/src/termwindow/mod.rs:4182-4194 | kaku/src/cli/activate_tab.rs:120-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–14 lines × 2) window/src/os/macos/window.rs:9320— window/src/os/macos/window.rs:9320-9333 | window/src/os/macos/window.rs:9393-9404 — both copies are in the same file, so extract the 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 `window/src/os/macos/window.rs:9320` 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, `window/src/os/macos/window.rs:9389` calls `settle_windowed_screen_state` and `window/src/os/macos/window.rs:9316` 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 (12–13 lines × 2) crates/wezterm-dynamic/derive/src/attr.rs:173— crates/wezterm-dynamic/derive/src/attr.rs:173-185 | crates/wezterm-dynamic/derive/src/attr.rs:201-212 — both copies are in the same file, so extract the 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 `crates/wezterm-dynamic/derive/src/attr.rs:173` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/wezterm-dynamic/derive/src/attr.rs:199` calls `unwrap_or` and `crates/wezterm-dynamic/derive/src/attr.rs:171` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–13 lines × 2) kaku-gui/src/termwindow/box_model.rs:692— kaku-gui/src/termwindow/box_model.rs:692-704 | kaku-gui/src/termwindow/box_model.rs:827-837 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/box_model.rs:692` 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 × 4) config/derive/src/attr.rs:37— config/derive/src/attr.rs:37-48 | config/derive/src/attr.rs:226-237 | crates/wezterm-dynamic/derive/src/attr.rs:33-44 | crates/wezterm-dynamic/derive/src/attr.rs:322-333 — before extracting anything, compare `config/derive/src/attr.rs` and `crates/wezterm-dynamic/derive/src/attr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11–12 lines × 2) kaku/src/ai_config/tui/ui.rs:18— kaku/src/ai_config/tui/ui.rs:18-29 | kaku/src/config_tui/ui.rs:98-108 — before extracting anything, compare `kaku/src/ai_config/tui/ui.rs` and `kaku/src/config_tui/ui.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire 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 × 7) kaku-gui/src/customglyph.rs:5780— kaku-gui/src/customglyph.rs:5780-5790 | kaku-gui/src/customglyph.rs:5820-5830 | kaku-gui/src/customglyph.rs:5850-5860 | kaku-gui/src/customglyph.rs:5884-5894 | kaku-gui/src/customglyph.rs:5920-5930 | kaku-gui/src/customglyph.rs:5948-5958 | kaku-gui/src/customglyph.rs:5984-5994 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:5780` 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–11 lines × 3) kaku/src/ai_config/tui.rs:2825— kaku/src/ai_config/tui.rs:2825-2834 | kaku/src/ai_config/tui.rs:2836-2845 | kaku/src/ai_config/tui.rs:2930-2940 — 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 `kaku/src/ai_config/tui.rs:2930` 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–11 lines × 2) crates/wezterm-font/src/ftwrap.rs:1355— crates/wezterm-font/src/ftwrap.rs:1355-1363 | crates/wezterm-font/src/hbwrap.rs:90-100 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-font/src/hbwrap.rs: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 (9–10 lines × 5) crates/wezterm-mux-server-impl/src/sessionhandler.rs:434— crates/wezterm-mux-server-impl/src/sessionhandler.rs:434-442 | crates/wezterm-mux-server-impl/src/sessionhandler.rs:472-480 | crates/wezterm-mux-server-impl/src/sessionhandler.rs:492-500 | crates/wezterm-mux-server-impl/src/sessionhandler.rs:661-670 | crates/wezterm-mux-server-impl/src/sessionhandler.rs:692-700 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-mux-server-impl/src/sessionhandler.rs:434` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 3) crates/wezterm-dynamic/derive/src/attr.rs:145— crates/wezterm-dynamic/derive/src/attr.rs:145-154 | crates/wezterm-dynamic/derive/src/attr.rs:172-180 | crates/wezterm-dynamic/derive/src/attr.rs:200-208 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-dynamic/derive/src/attr.rs:145` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/wezterm-dynamic/derive/src/attr.rs:199` calls `unwrap_or` and `crates/wezterm-dynamic/derive/src/attr.rs:144` 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 × 3) kaku-gui/src/termwindow/charselect.rs:522— kaku-gui/src/termwindow/charselect.rs:522-531 | kaku-gui/src/termwindow/palette.rs:771-780 | kaku-gui/src/termwindow/paneselect.rs:125-134 — before extracting anything, compare `kaku-gui/src/termwindow/charselect.rs` and `kaku-gui/src/termwindow/paneselect.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/termwindow/charselect.rs:522` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) kaku-gui/src/glyphcache.rs:1208— kaku-gui/src/glyphcache.rs:1208-1217 | kaku-gui/src/glyphcache.rs:1231-1239 — both copies are in the same file, so extract the 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 `kaku-gui/src/glyphcache.rs:1208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–8 lines × 2) crates/wezterm-client/src/domain.rs:918— crates/wezterm-client/src/domain.rs:918-925 | mux/src/domain.rs:195-200 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/wezterm-client/src/domain.rs:918` 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 (14–15 lines × 2) kaku/src/ai_config/tui.rs:2537— kaku/src/ai_config/tui.rs:2537-2550 | kaku/src/ai_config/tui.rs:2598-2612 — both copies are in the same file, so extract the 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 `kaku/src/ai_config/tui.rs:2537` 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 × 6) kaku-gui/src/customglyph.rs:740— kaku-gui/src/customglyph.rs:740-746 | kaku-gui/src/customglyph.rs:1141-1148 | kaku-gui/src/customglyph.rs:1206-1213 | kaku-gui/src/customglyph.rs:1414-1420 | kaku-gui/src/customglyph.rs:3528-3534 | kaku-gui/src/customglyph.rs:4831-4837 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:740` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `kaku-gui/src/customglyph.rs:1421` calls `LineTo`, `Frac` and `kaku-gui/src/customglyph.rs:747` 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 × 3) kaku/src/reset.rs:458— kaku/src/reset.rs:458-464 | kaku/src/reset.rs:547-553 | kaku/src/reset.rs:649-655 — 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. 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 (4–7 lines × 3) crates/luahelper/src/lib.rs:133— crates/luahelper/src/lib.rs:133-139 | lua-api-crates/serde-funcs/src/lib.rs:178-181 | lua-api-crates/share-data/src/lib.rs:123-129 — before extracting anything, compare `crates/luahelper/src/lib.rs` and `lua-api-crates/share-data/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `crates/luahelper/src/lib.rs:133` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 8) kaku-gui/src/customglyph.rs:1143— kaku-gui/src/customglyph.rs:1143-1149 | kaku-gui/src/customglyph.rs:1208-1214 | kaku-gui/src/customglyph.rs:1416-1421 | kaku-gui/src/customglyph.rs:3419-3424 | kaku-gui/src/customglyph.rs:3433-3438 | kaku-gui/src/customglyph.rs:3494-3499 | kaku-gui/src/customglyph.rs:3530-3535 | kaku-gui/src/customglyph.rs:4833-4838 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:1143` 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, `kaku-gui/src/customglyph.rs:1423` calls `LineTo`, `Frac` and `kaku-gui/src/customglyph.rs:1151` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 7) kaku-gui/src/customglyph.rs:760— kaku-gui/src/customglyph.rs:760-765 | kaku-gui/src/customglyph.rs:1285-1384 | kaku-gui/src/customglyph.rs:1428-1526 | kaku-gui/src/customglyph.rs:1569-1669 | kaku-gui/src/customglyph.rs:1711-1811 | kaku-gui/src/customglyph.rs:1853-1956 | kaku-gui/src/customglyph.rs:2154-2237 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/customglyph.rs:760` 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 × 6) kaku-gui/src/overlay/ai_chat/render.rs:420— kaku-gui/src/overlay/ai_chat/render.rs:420-425 | kaku-gui/src/overlay/ai_chat/render.rs:526-531 | kaku-gui/src/overlay/ai_chat/render.rs:575-580 | kaku-gui/src/overlay/ai_chat/render.rs:657-662 | kaku-gui/src/overlay/ai_chat/render.rs:787-792 | kaku-gui/src/overlay/ai_chat/render.rs:852-857 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) kaku-gui/src/customglyph.rs:1078— kaku-gui/src/customglyph.rs:1078-1084 | kaku-gui/src/customglyph.rs:3405-3410 | kaku-gui/src/customglyph.rs:3512-3517 | kaku-gui/src/customglyph.rs:3548-3553 — 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 `kaku-gui/src/customglyph.rs:1078` 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, `kaku-gui/src/customglyph.rs:1085` calls `LineTo`, `Frac` and `kaku-gui/src/customglyph.rs:3518` 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–6 lines × 2) kaku-gui/src/termwindow/tab_rename.rs:769— kaku-gui/src/termwindow/tab_rename.rs:769-774 | kaku-gui/src/termwindow/tab_rename.rs:778-782 — both copies are in the same file, so extract the 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 `kaku-gui/src/termwindow/tab_rename.rs:769` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (24 lines × 2) crates/luahelper/src/lib.rs:164— crates/luahelper/src/lib.rs:164-187 | lua-api-crates/share-data/src/lib.rs:154-177 — before extracting anything, compare `crates/luahelper/src/lib.rs` and `lua-api-crates/share-data/src/lib.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `crates/luahelper/src/lib.rs:164` 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 × 6) kaku/src/ai_config/tui.rs:1094— kaku/src/ai_config/tui.rs:1094-1104 | kaku/src/ai_config/tui.rs:1266-1276 | kaku/src/ai_config/tui/providers/mod.rs:473-483 | kaku/src/ai_config/tui/providers/mod.rs:1458-1468 | kaku/src/ai_config/tui/providers/mod.rs:1548-1558 | kaku/src/ai_config/tui/providers/mod.rs:1600-1610 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 4) kaku-gui/src/scripting/guiwin.rs:210— kaku-gui/src/scripting/guiwin.rs:210-218 | kaku-gui/src/scripting/guiwin.rs:224-232 | kaku-gui/src/scripting/guiwin.rs:242-250 | kaku-gui/src/scripting/guiwin.rs:256-264 — 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 `kaku-gui/src/scripting/guiwin.rs:210` 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 (5 lines × 6) kaku-gui/src/scripting/guiwin.rs:203— kaku-gui/src/scripting/guiwin.rs:203-207 | kaku-gui/src/scripting/guiwin.rs:217-221 | kaku-gui/src/scripting/guiwin.rs:231-235 | kaku-gui/src/scripting/guiwin.rs:249-253 | kaku-gui/src/scripting/guiwin.rs:263-267 | kaku-gui/src/scripting/guiwin.rs:278-282 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `kaku-gui/src/scripting/guiwin.rs:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
End-of-life runtime: Rust 1.95 rust-toolchain.toml:1— rust-toolchain.toml declares Rust 1.95 as this project's toolchain file, and Rust 1.95, superseded by 1.96 on 2026-05-28 (the Rust project patches only the current stable). An unsupported runtime receives no security patches, so every vulnerability disclosed in it since 2026-05-28 is present and unfixable without moving off it. This is a migration rather than an upgrade: there is no newer release of a runtime that has ended.
Outbound HTTP without resilience crates/wezterm-char-props/codegen/src/main.rs:22— `reqwest::blocking::get(` 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.
Orphaned file crates/lfucache/src/lib.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lua-api-crates/mux/src/pane.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-cell/src/image.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lua-api-crates/share-data/src/lib.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-escape-parser/src/lib.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/pty/src/cmdbuilder.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file termwiz/src/widgets/mod.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file termwiz/src/terminal/unix.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-font/src/rasterizer/colr.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file kaku-gui/src/overlay/selector.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file lua-api-crates/serde-funcs/src/lib.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file window/src/bitmaps/mod.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/filedescriptor/src/lib.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file term/src/terminalstate/mouse.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file kaku-gui/src/stats.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-font/src/rasterizer/harfbuzz.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-ssh/src/auth.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file config/src/background.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-dynamic/derive/src/attr.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file kaku-gui/src/scripting/guiwin.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-ssh/src/sftp/mod.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-dynamic/derive/src/fromdynamic.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file kaku-gui/src/termwindow/render/window_buttons.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file kaku-gui/src/quad.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/wezterm-dynamic/src/error.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Duplicated predicate kaku/src/ai_config/tui.rs:3026— `!found && !new_val.is_empty() && new_val != "-"` appears character-identically in 2 files — kaku/src/ai_config/tui.rs, kaku/src/ai_config/tui/providers/codex.rs. 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 kaku/src/reset.rs:381— `!io::stdin().is_terminal() || !io::stdout().is_terminal()` appears character-identically in 2 files — kaku/src/reset.rs, kaku/src/update.rs. 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 kaku/src/ai_config/tui.rs:3155— `!key.modifiers.contains(KeyModifiers::CONTROL) && !key.modifiers.contains(KeyModifiers::SUPER)` appears character-identically in 2 files — kaku/src/ai_config/tui.rs, kaku/src/config_tui/mod.rs. 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 kaku-gui/src/termwindow/render/paint.rs:275— `!self.window_background.is_empty() || self.config.window_background_opacity != 1.0` appears character-identically in 2 files — kaku-gui/src/termwindow/render/paint.rs, kaku-gui/src/termwindow/render/tab_bar.rs. 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 kaku/src/doctor.rs:81— `answer.is_empty() || answer == "y" || answer == "yes"` appears character-identically in 2 files — kaku/src/doctor.rs, kaku/src/reset.rs. 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 kaku-gui/src/termwindow/mod.rs:1680— `config.enable_tab_bar && !config.hide_tab_bar_if_only_one_tab` appears character-identically in 2 files — kaku-gui/src/termwindow/mod.rs, kaku-gui/src/termwindow/resize.rs. 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 crates/wezterm-dynamic/derive/src/fromdynamic.rs:140— `input.generics.lt_token.is_some() || input.generics.where_clause.is_some()` appears character-identically in 2 files — crates/wezterm-dynamic/derive/src/fromdynamic.rs, crates/wezterm-dynamic/derive/src/todynamic.rs. 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 crates/wezterm-input-types/src/lib.rs:1974— `mods.contains(Modifiers::CTRL) && ctrl_mapping(c).is_some()` appears character-identically in 2 files — crates/wezterm-input-types/src/lib.rs, termwiz/src/input.rs. 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 kaku-gui/src/ai_client/assistant_config.rs:301— `name.eq_ignore_ascii_case("authorization") || name.eq_ignore_ascii_case("content-type")` appears character-identically in 2 files — kaku-gui/src/ai_client/assistant_config.rs, kaku/src/ai_config/tui.rs. 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 kaku-gui/src/ai_chat_engine/mod.rs:1100— `self.client.config().effective_api_mode() == ApiMode::Responses && !msg.responses_items.is_empty()` appears character-identically in 2 files — kaku-gui/src/ai_chat_engine/mod.rs, kaku-gui/src/overlay/ai_chat/state.rs. 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 kaku-gui/src/overlay/launcher.rs:682— `self.filter_term.pop().is_none() && !self.always_fuzzy` appears character-identically in 2 files — kaku-gui/src/overlay/launcher.rs, kaku-gui/src/overlay/selector.rs. 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 kaku-gui/src/overlay/launcher.rs:527— `self.filtering || !self.filter_term.is_empty()` appears character-identically in 2 files — kaku-gui/src/overlay/launcher.rs, kaku-gui/src/overlay/selector.rs. 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 kaku-gui/src/termwindow/render/agent_title.rs:210— `self.show_tab_bar && !self.config.tab_bar_at_bottom` appears character-identically in 4 files — kaku-gui/src/termwindow/render/agent_title.rs, kaku-gui/src/termwindow/render/borders.rs, kaku-gui/src/termwindow/render/mod.rs, kaku-gui/src/termwindow/render/paint.rs. 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 kaku-gui/src/termwindow/render/paint.rs:368— `self.show_tab_bar && self.config.tab_bar_at_bottom` appears character-identically in 2 files — kaku-gui/src/termwindow/render/paint.rs, kaku-gui/src/termwindow/render/pane.rs. 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 kaku-gui/src/termwindow/charselect.rs:395— `term_window.show_tab_bar && !term_window.config.tab_bar_at_bottom` appears character-identically in 3 files — kaku-gui/src/termwindow/charselect.rs, kaku-gui/src/termwindow/palette.rs, kaku-gui/src/termwindow/paneselect.rs. 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 crates/wezterm-font/src/rasterizer/freetype.rs:472— `width as usize == 0 || height as usize == 0` appears character-identically in 2 files — crates/wezterm-font/src/rasterizer/freetype.rs, crates/wezterm-font/src/rasterizer/harfbuzz.rs. 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 kaku-gui/src/overlay/launcher.rs:734— `y > 0 && y as usize <= self.filtered_entries.len()` appears character-identically in 2 files — kaku-gui/src/overlay/launcher.rs, kaku-gui/src/overlay/selector.rs. 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.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:786— `info!` at line 786 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:877— `info!` at line 877 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:882— `info!` at line 882 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1047— `info!` at line 1047 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1283— `warn!` at line 1283 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1291— `warn!` at line 1291 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1320— `info!` at line 1320 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1339— `info!` at line 1339 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1352— `info!` at line 1352 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/kaku-relay/src/main.rs:1362— `info!` at line 1362 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Silent fallback default on Err crates/wezterm-font/src/ftwrap.rs:733— `get_palette_data` turns every `Err` into `String::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 kaku/src/diagnostics.rs:322— `newest_files` 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 kaku-gui/src/ai_conversations.rs:196— `load_index` turns every `Err` into `vec![]` — 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 kaku-gui/src/overlay/ai_chat/state.rs:368— `read_file_preview` turns every `Err` into `"[unreadable file omitted]".to_string()` — 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 window/src/os/macos/connection.rs:167— `name` turns every `Err` into `"macOS".to_string()` — 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 30 significant file(s) lose their only recent owner: kaku-gui/src/customglyph.rs, termwiz/src/input.rs, kaku-gui/src/ai_chat_engine/mod.rs, crates/wezterm-cell/src/lib.rs, crates/color-types/src/lib.rs, kaku-gui/src/ai_tools/search.rs, kaku-gui/src/ai_chat_engine/approval.rs, kaku-gui/src/overlay/ai_chat/input.rs (+22 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 11 significant file(s) lose their only recent owner: kaku-gui/src/ai_client/mod.rs, kaku-gui/src/ai_client/responses.rs, crates/wezterm-escape-parser/src/parser/mod.rs, crates/wezterm-escape-parser/src/apc.rs, termwiz/src/lineedit/mod.rs, kaku-gui/src/ai_client/assistant_config.rs, kaku/src/ai_config/tui/providers/codex.rs, mux/src/connui.rs (+3 more). Pair on, review, or document these before any departure.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×2
REDACTED
REDACTED
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (45 single-owned of 334 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 334 of the 438 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)), anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: crates/wezterm-client/src/pane/clientpane.rs, kaku-gui/src/shapecache.rs, crates/wezterm-font/src/ftwrap.rs, crates/pty/src/unix.rs.
No ADRs found kaku-gui/Cargo.toml:16— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `kaku-gui/Cargo.toml` makes this repository a deployable product (line 16).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 2 of 65 project(s) overshoot their size bounds, lowering Project Cohesion to 9.4/10. The most over is `kaku-gui` (77828 LoC, 257 module-visible types across 12 directories). 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.
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 115 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: crates/lfucache/src/lib.rs, lua-api-crates/mux/src/pane.rs, crates/wezterm-cell/src/image.rs, lua-api-crates/share-data/src/lib.rs, crates/wezterm-escape-parser/src/lib.rs, crates/pty/src/cmdbuilder.rs, termwiz/src/widgets/mod.rs, termwiz/src/terminal/unix.rs (and 107 more) (137 orphaned of 334 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 334 of the 438 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
README/code drift term/README.md:18— term/README.md links to `terminal/struct.Terminal.html`, but `term/terminal/struct.Terminal.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
P10 · Library API & versioning· Implementation type on the public API · ×1
Implementation type on the public API window/src/os/macos/window.rs:212— 1 public type in `window.os.macos.window` is marked as implementation by its own namespace, folder or name: `BackendImpl` (window/src/os/macos/window.rs:212, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Logging is not universal — Only 25/26 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/wezterm-char-props/codegen`.
No release approval gate — The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
Security headers incomplete — Set: Referrer-Policy. Missing: Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each.(−2.0 on this card.) The server: `axum::serve(` (crates/kaku-remote/src/lib.rs:709).
No inbound request validation detected — No handler of this repository's Rust server answers 400, 413 or 422 (`StatusCode::BAD_REQUEST`, `HttpResponse::BadRequest()`, `Status::BadRequest`, tonic `Status::invalid_argument`), and nothing declares validation — no `validator`/`garde` derive, no body limit (`DefaultBodyLimit::max`, `RequestBodyLimitLayer`, `JsonConfig::default().limit(…)`, Rocket `Limits`) — nothing shows inbound requests being checked, and refused, before a handler acts on them. A check that answers its failure with 200 and an error body is not seen. (−2.0 on this card.) The server: `axum::serve(` (crates/kaku-remote/src/lib.rs:709).
Subsumed condition operand kaku-gui/src/ai_chat_engine/mod.rs:1426— `prompt.contains("SHELL SAFETY")` can never decide this `||` — every value satisfying `prompt.contains("SHELL SAFETY")` also satisfies `prompt.contains("SAFETY")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Outdated: anyhow — `anyhow` is locked at 1.0.103 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in config/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
Outdated: async-executor — `async-executor` is locked at 1.13.3 but 1.14.1 is the current stable release on crates.io, and it already satisfies the `"1.11"` requirement declared in crates/promise/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-executor` and commit the updated REDACTED.
Outdated: async-trait — `async-trait` is locked at 0.1.89 but 0.1.92 is the current stable release on crates.io, and it already satisfies the `"0.1"` requirement declared in mux/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-trait` and commit the updated REDACTED.
Outdated: axum — `axum` is locked at 0.8.8 but 0.8.9 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in crates/kaku-relay/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p axum` and commit the updated REDACTED.
Outdated: backtrace — `backtrace` is locked at 0.3.76 but 0.3.77 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in crates/env-bootstrap/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p backtrace` and commit the updated REDACTED.
Outdated: bstr — `bstr` is locked at 1.12.1 but 1.13.1 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in crates/luahelper/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bstr` and commit the updated REDACTED.
Outdated: bytemuck — `bytemuck` is locked at 1.24.0 but 1.25.2 is the current stable release on crates.io, and it already satisfies the `"1.4"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytemuck` and commit the updated REDACTED.
Outdated: bytes — `bytes` is locked at 1.11.1 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in window/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytes` and commit the updated REDACTED.
Outdated: camino — `camino` is locked at 1.2.1 but 1.2.6 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in crates/wezterm-ssh/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p camino` and commit the updated REDACTED.
Outdated: cc — `cc` is locked at 1.2.57 but 1.11.2 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in deps/cairo/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cc` and commit the updated REDACTED.
Outdated: chrono — `chrono` is locked at 0.4.42 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
Outdated: clap — `clap` is locked at 4.5.51 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.0"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
Outdated: clap_complete — `clap_complete` is locked at 4.5.60 but 4.6.11 is the current stable release on crates.io, and it already satisfies the `"4.4"` requirement declared in kaku/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap_complete` and commit the updated REDACTED.
Outdated: crossbeam — `crossbeam` is locked at 0.8.4 but 0.8.5 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in mux/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam` and commit the updated REDACTED.
Outdated: encoding_rs — `encoding_rs` is locked at 0.8.35 but 0.8.44 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in mux/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p encoding_rs` and commit the updated REDACTED.
Outdated: euclid — `euclid` is locked at 0.22.11 but 0.22.14 is the current stable release on crates.io, and it already satisfies the `"0.22"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p euclid` and commit the updated REDACTED.
Outdated: fastrand — `fastrand` is locked at 2.3.0 but 2.5.0 is the current stable release on crates.io, and it already satisfies the `"2.0"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p fastrand` and commit the updated REDACTED.
Outdated: filenamegen — `filenamegen` is locked at 0.2.7 but 0.2.8 is the current stable release on crates.io, and it already satisfies the `"0.2.6"` requirement declared in crates/wezterm-ssh/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p filenamegen` and commit the updated REDACTED.
Outdated: fixed — `fixed` is locked at 1.29.0 but 1.31.0 is the current stable release on crates.io, and it already satisfies the `"1.23"` requirement declared in deps/freetype/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p fixed` and commit the updated REDACTED.
Outdated: flate2 — `flate2` is locked at 1.1.5 but 1.1.11 is the current stable release on crates.io, and it already satisfies the `"1.1"` requirement declared in crates/kaku-remote/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
Outdated: futures — `futures` is locked at 0.3.31 but 0.3.34 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures` and commit the updated REDACTED.
Outdated: futures-util — `futures-util` is locked at 0.3.31 but 0.3.34 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in crates/kaku-relay/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p futures-util` and commit the updated REDACTED.
Outdated: hdrhistogram — `hdrhistogram` is locked at 7.5.4 but 7.6.0 is the current stable release on crates.io, and it already satisfies the `"7.1"` requirement declared in kaku-gui/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hdrhistogram` and commit the updated REDACTED.
Outdated: hostname — `hostname` is locked at 0.4.1 but 0.4.2 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in config/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hostname` and commit the updated REDACTED.
Outdated: humantime — `humantime` is locked at 2.3.0 but 2.4.0 is the current stable release on crates.io, and it already satisfies the `"2.1"` requirement declared in kaku/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p humantime` and commit the updated REDACTED.
Skipped (documented): a lost WebGL context hands the grid to the DOM at once and comes back crates/kaku-remote/tests/web.test.cjs:1949— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): switching tabs never shows a frame of wrong letters while WebGL merges glyph pages crates/kaku-remote/tests/web.test.cjs:1981— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): the grid draws with WebGL where the browser has it, and with the DOM otherwise crates/kaku-remote/tests/web.test.cjs:2117— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): an icon drawn before its font loaded is redrawn once the font is in crates/kaku-remote/tests/web.test.cjs:2490— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
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.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 1 file(s) — `crates/kaku-remote/assets/web/xterm-webgl.js` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1db4c-e812-718f-bc52-39b78934be1e · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 65 · Warnings: 1680 · Recommendations: 166 · Info: 63 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 18:23 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.